BlockSparseGPUTests is a library for testing the performance of different ITensor based tensor network algorithms.
The source code for ITensor can be found on Github.
Additional documentation for ITensor can be found on the ITensor website itensor.org.
Development of ITensor is supported by the Flatiron Institute, a division of the Simons Foundation.
The ITensors package can be installed with git only, it is not a registered Julia package.
From the Julia REPL, type ]
to enter the Pkg REPL mode and run:
~ git clone https://github.com/kmp5VT/BlockSparseGPUTests
~ cd BlockSparseGPUTests
~ julia
julia> include("src/BlockSparseGPUTests")
For testing the ITensors GPU and backend performance using realistic DMRG systems.
Direction/goal of the library:
- Representative small, medium and large tensor networks can be extracted from HDF5 files in
runnable_examples/hdf5
- The file
runnable_examples/time_contractions.jl
has easy to follow instructions on how to grab the HDF5 tensor networks and time the contractions of the networks. - There exists an examples on how to adapt the tensor networks for testing with different percisions and GPU backends.
- The
summarize_itensor
function can be used to extract easy to read and useful information about tensors, indices and index block sizes. - In the future will create functions that allow users to pluck the representative out of a DMRG optimization at a specific sweep and at a specific site.
- In the future, making an easy function to extract the block data from the ITensors and write them to a dense Array.
You can find the HDF5 tensor network files in runnable_examples/hdf5/SIZE
where SIZE= ["small", "medium", "large"]
. Each tensor network in these folders corresponds to a tensor diagram from the notes/DMRG_contraction
PDF and are the filenames correspond to the labels in this document. A single HDF5 file can be read in simply using
julia> using HDF5, ITensors
julia> fid = h5open("/path/to/tensor/network")
julia> RHS_tensor = read(fid, "T1", ITensor)
julia> LHS_tensor = read(fid, "T2", ITensor)
julia> close(fid)
In all the files, the right hand side tensor from the tensor network diagram is stored as "T1" and the left hand side tensor from the tensor network diagram is stored as "T2".
The tensor network contraction can simply be constructed using the *
operation, i.e.
julia> output = RHS_tensor * LHS_tensor
and ones favorite benchmark tooling can be used to profile the tensors, for example
julia> @time RHS_tensor * LHS_tensor
There also exists a simple script for running all networks from a single folder in runnable_examples/example_timings.jl
There is also a simple interface to inspect the information about a single tensor
julia> fid = h5open("runnable_examples/hdf5/small/sparse/S1.h5")
julia> T1 = read(fid, "T1", ITensor)
julia> close(fid)
julia> summarize_itensor(T1)
Order-3 Tensor
Index 1:
(dim=4|id=845|tags="Electron,Site,n=3"|dir=Neither)
Index 2:
(dim=55|id=100|tags="Link,l=3"|dir=Neither)
Index 3:
(dim=16|id=451|tags="Link,l=2"|dir=Neither)
julia> summarize_itensor(T1; outputlevel=1)
Order-3 Tensor
Index 1:
(dim=4|id=845|tags="Electron,Site,n=3"|dir=Neither)
blockdims:[1, 1, 1, 1]
Index 2:
(dim=55|id=100|tags="Link,l=3"|dir=Neither)
blockdims:[1, 3, 2, 3, 7, 3, 1, 8, 7, 1, 3, 7, 3, 3, 2, 1]
Index 3:
(dim=16|id=451|tags="Link,l=2"|dir=Neither)
blockdims:[1, 2, 2, 1, 4, 1, 2, 2, 1]
julia> summarize_itensor(T1; outputlevel=2)
Order-3 Tensor
Index 1:
(dim=4|id=845|tags="Electron,Site,n=3"|dir=Neither)
blockdims:[1, 1, 1, 1]
Index 2:
(dim=55|id=100|tags="Link,l=3"|dir=Neither)
blockdims:[1, 3, 2, 3, 7, 3, 1, 8, 7, 1, 3, 7, 3, 3, 2, 1]
Index 3:
(dim=16|id=451|tags="Link,l=2"|dir=Neither)
blockdims:[1, 2, 2, 1, 4, 1, 2, 2, 1]
length of block Block(4, 1, 1) is 3
length of block Block(2, 2, 1) is 3
...
It is also possible to run ones own models using