In [1]:
import ngsolve as ngs
ngs.__version__
Out[1]:
'6.2.2307-7-gacaa2a3a3'
In [2]:
import numpy as np
import ngsolve.ngscuda as ncu
CUDA Device Query... There is 1 CUDA device. CUDA Device 0: Quadro RTX 5000, cap 7.5 Using device 0 Initializing cublas and cusparse.
In [3]:
n = 3
v = np.arange(n, dtype=float)
v
Out[3]:
array([0., 1., 2.])
In [4]:
u = ncu.UnifiedVector(v)
print(u)
output unified vector of size 3, host = 1, dev = 0 0 1 2
In [5]:
u.UpdateDevice()
print(u)
output unified vector of size 3, host = 1, dev = 1 0 1 2
In [6]:
w = 2*u
we = w.Evaluate()
print(we)
we.UpdateHost()
print(we)
output unified vector of size 3, host = 0, dev = 1 host not up-to-data. printing device data 0 0 0 output unified vector of size 3, host = 1, dev = 1 0 0 0