NumPy Loop в порядке.
Cupy Loop 1 раз, 3 раза в порядке.но 10 раз делает ошибку.
как я могу решить эту проблему?
это проблема памяти GPU?
(исходный код)
import cupy as cp
import numpy as np
mc = 5000
def fcal(ff, nloop, skey):
maa = ff.zeros((mc,mc)) + 0.0
mbb = ff.zeros((mc,mc)) + 0.0
for jj in range(nloop): maa = ff.dot(maa, mbb)
asum = ff.sum(maa)
print("[fcal] (%s) nloop=[%2d] asum=[%s]" % (skey, nloop, asum))
fcal(np, 1, "np")
fcal(np, 3, "np")
fcal(np, 10, "np")
fcal(cp, 1, "cp")
fcal(cp, 3, "cp")
fcal(cp, 10, "cp")
(результат выполнения)
[fcal] (np) nloop=[ 1] asum=[0.0]
[fcal] (np) nloop=[ 3] asum=[0.0]
[fcal] (np) nloop=[10] asum=[0.0]
[fcal] (cp) nloop=[ 1] asum=[0.0]
[fcal] (cp) nloop=[ 3] asum=[0.0]
Traceback (most recent call last):
File "C:\testdir\2cupy_test.py", line 30, in <module>
fcal(cp, 10, "cp")
File "C:\testdir\2cupy_test.py", line 22, in fcal
print("[fcal] (%s) nloop=[%2d] asum=[%s]" % (skey, nloop, asum))
File "cupy\core\core.pyx", line 1596, in cupy.core.core.ndarray.__str__
File "cupy\core\core.pyx", line 1643, in cupy.core.core.ndarray.get
File "cupy\cuda\memory.pyx", line 372, in cupy.cuda.memory.MemoryPointer.copy_to_host
File "cupy\cuda\runtime.pyx", line 255, in cupy.cuda.runtime.memcpy
File "cupy\cuda\runtime.pyx", line 135, in cupy.cuda.runtime.check_status
cupy.cuda.runtime.CUDARuntimeError: cudaErrorLaunchFailure: unspecified launch failure