健康)状况
- CuPy 7.0.0 版
- 操作系统/平台 Ubuntu 18.04
- CUDA 10.1 版
重现代码
import cupy as np
import time
size = 60000000
tag = np.zeros(size)
#np.random.shuffle(tag)
value = np.random.random(size)
starttime = time.perf_counter()
for i in range(100):
tag +=(value> 0.3)*100
print (time.perf_counter() - starttime)
starttime = time.perf_counter()
cpu_value = np.asnumpy(value)
print (time.perf_counter() - starttime)
- convert cupy to numpy 很慢 结果是
0.02095769099832978 6.170492547998947