jcuda.runtime.JCuda.cudaStreamCreate()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中jcuda.runtime.JCuda.cudaStreamCreate()方法的一些代码示例,展示了JCuda.cudaStreamCreate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JCuda.cudaStreamCreate()方法的具体详情如下:
包路径:jcuda.runtime.JCuda
类名称:JCuda
方法名:cudaStreamCreate

JCuda.cudaStreamCreate介绍

[英]Create an asynchronous stream.

cudaError_t cudaStreamCreate ( 
cudaStream_t* pStream )

Create an asynchronous stream. Creates a new asynchronous stream.
Note:

Note that this function may also return error codes from previous, asynchronous launches.
[中]创建一个异步流

cudaError_t cudaStreamCreate ( 
cudaStream_t* pStream )

创建一个异步流。创建一个新的异步流。
注:
请注意,此函数还可能返回以前异步启动的错误代码。

代码示例

代码示例来源:origin: org.nd4j/nd4j-jcublas-common

/**
 * Get the stream for the current thread
 * based on the device for the thread
 * @return the stream for the device and
 * thread
 */
public synchronized cudaStream_t getCudaStream() {
  Thread currentThread = Thread.currentThread();
  CUcontext ctx = getContext(getDeviceForThread());
  cudaStream_t stream = cudaStreams.get(ctx, currentThread.getName());
  if(stream == null) {
    stream = new cudaStream_t();
    checkResult(JCudaDriver.cuCtxSetCurrent(ctx));
    JCuda.cudaStreamCreate(stream);
    checkResult(JCuda.cudaStreamCreate(stream));
    cudaStreams.put(ctx, currentThread.getName(), stream);
  }
  return stream;
}

代码示例来源:origin: com.simiacryptus/mindseye-cudnn

/**
 * Cuda stream create cuda resource.
 *
 * @return the cuda resource
 */
public static CudaResource<cudaStream_t> cudaStreamCreate() {
 long startTime = System.nanoTime();
 @Nonnull cudaStream_t stream = new cudaStream_t();
 int result = JCuda.cudaStreamCreate(stream);
 cudaStreamCreate_execution.accept((System.nanoTime() - startTime) / 1e9);
 log("cudaStreamCreate", result, new Object[]{stream});
 handle(result);
 return new CudaStream(stream);
}

代码示例来源:origin: com.simiacryptus/mindseye

/**
 * Cuda stream create cuda resource.
 *
 * @return the cuda resource
 */
public static CudaResource<cudaStream_t> cudaStreamCreate() {
 long startTime = System.nanoTime();
 @Nonnull cudaStream_t stream = new cudaStream_t();
 int result = JCuda.cudaStreamCreate(stream);
 cudaStreamCreate_execution.accept((System.nanoTime() - startTime) / 1e9);
 log("cudaStreamCreate", result, new Object[]{stream});
 handle(result);
 return new CudaStream(stream);
}

相关文章

JCuda类方法