Using an ITensors sysimage when starting the Julia REPL in VS Code?

Hi, I am using the library ITensors, which suggests on its website (Running ITensor and Julia Codes · ITensors.jl) to generate a sysimage for faster startup times

julia> using ITensors; ITensors.compile()

In a terminal, this can be loaded if I start julia with the extension

$ julia --sysimage ~/.julia/sysimages/sys_itensors.so

Question: I would like the Julia REPL in VS Code to automatically start Julia in this way, that is, using the ITensors sysimage. How do I do this?

Follow up question: I am using a Jupyter notebooks in VS Code with a Julia Kernel. How can I tell Kernel that it should load the ITensors sysimage when it starts?

1 Like

Have a look here. That’s how I start my VSCode Julia sessions.

Not sure about the Jupyter notebook question.

You need to add a custom kernel to Jupyter. Below will add a kernel called “julia_ITensors”

using IJulia
installkernel("julia_ITensors","--sysimage=~/.julia/sysimages/sys_itensors.so")

See: Installation · IJulia

Thanks. The custom kernal for Jupyter works great.

However, considering my original question. If I follow the advice by TI23XPRO, I need to first create a project environment, then build a custom sysimage that is saved in the same project folder and then VSC is supposed to automatically find it. However, if I don’t want to create an environment and a custom sysimage of this environment (which might also include other packages), how to I tell VSC to consider the sysimage sys_itensors.so in my .julia/sysimages folder?

add "--sysimage ~/.julia/sysimages/sys_itensors.so" as an argument per How to launch Julia with command-line arguments in VS Code? - #2 by BenPH

1 Like

Thanks @DrPapa and @TI36XPro . We are adding the information above to the ITensor docs.