Create sysimage with PackageCompiler power
MIT License
$ git clone https://github.com/terasakisatoshi/sysimage_creator.git
$ pip install jupyter jupytext nbconvert ipykernel
$ cd sysimage_creator && make && jupyter notebook
Then open your jupyter notebook and select a kernel named Julia-sys 1.6.3
jupyter
(or jupyterlab
instead) and jupytext
via:$ pip install jupyter jupytext
$ pip install nbconvert ipykernel cython # I'm not sure, but you will need on Windows.
julia
command.$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.3 (2021-09-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> # congrats!
julia> exit() # exit from julia REPL
$ julia # you can start again.
julia> ENV["PYTHON"]=""; ENV["JUPYTER"]=""
julia> using Pkg; Pkg.add(["PyCall", "IJulia", "Conda"])
julia> using Conda; Conda.add(["jupyter", "jupytext"], channel="conda-forge")
julia>
. Then just do paste to your julia REPL.ENV["PYTHON"]=""; ENV["JUPYTER"]=""
makes julia select Python provided via Conad.jl. Conda.jl uses the miniconda Python environment, which only includes conda and its dependencies. If you have LITTLE experience with Python, just follow the instructions above is fine.$ python
>>>
$ pip install numpy
or whatever
$ jupyter notebook
If so, you may consider do the following command:
julia> run(`pip install jupyter jupytext nbconvert ipykernel`)
julia> ENV["PYTHON"]=Sys.which("python3"); ENV["JUPYTER"]=Sys.which("jupyter")
julia> using Pkg; Pkg.build(["PyCall", "IJulia"])
What does it do? Well, read the code: deps/build.jl.
Anyway, after finished the installation, let's initialize Juptyer notebook:
julia> using IJulia; notebook(dir=pwd())
$ make
command in your terminal.make
. It will make sysimage named sys.{DLEXT}
, where DLEXT
is dylib, dll or so
.$ make
...
...
...
$ ls
sys.dylib # e.g. macOS users
$ cat benchmark.jl
# use standard julia
@time run(`jupytext --to ipynb --execute testout_naive.jl`)
# use sys.${DLEXT} as sysimage
@time run(`jupytext --to ipynb --execute testout_sys.jl`)
$ julia --project=@. benchmark.jl
or just run make test
:D.
$ jupyter notebook
Julia-sys 1.6.3
.installkernel.jl
which is stored in this repository.$ cat ~/Library/Jupyter/kernels/julia-sys-1.6/kernel.json
{
"display_name": "Julia-sys 1.6.3",
"argv": [
"/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia",
"-i",
"--color=yes",
"--project=@.",
"--sysimage=sys", # <--- this `sys` is a name of sysimage
"/Users/<your-user-name>/.julia/packages/IJulia/e8kqU/src/kernel.jl",
"{connection_file}"
],
"language": "julia",
"env": {},
"interrupt_mode": "signal"
}
testout_sys.jl
file, Jupyter recognize this file as notebook, and initialize it with option --sysimage=sys
.testout_sys.jl
using our sysimage:testout_naive.jl
using standard sysimage, which is so slow: