diff options
author | Michael Bien <[email protected]> | 2010-11-18 02:50:04 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-11-18 02:50:04 +0100 |
commit | 0e7aa3b2d14153e024cd3462ca7179d579a3c99a (patch) | |
tree | 055c74eeb94d89a2483394366f2bdf1e3f546bc1 | |
parent | 5fa0a7027a4edcad76f182b344ababfb29a58a8e (diff) |
added JOCLVersion utility and integrated in CLPlatform.
added spec version to manifest, updated CLInfo.
-rw-r--r-- | build.xml | 3 | ||||
-rw-r--r-- | manifest_template.mf | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLPlatform.java | 5 | ||||
-rw-r--r-- | src/com/jogamp/opencl/util/CLInfo.java | 40 | ||||
-rw-r--r-- | src/com/jogamp/opencl/util/JOCLVersion.java | 65 |
5 files changed, 99 insertions, 20 deletions
@@ -89,7 +89,7 @@ <target name="-pre-jar"> - <property name="jocl.build.number" value="CUSTOM" /> + <property name="jocl.build.number" value="manual" /> <property name="jocl.scm.branch" value="unknown" /> <property name="jocl.scm.commit" value="unknown" /> @@ -101,6 +101,7 @@ <copy file="${basedir}/manifest_template.mf" tofile="${rootrel.build}/manifest.mf"> <filterset> + <filter token="SPEC_VERSION" value="${jocl_base_version}"/> <filter token="VERSION" value="${jocl.version}"/> <filter token="SCM_BRANCH" value="${jocl.scm.branch}"/> <filter token="SCM_COMMIT" value="${jocl.scm.commit}"/> diff --git a/manifest_template.mf b/manifest_template.mf index cb48d7d3..07166a67 100644 --- a/manifest_template.mf +++ b/manifest_template.mf @@ -1,11 +1,13 @@ Manifest-Version: 1.0 Implementation-Title: Java Bindings for OpenCL +Specification-Title: Java Bindings for OpenCL Implementation-URL: http://jocl.jogamp.org/ Implementation-Version: @VERSION@ +Specification-Version: @SPEC_VERSION@ Implementation-Branch: @SCM_BRANCH@ Implementation-Commit: @SCM_COMMIT@ -Implementation-Vendor: JogAmp community +Implementation-Vendor: JogAmp Community Implementation-Vendor-Id: com.jogamp -Specification-Vendor: JogAmp community +Specification-Vendor: JogAmp Community Extension-Name: com.jogamp.opencl Trusted-Library: true diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index 2fd7d3f1..cbde8b6e 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -11,6 +11,7 @@ import com.jogamp.opencl.util.CLUtil; import com.jogamp.opencl.impl.CLImpl; import com.jogamp.opencl.impl.CLProcAddressTable; import com.jogamp.opencl.util.Filter; +import com.jogamp.opencl.util.JOCLVersion; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -108,7 +109,11 @@ public final class CLPlatform { // System.out.println("\n"+table); // System.out.println("unavailable functions: "+table.getNullPointerFunctions()); + }catch(UnsatisfiedLinkError ex) { + System.err.println(JOCLVersion.getAllVersions()); + throw ex; }catch(Exception ex) { + System.err.println(JOCLVersion.getAllVersions()); throw new JogampRuntimeException("JOCL initialization error.", ex); } diff --git a/src/com/jogamp/opencl/util/CLInfo.java b/src/com/jogamp/opencl/util/CLInfo.java index 76b9be2b..343a570f 100644 --- a/src/com/jogamp/opencl/util/CLInfo.java +++ b/src/com/jogamp/opencl/util/CLInfo.java @@ -16,44 +16,50 @@ import java.util.Map; */ public class CLInfo { - public static void main(String[] args) throws Exception { + public static StringBuilder print(StringBuilder sb) { // host - System.out.println("HOST_JRE: " + System.getProperty("java.runtime.version")); - System.out.println("HOST_JVM: " + System.getProperty("java.vm.name")); - System.out.println("HOST_ARCH: " + Platform.getArch()); - System.out.println("HOST_NUM_CORES: " + Runtime.getRuntime().availableProcessors()); - System.out.println("HOST_OS: " + Platform.getOS()); - System.out.println("HOST_LITTLE_ENDIAN: " + Platform.isLittleEndian()); - + sb.append("HOST_JRE: ").append(System.getProperty("java.runtime.version")).append("\n"); + sb.append("HOST_JVM: ").append(System.getProperty("java.vm.name")).append("\n"); + sb.append("HOST_ARCH: ").append(Platform.getArch()).append("\n"); + sb.append("HOST_NUM_CORES: ").append(Runtime.getRuntime().availableProcessors()).append("\n"); + sb.append("HOST_OS: ").append(Platform.getOS()).append("\n"); + sb.append("HOST_LITTLE_ENDIAN: ").append(Platform.isLittleEndian()).append("\n"); + CLPlatform.initialize(); // binding - System.out.println(); - System.out.println("CL_BINDING_UNAVAILABLE_FUNCTIONS: " + - ((CLImpl)CLPlatform.getLowLevelCLInterface()).getAddressTable().getNullPointerFunctions()); + sb.append("CL_BINDING_UNAVAILABLE_FUNCTIONS: "); + sb.append(((CLImpl) CLPlatform.getLowLevelCLInterface()).getAddressTable().getNullPointerFunctions()); + sb.append("\n"); // OpenCL CLPlatform[] platforms = CLPlatform.listCLPlatforms(); for (CLPlatform platform : platforms) { Map<String, String> platformProperties = platform.getProperties(); - System.out.println(); - printInfo("", platformProperties); + sb.append("\n"); + printInfo(sb, "", platformProperties); CLDevice[] devices = platform.listCLDevices(); for (CLDevice device : devices) { Map<String, String> deviceProperties = device.getProperties(); - System.out.println(); - printInfo(" - ", deviceProperties); + sb.append("\n"); + printInfo(sb, " - ", deviceProperties); } } + return sb; } - private static void printInfo(String prefix, Map<String, String> properties) { + + private static void printInfo(StringBuilder sb, String prefix, Map<String, String> properties) { for (Map.Entry<String, String> entry : properties.entrySet()) { - System.out.println(prefix + entry.getKey() + ": " + entry.getValue()); + sb.append(prefix).append(entry.getKey()).append(": ").append(entry.getValue()).append(Platform.getNewline()); } } + + public static void main(String[] args) throws Exception { + System.out.println(print(new StringBuilder()).toString()); + } } diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java new file mode 100644 index 00000000..f4faacef --- /dev/null +++ b/src/com/jogamp/opencl/util/JOCLVersion.java @@ -0,0 +1,65 @@ +/* + * Created on Monday, November 15 2010 19:44 + */ +package com.jogamp.opencl.util; + +import com.jogamp.common.GlueGenVersion; +import com.jogamp.common.os.Platform; +import com.jogamp.common.util.JogampVersion; +import com.jogamp.common.util.VersionUtil; +import java.util.jar.Manifest; + + +/** + * + * @author Michael Bien + */ +public class JOCLVersion extends JogampVersion { + + private static final String PACKAGE = "com.jogamp.opencl"; + + private JOCLVersion(Manifest mf) { + super(PACKAGE, mf); + } + + private static JOCLVersion createInstance(){ + Manifest manifest = VersionUtil.getManifest(JOCLVersion.class.getClassLoader(), PACKAGE); + return new JOCLVersion(manifest); + } + + public static String getVersion() { + return createInstance().toString(); + } + + public static String getAllVersions() { + + StringBuilder sb = new StringBuilder(); + + sb.append(SEPERATOR).append(Platform.getNewline()); + sb.append(VersionUtil.getPlatformInfo(null)); + sb.append(SEPERATOR).append(Platform.getNewline()); + + createInstance().toString(sb); + + sb.append(GlueGenVersion.getInstance().toString()); + + return sb.toString(); + } + + + public StringBuilder toString(StringBuilder sb) { + return sb.append(toString((StringBuffer)null)); + } + + @Override + public StringBuffer toString(StringBuffer sb) { + if(sb == null) { + sb = new StringBuffer(); + } + return super.toString(sb); + } + + public static void main(String[] args) { + System.out.println(JOCLVersion.getAllVersions()); + } +} |