SysImageGenerator

Generation of Julia sysimages of quantum-many-body packages.

Sysimages can be used to reduce the latency of Julia just-in-time (JIT) compilation during the first run of codes. Based on PackageCompiler, this package could generate the appropriate sysimage of the packages maintained by the Quantum Many Body Group, such as QuantumLattices, ExactDiagonalization, TightBindingApproximation, SpinWaveTheory, etc., to significantly reduce their JIT compilation time. Moreover, the generated sysimage could also be installed as a new jupyter notebook kernel if you prefer IJulia.

Installation

In Julia v1.6+, please type ] in the REPL to use the package mode, then type this command:

pkg> add https://github.com/Quantum-Many-Body/SysImageGenerator.jl

Generation of sysimage

The sysimage of quantum-many-body packages can be generated by the sysimage function exported by this package. The simplest way to achieve such a goal is to run the following codes either in a script or in the REPL:

using SysImageGenerator
sysimage()

The general usage of sysimage is as follows:

sysimage(name_of_the_generated_sysimage;
    packages=["subset of the supported quantum-many-body packages"],
    path="path to store the generated sysimage",
    plot=true, # if you want Plots to be included in your sysimage, otherwise false
    symbolic=true # if you want SymPy to be included in your sysimage, otherwise false
    )

Here,

  • the default sysimage name is default_sysimage,
  • the supported quantum-many-body packages are supported_packages, also by default, all packages will be included,
  • and the default path to store the generated sysimage is "path-to-SysImageGenerator-Package/sysimages/".
Note

The generation of the sysimage may take a couple of minutes. Just wait for its completion.

Install new Jupyter notebook kernel with the generated sysimage

After the generation of the sysimage of quantum-many-body packages, you can install a specific Jupyter notebook kernel that uses it by the installkernel function exported by this package:

using SysImageGenerator
installkernel(name_of_the_installed_kernel; # default value is "Julia-QuantumManyBody"
    sysimage="name of the generated sysimage",
    path="path of the generated sysimage"
)

The sysimage and path keyword arguments should be the same with those accepted by the sysimage function that generates the sysimage. The default arguments of these two functions are compatible. So if you generate a sysimage by

sysimage()

then you can simply install it by

installkernel()

accordingly.

Manual

SysImageGenerator.supported_packagesConstant
const supported_packages = [
    "QuantumLattices",
    "ExactDiagonalization",
    "TightBindingApproximation",
    "SpinWaveTheory",
    "MagnonPhononHybridization"
]

The supported quantum-many-body packages that could be specified to generate the Julia sysimages.

source
IJulia.installkernelFunction
installkernel(
    kernel::String="Julia-QuantumManyBody";
    sysimage::String=default_sysimage,
    path::String=string(dirname(dirname(pathof_noload("SysImageGenerator"))), "/sysimages")
    )

Install a Jupyter notebook kernel with the specified sysimage.

source
SysImageGenerator.sysimageFunction
sysimage(
    name::String=default_sysimage;
    packages::Vector{String}=copy(supported_packages),
    path::String=string(dirname(dirname(pathof_noload("SysImageGenerator"))), "/sysimages"),
    plot::Bool=true,
    symbolic::Bool=true
    )

Create a sysimage with a given name for the specified packages and store it in the specified path.

When plot is true, Plots will be included in the sysimage. So will SymPy when symbolic is true.

source