本文整理汇总了Java中com.nativelibs4java.opencl.CLEvent.waitFor方法的典型用法代码示例。如果您正苦于以下问题:Java CLEvent.waitFor方法的具体用法?Java CLEvent.waitFor怎么用?Java CLEvent.waitFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nativelibs4java.opencl.CLEvent
的用法示例。
在下文中一共展示了CLEvent.waitFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.nativelibs4java.opencl.CLEvent; //导入方法依赖的package包/类
@Before
public void setUp() throws ProgramBuildException {
// Set up context and queue
context = JavaCL.createBestContext();
queue = context.createDefaultQueue();
// Build program
ProgramBuilder pb = new ProgramBuilder("sha256.cl", "krist_miner.cl", "test_kernels.cl");
pb.addBuildOption("-Werror");
pb.defineMacro("UNIT_TESTING", 1);
program = pb.build(context);
// Test that CL code can be compiled and the testCompile kernel can be
// run without errors
CLKernel kernel = program.createKernel("testCompile");
CLEvent compilationTest = kernel.enqueueNDRange(queue, new int[] { 1 });
compilationTest.waitFor();
}
示例2: setUp
import com.nativelibs4java.opencl.CLEvent; //导入方法依赖的package包/类
@Before
public void setUp() {
context = JavaCL.createBestContext();
queue = context.createDefaultQueue();
String mainCode = CLCodeLoader.loadCode("/sha256.cl");
String minerCode = CLCodeLoader.loadCode("/krist_miner.cl");
String testCode = CLCodeLoader.loadCode("/test_kernels.cl");
assertNotNull("Failed to load main code", mainCode);
assertNotNull("Failed to load miner code", minerCode);
assertNotNull("Failed to load test code", testCode);
program = context.createProgram("#define UNIT_TESTING\n",mainCode, minerCode, testCode);
// Treat all warning as errors so
// tests will fail if warnings occur
program.addBuildOption("-Werror");
// Add other build options
for (String opt : JCLMiner.cl_build_options) {
program.addBuildOption(opt);
}
// Test that CL code can be compiled and the testCompile kernel can be run
CLKernel kernel = program.createKernel("testCompile");
CLEvent compilationTest = kernel.enqueueNDRange(queue, new int[] {1});
compilationTest.waitFor();
}
示例3: waitForRead
import com.nativelibs4java.opencl.CLEvent; //导入方法依赖的package包/类
/**
* Wait until all write operations are completed so that the data is readable.
*/
public synchronized void waitForRead() {
CLEvent.waitFor(lastWriteEvent);
lastWriteEvent = null;
}