Installing Julia-1.8.4 and ITensor

If you are using Julia Programming Language and installing Julia-1.8.4, you may want to take a look at a useful guide Installing Julia and ITensor

$ wget
$ tar -zxvf julia-1.8.4-linux-x86_64.tar.gz
$ cd julia-1.8.4/bin
$ ./julia
  _       _ _(_)_     |  Documentation:
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.4 (2022-12-23)
 _/ |\__'_|_|_|\__'_|  |  Official release
|__/                   |

Adding ITensors to Julia

julia> ]
(@v1.8) pkg>
(@v1.8) pkg> add ITensors

Going back to Julia Prompt

julia> using ITensors;
julia> ITensors.compile()
The directory "/home/user1/.julia/sysimages" doesn't exist yet, creating it now.

Creating the system image "/home/user1/.julia/sysimages/" containing the compiled version of ITensors. This may take a few minutes.
[ Info: PackageCompiler: Executing /home/user1/.julia/packages/ITensors/fpBnt/src/packagecompile/precompile_itensors.jl => /tmp/jl_packagecompiler_39UDnM/jl_Ob4eph
After sweep 1 energy=-7.313531193678388  maxlinkdim=10 maxerr=9.32E-05 time=22.605
After sweep 2 energy=-7.365742085591064  maxlinkdim=10 maxerr=8.87E-04 time=0.008
After sweep 3 energy=-7.3661068404588725  maxlinkdim=10 maxerr=9.21E-04 time=0.007
After sweep 1 energy=-7.337730647281005  maxlinkdim=10 maxerr=1.75E-04 time=11.838
After sweep 2 energy=-7.366041088098082  maxlinkdim=10 maxerr=9.31E-04 time=0.031
After sweep 3 energy=-7.366112132349537  maxlinkdim=10 maxerr=9.23E-04 time=0.030

[ Info: PackageCompiler: Done
✔ [06m:15s] PackageCompiler: compiling incremental system image
You will be able to start Julia with a compiled version of ITensors using:

~ julia --sysimage /home/user1/.julia/sysimages/

and you should see that the startup times and JIT compilation times are substantially improved when you are using ITensors.

In unix, you can create an alias with the Bash command:

~ alias julia_itensors="julia --sysimage /home/user1/.julia/sysimages/ -e 'using ITensors' -i"

which you can put in your `~/.bashrc`, `~/.zshrc`, etc. This also executes
`using ITensors` so that ITensors is loaded and ready to use, you can leave off `
-e 'using ITensors' -i` if you don't want that. Then you can start Julia with a
version of ITensors installed with the command:

~ julia_itensors

Note that if you update ITensors to a new version, for example with `using
Pkg; Pkg.update("ITensors")`, you will need to run the `ITensors.compile()`
command again to recompile the new version of ITensors.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.