【发布时间】:2016-11-08 23:31:57
【问题描述】:
在JCublas2.cublasSdot源代码的cmets中,注释'result'参数可以是'host or device pointer'。
public static int cublasSdot(
cublasHandle handle,
int n,
Pointer x,
int incx,
Pointer y,
int incy,
Pointer result)/** host or device pointer */
{
return checkResult(cublasSdotNative(handle, n, x, incx, y, incy, result));
}
但是,我只能使用像 Pointer.to(fs) 这样的主机指针和 float[] fs ={0}。如果我使用像 'CUdeviceptr devicePtr = new CUdeviceptr(); 这样的设备指针JCudaDriver.cuMemAlloc(devicePtr, 100 * Sizeof.FLOAT);',程序崩溃,控制台消息如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fed93af2a3, pid=9376, tid=0x0000000000003a7c
# .....
主机和设备之间的数据传输最小化可以节省时间。如何使用设备指针作为此方法的“结果”参数,以及其他 JCuda 方法的结果指针用 /** 主机或设备指针 **/ 注释?
【问题讨论】:
-
非常感谢,马可。我稍后再试试。
-
这正好解决了问题。
标签: jcuda