本文整理了Java中jcuda.runtime.JCuda.cudaMalloc()
方法的一些代码示例,展示了JCuda.cudaMalloc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JCuda.cudaMalloc()
方法的具体详情如下:
包路径:jcuda.runtime.JCuda
类名称:JCuda
方法名:cudaMalloc
[英]Allocate memory on the device.
cudaError_t cudaMalloc (
void** devPtr,
size_t size )
Allocate memory on the device. Allocates size bytes of linear memory on the device and returns in *devPtr a pointer to the allocated memory. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. cudaMalloc() returns cudaErrorMemoryAllocation in case of failure.
[中]在设备上分配内存
cudaError_t cudaMalloc (
void** devPtr,
size_t size )
在设备上分配内存。在设备上分配线性内存的大小字节,并在*devPtr中返回指向已分配内存的指针。为任何类型的变量适当地对齐分配的内存。内存未被清除。如果失败,cudamaloc()返回cudaerrormoryalLocation。
代码示例来源:origin: deepdsl/deepdsl
public static void allocByte(Pointer data, long size) {
checkError(cudaMalloc(data, size));
}
代码示例来源:origin: com.simiacryptus/mindseye-cudnn
/**
* Cuda malloc int.
*
* @param devPtr the dev ptr
* @param size the size
* @return the int
*/
public static int cudaMalloc(final CudaPointer devPtr, final long size) {
long startTime = System.nanoTime();
final int result = JCuda.cudaMalloc(devPtr, size);
log("cudaMalloc", result, new Object[]{devPtr, size});
cudaMalloc_execution.accept((System.nanoTime() - startTime) / 1e9);
handle(result);
return result;
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Cuda malloc int.
*
* @param devPtr the dev ptr
* @param size the size
* @return the int
*/
public static int cudaMalloc(final CudaPointer devPtr, final long size) {
long startTime = System.nanoTime();
final int result = JCuda.cudaMalloc(devPtr, size);
log("cudaMalloc", result, new Object[]{devPtr, size});
cudaMalloc_execution.accept((System.nanoTime() - startTime) / 1e9);
handle(result);
return result;
}
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
@Override
public Object alloc(DataBuffer buffer,int stride,int offset,int length) {
Pointer hostData = new Pointer();
JCuda.cudaMalloc(hostData,buffer.length() * buffer.getElementSize());
return new BaseCudaDataBuffer.DevicePointerInfo(hostData,buffer.getElementSize() * buffer.length(),stride,offset);
}
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/jcufft-osx
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
cudaResult = JCuda.cudaMalloc(deviceRIdata, rIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
cudaResult = JCuda.cudaMalloc(deviceRIdata, rIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/jcufft-osx
cudaResult = JCuda.cudaMalloc(deviceRIdata, rIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/jcufft-osx
cudaResult = JCuda.cudaMalloc(deviceRIdata, rIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/jcufft-osx
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceROdata, rOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.jcuda/jcufft
cudaResult = JCuda.cudaMalloc(deviceRIdata, rIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceROdata, rOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.jcuda/jcufft
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceROdata, rOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.jcuda/jcufft
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/nd4j-jcublas-common
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceROdata, rOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.nd4j/jcufft-osx
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceROdata, rOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.jcuda/jcufft
cudaResult = JCuda.cudaMalloc(deviceRIdata, rIdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceCOdata, cOdata.length * Sizeof.FLOAT);
if (cudaResult != cudaError.cudaSuccess)
代码示例来源:origin: org.jcuda/jcufft
cudaResult = JCuda.cudaMalloc(deviceCIdata, cIdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
cudaResult = JCuda.cudaMalloc(deviceROdata, rOdata.length * Sizeof.DOUBLE);
if (cudaResult != cudaError.cudaSuccess)
内容来源于网络,如有侵权,请联系作者删除!