# calculation time in using GPU tensor vs CPU tensor

**URL:** <https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535>\
**Category:** ITensor Julia Questions\
**Created:** [November 21, 2025, 8:08pm UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535 "2025-11-21T20:08:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [November 21, 2025, 8:08pm UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/1 "2025-11-21T20:08:13Z")

</div>

Hello,

I am trying to use GPU for faster performance, but the GPU is currently slower than the CPU.

Below is the relevant part of my code.

```auto
t_cTEBD=@elapsed begin

 for t in tau:tau:ttotal

      psi_t_cpu = apply(gates_cpu, psi_t_cpu; cutoff=1e-8,maxdim=400)
      normalize!(psi_t_cpu)

  end
 end

println("TEBD CPU Time = ", t_cTEBD)

t_gTEBD=@elapsed begin

 for t in tau:tau:ttotal

      psi_t_gpu = apply(gates_gpu, psi_t_gpu; cutoff=1e-8,maxdim=400)
      normalize!(psi_t_gpu)

  end  
 end
println("TEBD GPU Time = ", t_gTEBD)

```

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [November 21, 2025, 8:35pm UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/2 "2025-11-21T20:35:13Z")

</div>

Roughly speaking, you will only see good speedups running on GPU when your tensors are large (and dense) and the algorithm you are running is dominated by tensor contractions, since generally tensor factorizations (particularly SVD) aren’t sped up very much when run on GPU.

Standard formulations of TEBD (like the one we use) isn’t that well suited to run on GPU since it is dominated by tensor factorizations such as truncated SVD. There is promising research circumventing that issue ( [[2212.09782] Fast Time-Evolution of Matrix-Product States using the QR decomposition](https://arxiv.org/abs/2212.09782) ) by replacing the truncated SVD with a clever use of a series of QR decompositions (which are relatively better to run on GPU), though we haven’t implemented that yet in ITensor so you would need to implement that yourself if you want to try it. We plan on implementing that alternative version of TEBD (and/or making it easier for users to implement it themselves in a minimal way) but we are in the middle of rewriting a lot of our code right now so we aren’t really implementing new features like that until that rewrite is more complete. Alternatively, algorithms like TDVP may be more amenable to running on GPU.

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [November 22, 2025, 5:21am UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/3 "2025-11-22T05:21:40Z")

</div>

okay. Thank you.

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [November 22, 2025, 11:19am UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/4 "2025-11-22T11:19:53Z")

</div>

When I using tdvp(), got following error

ERROR: LoadError: MethodError: no method matching tdvp(::MPO, ::MPS; dt::Float64, nsweeps::Int64, maxdim::Int64)  
The function `tdvp` exists, but no method is defined for this combination of argument types.

Closest candidates are:  
tdvp(::Any, ::Number, ::MPS; updater\_backend, updater, reverse\_step, time\_step, time\_start, nsweeps, nsteps, step\_observer!, sweep\_observer!, kwargs…)  
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/O4qn7/src/tdvp.jl:66

can you please help?

---

<div class="post-metadata">

**Author:** ![miles](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/miles/32/6_2.png) [@miles](https://itensor.discourse.group/u/miles)\
**Post date:** [November 22, 2025, 5:05pm UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/5 "2025-11-22T17:05:28Z")

</div>

Here’s the docstring for the tdvp function. As you can see below, it expects the arguments in a different order from how you passed them.

```auto
  tdvp(operator, t::Number, init::MPS; time_step, nsteps, kwargs...)

  Use the time dependent variational principle (TDVP) algorithm to compute exp(t * operator) * init
  using an efficient algorithm based on alternating optimization of the MPS tensors and local Krylov
  exponentiation of operator.

  Specify one of time_step or nsteps. If they are both specified, they must satisfy time_step *
  nsteps == t. If neither are specified, the default is nsteps=1, which means that time_step == t.

  Returns:

    • state::MPS - time-evolved MPS

```

---

<div class="post-metadata">

**Author:** ![vrushali.k](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vrushali.k](https://itensor.discourse.group/u/vrushali.k)\
**Post date:** [November 22, 2025, 7:22pm UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/6 "2025-11-22T19:22:48Z")

</div>

Yes, that is correct. I passed arguments in different order. It works now. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)\
**Post date:** [December 2, 2025, 7:23pm UTC](https://itensor.discourse.group/t/calculation-time-in-using-gpu-tensor-vs-cpu-tensor/2535/7 "2025-12-02T19:23:42Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
