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

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

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

JCuda.cudaStreamSynchronize介绍

[英]Waits for stream tasks to complete.

cudaError_t cudaStreamSynchronize ( 
cudaStream_t stream )

Waits for stream tasks to complete. Blocks until stream has completed all operations. If the cudaDeviceScheduleBlockingSync flag was set for this device, the host thread will block until the stream is finished with all of its tasks.
Note:

Note that this function may also return error codes from previous, asynchronous launches.
[中]等待流任务完成

cudaError_t cudaStreamSynchronize ( 
cudaStream_t stream )

等待流任务完成。阻塞,直到流完成所有操作。如果为此设备设置了cudaDeviceScheduleBlockingSync标志,则主机线程将阻塞,直到流完成其所有任务。
注:
请注意,此函数还可能返回以前异步启动的错误代码。

代码示例

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

/**
 * Cuda stream synchronize.
 *
 * @param stream the stream
 */
public static void cudaStreamSynchronize(cudaStream_t stream) {
 long startTime = System.nanoTime();
 int result = JCuda.cudaStreamSynchronize(stream);
 cudaStreamSynchronize_execution.accept((System.nanoTime() - startTime) / 1e9);
 log("cudaStreamSynchronize", result, new Object[]{stream});
 handle(result);
}

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

/**
 * Cuda stream synchronize.
 *
 * @param stream the stream
 */
public static void cudaStreamSynchronize(cudaStream_t stream) {
 long startTime = System.nanoTime();
 int result = JCuda.cudaStreamSynchronize(stream);
 cudaStreamSynchronize_execution.accept((System.nanoTime() - startTime) / 1e9);
 log("cudaStreamSynchronize", result, new Object[]{stream});
 handle(result);
}

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

/**
 * Synchronized the stream.
 * This should be run after
 * every operation.
 */
public static void syncStream() {
  JCuda.cudaStreamSynchronize(getInstance().getCudaStream());
  JCudaDriver.cuStreamSynchronize(getInstance().getStream());
}

相关文章

JCuda类方法