Bootstrap

[python]cupy安装后测试代码和numpy速度对比测试代码

测试环境:

anaconda3+python3.9

cupy==13.3.0

测试代码:

import numpy as np
import cupy as cp
import time
start_time = time.time()
x = np.ones((1000,1000,1000))
x= 5*x
x= x*x
end_time = time.time()
print('numpy time is:',end_time - start_time)

start_time = time.time()
x = cp.ones((1000,1000,1000))
x= 5*x
x= x*x
end_time = time.time()
print('cupy time is:',end_time - start_time)

;