Skip to content

Commit

Permalink
Merge pull request #5 from terasakisatoshi/use-PackageCompilerX
Browse files Browse the repository at this point in the history
Use PackageCompilerX to reduce loading overhead
  • Loading branch information
terasakisatoshi committed Jan 4, 2020
2 parents c0bb25e + 7d59f0e commit 8cc7e50
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ c.NotebookApp.token = u''\n\
# prepare to install extension
RUN jupyter contrib nbextension install --user && \
jupyter nbextensions_configurator enable --user && \
# enable extensions what you want
# enable extensions what you want
jupyter nbextension enable select_keymap/main && \
jupyter nbextension enable highlight_selected_word/main && \
jupyter nbextension enable toggle_all_line_numbers/main && \
Expand All @@ -45,34 +45,42 @@ ENV["JUPYTER"]=Sys.which("jupyter")\n\
\n\
import Pkg\n\
let\n\
pkgs = ["Revise"]\n\
pkgs = ["Revise","OhMyREPL"]\n\
for pkg in pkgs\n\
if Base.find_package(pkg) === nothing\n\
Pkg.add(pkg)\n\
end\n\
end\n\
end\n\
using OhMyREPL \n\
using Revise \n\
' >> /root/.julia/config/startup.jl

# Install Julia Package
RUN julia -E 'using Pkg;\
Pkg.add(["IJulia","Atom","Juno"]);\
using IJulia, Atom, Juno; # for precompilation\
Pkg.add(PackageSpec(url="https://github.com/KristofferC/PackageCompilerX.jl.git",rev="master"));\
using IJulia, Atom, Juno, PackageCompilerX; # for precompilation\
'

# Switch working directory
WORKDIR /work

COPY ./Project.toml /work/Project.toml

RUN julia --trace-compile="traced.jl" -e 'using OhMyREPL, Revise' && \
julia -e 'using PackageCompilerX; \
PackageCompilerX.create_sysimage([:OhMyREPL, :Revise]; precompile_statements_file="traced.jl", replace_default=true)\
' && \
rm traced.jl

# Initialize Julia package using /work/Project.toml
RUN julia --project=/work -e 'using Pkg;\
Pkg.instantiate();\
Pkg.precompile()' && \
# Check Julia version \
julia -e 'using InteractiveUtils; versioninfo()'

# For Jupyter Notebook
EXPOSE 8888
# For Http Server
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name = "MyWorkflow"
uuid = "7abf360e-92cb-4f35-becd-441c2614658a"
authors = ["Satoshi Terasaki <terasakisatoshi.math@gmail.com>"]
version = "0.1.0"
version = "0.2.0"

[deps]
Example = "7876af07-990d-54b4-ab0e-23690620f79a"
SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"

[compat]
julia = "1.3"
Example = "= 0.5.1"
julia = "1.3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down

0 comments on commit 8cc7e50

Please sign in to comment.