Hi, I am very new to coding on GPUs. I am trying to get a time dependent Ising Hamiltonian running on a GPU for small system and managed to install the required packages. I use the same approach as in the example https://github.com/ITensor/ITensorTDVP.jl/blob/main/examples/03_tdvp_time_dependent.jl. However, there seems to be some error related to time dependent sum .
I have the following error.
ERROR: LoadError: MethodError: no method matching (::var"#f#2"{TimeDependentSum{Tuple{ITensorTDVP.var"#9#11"{var"#15#41"{Float64}, Complex{Int64}}, ITensorTDVP.var"#9#11"{var"#16#42"{Float64}, Complex{Int64}}, ITensorTDVP.var"#9#11"{var"#17#43"{Int64, Int64, Float64}, Complex{Int64}}}, Tuple{ProjMPO, ProjMPO, ProjMPO}}, ITensorTDVP.ITensorsExtensions.var"#to_itensor#1"{ITensor}})(::CuArray{ComplexF32, 1, CUDA.DeviceMemory}, ::SciMLBase.NullParameters, ::Float64)
The function `f` exists, but no method is defined for this combination of argument types.
An arithmetic operation was performed on a NullParameters object. This means no parameters were passed
into the AbstractSciMLProblem (e.x.: ODEProblem) but the parameters object `p` was used in an arithmetic
expression. Two common reasons for this issue are:
1. Forgetting to pass parameters into the problem constructor. For example, `ODEProblem(f,u0,tspan)` should
be `ODEProblem(f,u0,tspan,p)` in order to use parameters.
2. Using the wrong function signature. For example, with `ODEProblem`s the function signature is always
`f(du,u,p,t)` for the in-place form or `f(u,p,t)` for the out-of-place form. Note that the `p` argument
will always be in the function signature regardless of if the problem is defined with parameters!
Closest candidates are:
(::var"#f#2")(::Vector, ::Any, ::Any)
@ Main ~/Projects/QKZM/cuda_codes/03_updaters.jl:12
(::var"#f#2")(::ITensor, ::Any, ::Any)
@ Main ~/Projects/QKZM/cuda_codes/03_updaters.jl:11
It will be great if someone could help me get this running.
In general, double precision calculations (Float64) are not as optimized on GPUs as single precision (Float32). How much slower is it?
It may be that certain operations are particularly unoptimized on GPU when run with double precision, and we could switch to running those operations with single precision. @kmp5 has tried some strategies out like that and was able get a good balance between speed and accuracy but I don’t remember all of the details of that.
Thank you very much for the response. I will try to adapt the code in that case.
Are there any examples on the repository?
The CPU version took just a couple of minutes for all the three types of solvers to finish. On the other hand, each step of the ODE solver itself is taking more than 12-13 mins.
We don’t have examples of that available, that was just internal experiments we were doing.
The CPU version took just a couple of minutes for all the three types of solvers to finish. On the other hand, each step of the ODE solver itself is taking more than 12-13 mins.
Are you preserving QN symmetries in those calculations? And are those times for single precision or double precision calculations? It would be helpful for us to get some more details so we have an idea of when the GPU backends seem to be effective and when they might need improvement.
These run times (12-13 mins on the GPU for each step vs a couple of mins on CPU ) are for the examples that you have in the repository with double precision https://github.com/ITensor/ITensorMPS.jl/blob/main/examples/solvers/03_tdvp_time_dependent.jl.
I also tried another example of an Ising model with double precision on the GPU which took a lot of time. I aborted it after half an hour. It finishes in a couple of mins on CPU as well.
There is no QN preserving symmetries in either of the above examples.
Just in case it is helpful, I am running it on the following hardware and dependencies.
Got it, thanks. Also something to keep in mind is that for smaller bond dimensions, you probably won’t see a big advantage to using GPUs compared to CPUs, in general you’ll see more speedup for larger tensors. I’m not sure what the bond dimensions are in that example.