X Tutup
Skip to content

Commit 4b4e61d

Browse files
author
Olivier Chafik
committed
JavaCL: disable nasty test
1 parent e8484dd commit 4b4e61d

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

Core/src/test/java/com/nativelibs4java/opencl/JOGLTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import java.nio.ByteOrder;
3535

36+
@org.junit.Ignore
3637
public class JOGLTest {
3738

3839
@BeforeClass
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package com.nativelibs4java.opencl;
6+
7+
import org.bridj.Pointer;
8+
//import org.junit.Test;
9+
10+
/**
11+
12+
13+
javac -d target/classes -cp target/javacl-core-1.0-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/ochafik-util/0.12-SNAPSHOT/ochafik-util-0.12-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/opencl4java/1.0-SNAPSHOT/opencl4java-1.0-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/bridj/0.7-SNAPSHOT/bridj-0.7-SNAPSHOT.jar src/test/java/com/nativelibs4java/opencl/StressTest.java && java -cp target/classes:target/javacl-core-1.0-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/nativelibs4java-utils/1.6-SNAPSHOT/nativelibs4java-utils-1.6-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/ochafik-util/0.12-SNAPSHOT/ochafik-util-0.12-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/opencl4java/1.0-SNAPSHOT/opencl4java-1.0-SNAPSHOT.jar:/Users/ochafik/.m2/repository/com/nativelibs4java/bridj/0.7-SNAPSHOT/bridj-0.7-SNAPSHOT.jar com.nativelibs4java.opencl.StressTest
14+
15+
16+
*/
17+
public class StressTest {
18+
// @Test
19+
public static void main(String[] args) {
20+
CLContext context = JavaCL.createBestContext(CLPlatform.DeviceFeature.GPU);
21+
System.out.println(context);
22+
int n = 128;// * 128;
23+
// Pointer<Integer> p = Pointer.allocateInts(n);
24+
for (int i = 0; i < 100000; i++) {
25+
// if ((i & 0xff) == 0xff)
26+
System.out.print(".");
27+
CLQueue queue = context.createDefaultQueue();
28+
CLBuffer<Integer> buffer = context.createByteBuffer(CLMem.Usage.Output, 4 * n).as(Integer.class);//p);
29+
CLProgram program = context.createProgram("kernel void f(global int* input, int n) {\n" +
30+
"int i = get_global_id(0);\n" +
31+
"if (i >= n) return;\n" +
32+
"input[i] = i;\n" +
33+
"}");
34+
CLKernel kernel = program.createKernel("f");
35+
36+
for (int j = 0; j < 100; j++) {
37+
kernel.setArgs(buffer, n);
38+
kernel.enqueueNDRange(queue, new int[] { n });
39+
}
40+
queue.finish();
41+
queue.release();
42+
kernel.release();
43+
program.release();
44+
buffer.release();
45+
}
46+
context.release();
47+
}
48+
}

0 commit comments

Comments
 (0)
X Tutup