# Matrix Exponential of GPU matrix

**URL:** <https://discourse.julialang.org/t/matrix-exponential-of-gpu-matrix/77228>\
**Category:** GPU\
**Tags:** error\
**Created:** [March 1, 2022, 9:01am UTC](https://discourse.julialang.org/t/matrix-exponential-of-gpu-matrix/77228 "2022-03-01T09:01:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Birk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_birk/32/20626_2.png) [@Michael\_Birk](https://discourse.julialang.org/u/Michael_Birk)\
**Post date:** [March 1, 2022, 9:01am UTC](https://discourse.julialang.org/t/matrix-exponential-of-gpu-matrix/77228/1 "2022-03-01T09:01:38Z")

</div>

I am trying to calculate the matrix exponent of a matrix stored on the GPU (via CUDA), but I get the error:

> ERROR: ArgumentError: cannot take the CPU address of a CuArray{Float32, 2, CUDA.  
> Mem.DeviceBuffer}

Minimal working example:

> using CUDA  
> A = cu([1.0 0;0 1])  
> CUDA.exp(A) (This command gives the error message)  
> exp(A) (This command gives both the error message and a scalar indexing warning in the REPL)

I’m sure there is some standard method to calculate the exponent of a GPU matrix, but I can’t tell what I’m doing wrong.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 1, 2022, 11:57am UTC](https://discourse.julialang.org/t/matrix-exponential-of-gpu-matrix/77228/2 "2022-03-01T11:57:06Z")

</div>

ExponentialUtilities.jl’s `exponential!` is GPU compatible IIRC.

---

<div class="post-metadata">

**Author:** ![Michael\_Birk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_birk/32/20626_2.png) [@Michael\_Birk](https://discourse.julialang.org/u/Michael_Birk)\
**Post date:** [March 1, 2022, 3:13pm UTC](https://discourse.julialang.org/t/matrix-exponential-of-gpu-matrix/77228/3 "2022-03-01T15:13:21Z")

</div>

Sadly, `exponential!` causes the same error to be thrown.
