本文整理汇总了Java中jcuda.driver.JCudaDriver.cuMemcpyHtoD方法的典型用法代码示例。如果您正苦于以下问题:Java JCudaDriver.cuMemcpyHtoD方法的具体用法?Java JCudaDriver.cuMemcpyHtoD怎么用?Java JCudaDriver.cuMemcpyHtoD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jcuda.driver.JCudaDriver
的用法示例。
在下文中一共展示了JCudaDriver.cuMemcpyHtoD方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCUdeviceptr
import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
/**
* Create a vector on device and copy host vector to it.
*
* @param values Host vector.
* @return Pointer to device vector.
*/
private CUdeviceptr createCUdeviceptr(float[] values) {
CUdeviceptr cuDevicePtr = createCUdeviceptr((long)values.length);
JCudaDriver.cuMemcpyHtoD(cuDevicePtr, Pointer.to(values),
(long)values.length * Sizeof.FLOAT);
return cuDevicePtr;
}
示例2: initProjectionMatrix
import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
private synchronized void initProjectionMatrix(int projectionNumber){
// load projection Matrix for current Projection.
SimpleMatrix pMat = getGeometry().getProjectionMatrix(projectionNumber).computeP();
float [] pMatFloat = new float[pMat.getCols() * pMat.getRows()];
for (int j = 0; j< pMat.getRows(); j++) {
for (int i = 0; i< pMat.getCols(); i++) {
pMatFloat[(j * pMat.getCols()) + i] = (float) pMat.getElement(j, i);
}
}
JCudaDriver.cuMemcpyHtoD(projectionMatrix, Pointer.to(pMatFloat), Sizeof.FLOAT * pMatFloat.length);
}
示例3: initProjectionMatrix
import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
private synchronized void initProjectionMatrix(int projectionNumber){
// load projection Matrix for current Projection.
SimpleMatrix pMat = getGeometry().getProjectionMatrix(projectionNumber).computeP();
float [] pMatFloat = new float[pMat.getCols() * pMat.getRows()];
for (int j = 0; j< pMat.getRows(); j++) {
for (int i = 0; i< pMat.getCols(); i++) {
pMatFloat[(j * pMat.getCols()) + i] = (float) pMat.getElement(j, i);
}
}
JCudaDriver.cuMemcpyHtoD(projectionMatrix, Pointer.to(pMatFloat), Sizeof.FLOAT * pMatFloat.length);
}
示例4: copyFloatArrayToDevice
import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public static CUdeviceptr copyFloatArrayToDevice(float [] array, CUmodule module, String nameInCode) {
CUdeviceptr devptr = new CUdeviceptr();
JCudaDriver.cuModuleGetGlobal(devptr, new int[1], module, nameInCode);
JCudaDriver.cuMemcpyHtoD(devptr, Pointer.to(array), Sizeof.FLOAT * array.length);
return devptr;
}
示例5: updateFloatArrayOnDevice
import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public static void updateFloatArrayOnDevice(CUdeviceptr devptr, float [] array, CUmodule module) {
//JCudaDriver.cuModuleGetGlobal(devptr, new int[1], module, nameInCode);
JCudaDriver.cuMemcpyHtoD(devptr, Pointer.to(array), Sizeof.FLOAT * array.length);
}