提交 ad4bfd22 authored 作者: amrithasuresh's avatar amrithasuresh

Updated numpy as np

上级 5ed61508
from __future__ import absolute_import, print_function, division
import pycuda.autoinit
import pycuda.driver as drv
import numpy
import numpy as np
from pycuda.compiler import SourceModule
mod = SourceModule("""
......@@ -14,13 +14,13 @@ __global__ void multiply_them(float *dest, float *a, float *b)
multiply_them = mod.get_function("multiply_them")
a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)
a = np.random.randn(400).astype(np.float32)
b = np.random.randn(400).astype(np.float32)
dest = numpy.zeros_like(a)
dest = np.zeros_like(a)
multiply_them(
drv.Out(dest), drv.In(a), drv.In(b),
block=(400,1,1), grid=(1,1))
assert numpy.allclose(dest, a*b)
assert np.allclose(dest, a*b)
print(dest)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论