itensor / itensorparallel.jl Goto Github PK
View Code? Open in Web Editor NEWParallel tools for ITensors.jl.
License: MIT License
Parallel tools for ITensors.jl.
License: MIT License
MPI.jl has added a few more functions that automatically serialize, including gather
and scatter
:
JuliaParallel/MPI.jl#756
JuliaParallel/MPI.jl#758
Should be able to drop our own implementation of gather
in favor of the one in MPI.jl. @b-kloss
If one tries to activate threaded_blocksparse
and MPI
parallelization together to perform DMRG calculation using number conserving sites (doesn't matter the SiteType) the following error is returned during the exact diagonalization step (in this particular case the code ran was this example)
ERROR: LoadError: BoundsError: attempt to access 4-element Vector{Pair{QN, Int64}} at index [5]
Stacktrace:
[1] getindex
@ ./array.jl:861 [inlined]
[2] getindex
@ ./abstractarray.jl:1221 [inlined]
[3] blockdim
@ ~/.julia/packages/ITensors/5dcHw/src/qn/qnindex.jl:15 [inlined]
[4] blockdim
@ ~/.julia/packages/ITensors/5dcHw/src/qn/qnindex.jl:256 [inlined]
[5] blockdim
@ ~/.julia/packages/ITensors/5dcHw/src/qn/qnindex.jl:273 [inlined]
[6] blockdim
@ ~/.julia/packages/NDTensors/lbVmG/src/blocksparse/blockdims.jl:131 [inlined]
[7] #124
@ ~/.julia/packages/NDTensors/lbVmG/src/blocksparse/blockdims.jl:140 [inlined]
[8] macro expansion
@ ./ntuple.jl:74 [inlined]
[9] ntuple
@ ./ntuple.jl:69 [inlined]
[10] blockdims
@ ~/.julia/packages/NDTensors/lbVmG/src/blocksparse/blockdims.jl:140 [inlined]
[11] blockdim
@ ~/.julia/packages/NDTensors/lbVmG/src/blocksparse/blockdims.jl:149 [inlined]
[12] blockoffsets(blocks::Vector{Block{4}}, inds::NTuple{4, Index{Vector{Pair{QN, Int64}}}})
@ NDTensors ~/.julia/packages/NDTensors/lbVmG/src/blocksparse/blockoffsets.jl:71
[13] (NDTensors.BlockSparseTensor)(#unused#::Type{Float64}, blocks::Vector{Block{4}}, inds::NTuple{4, Index{Vector{Pair{QN, Int64}}}})
@ NDTensors ~/.julia/packages/NDTensors/lbVmG/src/blocksparse/blocksparsetensor.jl:97
[14] _Allreduce(#unused#::Type{NDTensors.BlockSparse{Float64, Vector{Float64}, 4}}, sendbuf::ITensor, op::Function, comm::MPI.Comm)
@ ITensorParallel ~/.julia/packages/ITensorParallel/63YWQ/src/mpi_projmposum.jl:44
[15] _Allreduce(sendbuf::ITensor, op::Function, comm::MPI.Comm)
@ ITensorParallel ~/.julia/packages/ITensorParallel/63YWQ/src/mpi_projmposum.jl:22
[16] eigsolve(A::MPISum{ProjMPO}, x₀::ITensor, howmany::Int64, which::Symbol, alg::KrylovKit.Lanczos{KrylovKit.ModifiedGramSchmidt2, Float64})
@ KrylovKit ~/.julia/packages/KrylovKit/kWdb6/src/eigsolve/lanczos.jl:11
It looks like the error slightly changes by changing the dimension of the MPS. In the previous example I used a 8x2 lattice while if I use a 4x2 lattice I get
ERROR: LoadError: MPIError(15): MPI_ERR_TRUNCATE: message truncated
Stacktrace:
[1] MPI_Allreduce
@ ~/.julia/packages/MPI/tJjHF/src/api/generated_api.jl:288 [inlined]
[2] Allreduce!(rbuf::MPI.RBuffer{Vector{Float64}, Vector{Float64}}, op::MPI.Op, comm::MPI.Comm)
@ MPI ~/.julia/packages/MPI/tJjHF/src/collective.jl:653
[3] _Allreduce(sendbuf::ITensor, op::Function, comm::MPI.Comm)
@ ITensorParallel ~/.julia/packages/ITensorParallel/63YWQ/src/mpi_projmposum.jl:22
[4] eigsolve(A::MPISum{ProjMPO}, x₀::ITensor, howmany::Int64, which::Symbol, alg::KrylovKit.Lanczos{KrylovKit.ModifiedGramSchmidt2, Float64})
@ KrylovKit ~/.julia/packages/KrylovKit/kWdb6/src/eigsolve/lanczos.jl:11
in expression starting at /mnt/home/nbaldelli/parheis.jl:61
threaded_blocksparse
and MPI
work smoothly singularly by deactivating the other and work together by turning off the QNs conservation.
I ran the code using mpirun
by using the following bash script:
#!/bin/bash
#SBATCH -N2
#SBATCH --ntasks-per-node 1
#SBATCH --cpus-per-task 8
module purge
module load slurm
module load openmpi/4
module load julia
julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'
mpirun julia -t 8 <name_file_here>
Switch to using a package extension for any code that depends on MPI, so that MPI doesn't need to be a dependency (and same for Distributed, but that one is a standard library so not as important).
In fact, we could make this package a package extension of ITensors.jl once it is a bit more developed.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.