test_blas_low_level.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:pyculib 作者: numba 项目源码 文件源码
def Tdot(self, fn, dtype):
        from pyculib.blas.binding import cuBlas

        x = np.random.random(10).astype(dtype)
        y = np.random.random(10).astype(dtype)
        d_x = cuda.to_device(x)
        d_y = cuda.to_device(y)

        blas = cuBlas()
        got = getattr(blas, fn)(x.size, d_x, 1, d_y, 1)
        if fn.endswith('c'):
            exp = np.vdot(x, y)
        else:
            exp = np.dot(x, y)
        self.assertTrue(np.allclose(got, exp))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号