Skip to content

Commit 47187fa

Browse files
committed
JavaCL: moved JNA implementation to OpenCL-JNA directory tree
0 parents  commit 47187fa

File tree

206 files changed

+25952
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+25952
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Thu Jan 28 23:48:24 CET 2010
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4+
org.eclipse.jdt.core.compiler.compliance=1.6
5+
org.eclipse.jdt.core.compiler.source=1.6
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#Sat Jan 30 11:48:04 CET 2010
2+
activeProfiles=
3+
eclipse.preferences.version=1
4+
fullBuildGoals=process-test-resources
5+
includeModules=false
6+
resolveWorkspaceProjects=true
7+
resourceFilterGoals=process-resources resources\:testResources
8+
skipCompilerPlugin=true
9+
version=1

CHANGELOG

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
Current development version (1.0-SNAPSHOT)
2+
3+
...
4+
5+
Version 1.0.0-RC1 (r2130, 20110621)
6+
7+
- BridJ version now becomes the default : the JNA version is still maintained and available with all Maven artifact ids suffixed with "-jna" (BridJ-based JavaCL's main artifact is now "javacl", while the JNA-based version is "javacl-jna")
8+
- added simple Fourier-analysis classes (package com.nativelibs4java.opencl.util.fft), with double and float variants, usable with primitive arrays or OpenCL buffers :
9+
- naive Discrete Fourier Transform (DFT)
10+
- Fast Fourier Transform (FFT) for power-of-two arrays / buffers (performs better than Apache Commons on a CPU)
11+
- added some compiler options to CLProgram :
12+
- setFastRelaxedMath() (triggers all the others !)
13+
- setFiniteMathOnly()
14+
- setUnsafeMathOptimizations()
15+
- setMadEnable()
16+
- setNoSignedZero()
17+
- added CLContext.createBuffer(Usage, Buffer)
18+
- added CLBuffer.copyTo(CLQueue, CLMem destination, CLEvent...) and CLBuffer.emptyClone(Usage)
19+
- added NIOUtils.indirectBuffer(size, bufferClass)
20+
- added CLContext.toString
21+
- deprecated CLXXXBuffer in favor of CLBuffer<XXX> (CLIntBuffer becomes CLBuffer<Integer>, etc...)
22+
- changed CLContext.createBuffer(Usage, length, class) to createBuffer(Usage, class, length) to match the JavaCL/BridJ API (and provoke migration issues : people should now use a primitive class rather than an NIO buffer class !!!
23+
- complete rewrite of CLBuffer genericity to unify with the BridJ port : CLBuffer<DoubleBuffer> is now CLBuffer<Double>, and CLBuffer.read/write/map are no longer strongly typed (it is implicitely typed with Buffer subclasses for compatibility with existing code). The BridJ port will be favoured, and its read/write/map methods use typed Pointer<T>.
24+
- complete rewrite of UJMP Matrix implementation, using principles borrowed from ScalaCL
25+
- fixed issue #66 (create temp files in ~/.javacl subdirectories instead of /tmp)
26+
- fixed OpenGL sharing on MacOS X
27+
- fixed CLProgram.getBinaries() in some cases
28+
- fixed CLBuffer.read on indirect buffers
29+
- fixed NPE that happens with null varargs CLEvent[] array
30+
- fixed length = 1 case in reduction utility
31+
- fixed ATI detection ("ATI Stream" now replaced by "AMD Accelerated Parallel Processing", cf. Csaba's comment in issue #39)
32+
- fixed issue #55 : applied Kazo Csaba's patch to fix the bounds of CLBuffer.map's returned buffer
33+
- fixed inheritance of CLBuildException (now derives from CLException)
34+
35+
Version 1.0-beta-6 (r1637, 20100204)
36+
37+
- Fixed support of ATI Stream 2.3 (CPU)
38+
- New interactive image kernel demo : lets you edit and test image kernels in a snap (bundled with a few samples)
39+
- Experimental BridJ port with same functionality as JNA-powered version, but smaller and faster (JAR weighs 750 kB instead of 1.8 MB, overhead per-function call about 10x smaller)
40+
- Added automatic and transparent program binaries caching :
41+
- Disabled by default on ATI Stream.
42+
- Can force on/off with :
43+
- property -Djavacl.cacheBinaries=true/false
44+
- environment variable JAVACL_CACHE_BINARIES=1/0
45+
- methods CLContext.setCacheBinaries and CLProgram.setCached
46+
- JavaCL.createBestContext now takes an ordered list of CLPlatform.DeviceFeature enums that help prioritize the features considered as "best" (list can be empty or contain any of CPU, GPU, DoubleSupport, MaxComputeUnits, NativeEndianness, ImageSupport, MostImageFormats...). These features are preferences, not requirements : with createBestContext(GPU, MaxComputeUnits) you might end up getting a CPU-based context if there's no GPU available, but you'll have the most powerful GPU (in terms of compute units) if there are two of them.
47+
- Kernels can now include files that are in the classpath (+ added CLProgram.addInclude that accepts directories and base URLs)
48+
- Added LibCL : growing collection of OpenCL functions that can be included from any JavaCL kernel
49+
- CLKernel.enqueueNDRange has a new overload without localWorkSizes argument (it's then adjusted to a good value by the OpenCL implementation).
50+
- ScalaCLv2 was rewritten to fit nicely into Scala's collections framework.
51+
- Added CLContext.createProgram(Map<CLDevice, byte[]>) to create from saved binaries (contribution from Kazo Csaba, issue #30)
52+
- Added CLProgram.addBuildOption(String)
53+
- Fixed CLBuffer.copyTo
54+
- Demos now use the latest jogamp JOGL binaries (see the updated build instructions : http://code.google.com/p/javacl/wiki/Build)
55+
56+
Version 1.0-beta-5 (r1067, 20100717)
57+
58+
- Now using a nice configuration dialog when launching ParticlesDemo : has
59+
optional OpenCL settings with "Fastest", "Normal" and "Safest" presets +
60+
detailed platform and device choice (with optional OpenGL sharing choice).
61+
- Added optional context properties map argument to JavaCL.createContext (can be nulled
62+
out)
63+
- Fixed issue #18: CLImage.write calls enqueueImageRead !
64+
- Documented workaround for Linux crashes (issue #20) : http://code.google.com/p/javacl/wiki/TroubleShootingJavaCLOnLinux
65+
- Fixed issue #21: NIOUtils.put() doesn't accept ByteBuffer
66+
- Fixed issue #25: CLEvent.waitFor bug causes segfault
67+
- OpenCL 1.1 support :
68+
- CLContext.createUserEvent()
69+
- CLUserEvent.setStatus(int), setCompleted()
70+
- CLEvent.setCallback(status, callbac), setCompletionCallback(callback)
71+
- CLBuffer.createSubBuffer(usage, offset, length)
72+
- CLContext.getDeviceCount()
73+
- CLDevice.getOpenCLVersion()
74+
- CLDevice.isHostUnifiedMemory()
75+
- CLDevice.getNativeVectorWidthXXX() methods
76+
- CLMem.setDestructorCallback(callback)
77+
- CLKernel.getPreferredWorkGroupSizeMultiple()
78+
- CLKernel.enqueueNDRange overload with potentially non-null globalOffsets
79+
- CLImageFormat.ChannelOrder.Rx, RGx, RGBx
80+
- Faster enums
81+
- Check for cl_amd_fp64 in CLDevice.isDoubleSupported()
82+
- Fixed CLProgram.getBinaries()
83+
- Fixed issue #22 (maven pom issue)
84+
85+
Version 1.0-beta-4 (r760, 20100121)
86+
87+
- Changed semantics of offset & length arguments in typed CLxxxBuffer.read / write / map methods : now expressed in elements, not in bytes (e.g. 4 bytes per element for CLIntBuffer)
88+
- Added OpenGL interoperability methods to CLContext and CLQueue (can create a CLByteBuffer from an OpenGL buffer object, a CLImage2D/3D from an OpenGL 2D/3D texture or a renderbuffer).
89+
- Added OpenGL-compatible context creation methods to JavaCL & CLPlatform classes
90+
- Added basic reduction support in ReductionUtils (cumulative additions, multiplications, min, max...)
91+
- Created javacl-demos package, with Particles, Hardware Report and Mandelbrot demos...
92+
- Finished migration from NativeLong to NativeSize (changes only the low-level bindings)
93+
- Added profiling methods to CLEvent (+ facility CLDevice.createProfilingQueue())
94+
- Better JavaDoc for low-level bindings (links to Khronos online manual pages)
95+
- Added deferred program allocation : CLProgram.addSource(String), CLProgram.allocate() (called automatically)...
96+
- Added very simple OpenCL backend for UJMP (Universal Java Matrix Package), which does matrix multiplications in OpenCL.
97+
- Created a kernel wrapper autogenerator (Maven plugin based on JNAerator) : translates all constants on the Java side and presents kernels as methods with the correct Java argument types. It assumes OpenCL kernels (*.c, *.cl) are in src/main/opencl
98+
- Added wrappers around clGetKernelWorkGroupInfo
99+
- Fixed respect of endianness of devices that have different endianness than platform
100+
- Fixed issue #10: "getMaxWorkItemSizes() fails on win7 64 GTX260"
101+
102+
Version 1.0-beta-3 (r , 20091030)
103+
104+
- Fixed Issue #8 : NativeLong's can not represent size_t on windows x64 system (all user code that uses the low-level bindings needs to be updated : NativeLong -&gt; NativeSize)
105+
- Added CLContext/CLDevice.isDoubleSupported, isHalfSupported, isByteAddressableStoreSupported
106+
- Added If function to ScalaCL (operates on statements or on expressions)
107+
- Added CLAbstractEntity.release()
108+
- Fixed Issue #4 : CLContext.createContext(CLDevice... devices) created context on only one device
109+
- Regenerated the low level bindings with latest JNAerator : now using NativeSize class instead of NativeLong for size_t (fixes Issue #8)
110+
- Fixed Issue #5 : fixed formatting of CLPlatform.toString()
111+
- Fixed Issue #6 : use max X workgroup dimension for better benchmark speed
112+
- Fixed Issue #7 : CLMem class bug in Usage.WriteOnly and Usage.ReadWrite
113+
- Fixed Issue #11 : call clRetainMemObject when sharing a cl_mem between CLBuffer instances.
114+
- Choose 'best' device in benchmark test
115+
116+
Version 1.0-beta-2
117+
118+
- JAR is now self-sufficient (includes JNA + JNAerator's runtime classes)
119+
- Added CLKernel.setLocalArg(argIndex, localArgByteLength)
120+
- Allow localWorkSizes to be null in enqueueNDRange
121+
- Added support for barriers and markers in CLQueue
122+
- Fixed issue #2 : enqueueNDRange does not work for nDim > 1
123+
- Added CLDevice.getMaxWorkItemSizes()
124+
- CLDevice.toString() now only prints the name
125+
- Moved method createContext from CLContext to CLPlatform
126+
- Added all the CL_DEVICE_PREFERRED_VECTOR_WIDTH_XXX infos to CLDevice as getPreferredVectorWithXXX()
127+
- Changed return type of getExtensions() method of both CLPlatform and CLDevice from String to String[]
128+
- Added com.nativelibs4java.opencl.HardwareReport (with main method) : outputs html report with devices stats
129+
- Rationalized naming of all enums : CL_ENTITY_ATTRIBUTE_SOME_VALUE = CLEntity.Attribute.SomeValue (enum item SomeValue in enum Attribute in class CLEntity)
130+
- Added full support of images :
131+
- CLContext.getSupportedImageFormats + CLImageFormat and associated enums
132+
- CLImage2D, CLImage3D and corresponding creation methods in CLContext + all image info getters
133+
- CLMem is now an abstract base class
134+
- CLBuffer with typed subclasses (CLByteBuffer, CLIntBuffer..)
135+
- To create a CLBuffer : context.createIntBuffer(Input, size)
136+
- Added CLBuffer.copyTo (clEnqueueCopyBuffer)
137+
- Each typed CLBuffer subclass has map, mapLater, read methods that return typed NIO buffers
138+
- Added full typing of OpenCL Exceptions (now possible to selectively catch a CLException.OutOfHostMemory, for instance)
139+
- Added hashCode and equals method to most classes
140+
- Added ability to create out of order queues and change queue properties after creation
141+
142+
Version 1.0-beta-1
143+
144+
- New CLPlatform class (~ OpenCL implementation) which now hosts the list*Devices(...) methods
145+
- Entry point of library is now OpenCL4Java.listPlatforms()
146+
- New CLEvent class, returned by all enqueue* methods (with methods waitFor, invokeUponCompletion...)
147+
- Better separation between blocking and non blocking calls
148+
- New CLSampler class supported as argument of CLKernel
149+
- Many info getters with typesafe enums / enum sets in classes CLDevice, CLPlatform, CLKernel...
150+
- Much more complete JavaDoc : http://nativelibs4java.sourceforge.net/sites/OpenCL4Java/apidocs/
151+
- Example & benchmark classes became JUnit tests and moved here : http://code.google.com/p/nativelibs4java/source/browse/#svn/trunk/lib...
152+
153+
While this release is rather OpenCL4Java-focused, ScalaCL also got its bunch of enhancements :
154+
- Added scalar variables IntVar, FloatVar, ShortVar...
155+
- 'local' keyword can be added to variables so they're local to the programs : val x = FloatVar local
156+
- Added many OpenCL math functions
157+
- Added methods ArrayVar.write(Range), ArrayVar.write(Seq)
158+
- Various bugfixes
159+

Common/.classpath

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
4+
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
5+
<classpathentry kind="con" path="org.eclipse.iam.jdt.core.mavenClasspathContainer"/>
6+
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
7+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
8+
<classpathentry kind="output" path="target/classes"/>
9+
</classpath>

Common/.project

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Common</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.maven.ide.eclipse.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.iam.jdt.core.mavenIncrementalBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.maven.ide.eclipse.maven2Nature</nature>
26+
<nature>org.eclipse.iam.jdt.core.mavenNature</nature>
27+
<nature>org.eclipse.jdt.core.javanature</nature>
28+
</natures>
29+
</projectDescription>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Thu Jan 28 23:48:17 CET 2010
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4+
org.eclipse.jdt.core.compiler.compliance=1.6
5+
org.eclipse.jdt.core.compiler.source=1.6
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#Thu Jan 28 23:46:13 CET 2010
2+
activeProfiles=
3+
eclipse.preferences.version=1
4+
fullBuildGoals=process-test-resources
5+
includeModules=false
6+
resolveWorkspaceProjects=true
7+
resourceFilterGoals=process-resources resources\:testResources
8+
skipCompilerPlugin=true
9+
version=1

Common/pom.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.nativelibs4java</groupId>
6+
<artifactId>nativelibs4java-utils</artifactId>
7+
<name>NativeLibs4Java Common Utilities</name>
8+
<url>http://code.google.com/p/nativelibs4java/</url>
9+
<version>1.3</version>
10+
<packaging>jar</packaging>
11+
12+
<parent>
13+
<groupId>com.nativelibs4java</groupId>
14+
<artifactId>opencl4java-parent-jna</artifactId>
15+
<version>1.0.0-RC1</version>
16+
<relativePath>../Parent</relativePath>
17+
</parent>
18+
19+
<dependencies>
20+
21+
<dependency>
22+
<groupId>com.ochafik</groupId>
23+
<artifactId>ochafik-util</artifactId>
24+
<version>${jnaerator.version}</version>
25+
<scope>compile</scope>
26+
</dependency>
27+
</dependencies>
28+
29+
</project>
30+
31+
32+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
6+
package com.nativelibs4java.util;
7+
8+
import java.util.HashMap;
9+
import java.util.Map;
10+
11+
/**
12+
*
13+
* @author ochafik
14+
*/
15+
public abstract class Cache<K, V> {
16+
Map<K, V> map;
17+
public Cache() {
18+
this(new HashMap<K, V>());
19+
}
20+
public Cache(Map<K, V> map) {
21+
this.map = map;
22+
}
23+
public synchronized V get(K key) {
24+
V value = map.get(key);
25+
if (value == null)
26+
map.put(key, value = createValue(key));
27+
return value;
28+
}
29+
public abstract V createValue(K key);
30+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
6+
package com.nativelibs4java.util;
7+
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
import java.lang.annotation.Target;
12+
13+
/**
14+
* Annotation that defines the integer value for a Java enum item
15+
* @author ochafik
16+
*/
17+
@Target({ElementType.TYPE, ElementType.FIELD})
18+
@Retention(RetentionPolicy.RUNTIME)
19+
public @interface EnumValue {
20+
/**
21+
* Integral representation of the enum item
22+
*/
23+
long value();
24+
}

0 commit comments

Comments
 (0)