From 7ab329a950c0fcd7c4d2ebc26ee8b5d8ba826a84 Mon Sep 17 00:00:00 2001 From: "Ryan R. LaMothe" <Ryan.LaMothe@pnnl.gov> Date: Sat, 27 Sep 2014 20:23:06 -0700 Subject: [PATCH] Added GPU and JTP targets --- examples/oopnbody/.classpath | 31 +++++----- examples/oopnbody/.gitignore | 1 + examples/oopnbody/build.xml | 109 +++++++++++++++++++++++++++-------- 3 files changed, 99 insertions(+), 42 deletions(-) create mode 100644 examples/oopnbody/.gitignore diff --git a/examples/oopnbody/.classpath b/examples/oopnbody/.classpath index a9d65058..551e1b80 100644 --- a/examples/oopnbody/.classpath +++ b/examples/oopnbody/.classpath @@ -1,18 +1,13 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="/com.amd.aparapi/dist/aparapi.jar" sourcepath="/com.amd.aparapi"> - <attributes> - <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="com.amd.aparapi.jni/dist"/> - </attributes> - </classpathentry> - <classpathentry kind="lib" path="/third-party/jogamp/gluegen-rt.jar"> - <attributes> - <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="third-party/jogamp"/> - </attributes> - </classpathentry> - <classpathentry kind="lib" path="/third-party/jogamp/jogl-all.jar"/> - <classpathentry kind="output" path="classes"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="/com.amd.aparapi/dist/aparapi.jar" sourcepath="/com.amd.aparapi"> + <attributes> + <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="com.amd.aparapi.jni/dist"/> + </attributes> + </classpathentry> + <classpathentry kind="lib" path="/nbody/.libs/gluegen-rt.jar"/> + <classpathentry kind="lib" path="/nbody/.libs/jogl-all.jar"/> + <classpathentry kind="output" path="classes"/> +</classpath> diff --git a/examples/oopnbody/.gitignore b/examples/oopnbody/.gitignore new file mode 100644 index 00000000..840e7d31 --- /dev/null +++ b/examples/oopnbody/.gitignore @@ -0,0 +1 @@ +/classes/ diff --git a/examples/oopnbody/build.xml b/examples/oopnbody/build.xml index 62802dcb..57e29f48 100644 --- a/examples/oopnbody/build.xml +++ b/examples/oopnbody/build.xml @@ -1,29 +1,90 @@ <?xml version="1.0"?> <project name="oopnbody" default="build" basedir="."> - <path id="compiler.class.path"> - <pathelement path="../../com.amd.aparapi/dist/aparapi.jar"/> - <pathelement path="../third-party/jogamp/jogl-all.jar"/> - <pathelement path="../third-party/jogamp/gluegen-rt.jar"/> - </path> - - <path id="runtime.class.path" cache="true"> - <path refid="compiler.class.path"/> - <pathelement path="${ant.project.name}.jar"/> - </path> - - <target name="build" depends="clean"> - <mkdir dir="classes"/> - <javac srcdir="src" destdir="classes" debug="on" includeantruntime="false"> - <classpath refid="compiler.class.path"/> - </javac> - <copy todir="classes/com/amd/aparapi/examples/oopnbody" file="src/com/amd/aparapi/examples/oopnbody/particle.jpg"/> - <jar jarfile="${ant.project.name}.jar" basedir="classes"/> - </target> - - <target name="clean"> - <delete dir="classes"/> - <delete file="${ant.project.name}.jar"/> - </target> + + <echo>This project REQUIRES NBODY to be built first!!!</echo> + + <!-- Ideally this would be the latest version of Java but not everyone is going to have it installed --> + <!-- Additionally we want to avoid "Class not found: javac1.8" errors from old Ant versions (i.e. Eclipse) --> + <property name="build.compiler" value="javac1.7" /> + <property name="ant.build.javac.source" value="1.7" /> + <property name="ant.build.javac.target" value="1.7" /> + + <property name="nbody.path" value="../nbody" /> + <property name="libs.root" value=".libs" /> + + <property name="jogl.all.jar" value="jogl-all.jar" /> + <property name="jogl.all.natives.macosx.jar" value="jogl-all-natives-macosx-universal.jar" /> + <property name="jogl.all.natives.windows.i586.jar" value="jogl-all-natives-windows-i586.jar" /> + <property name="jogl.all.natives.windows.amd64.jar" value="jogl-all-natives-windows-amd64.jar" /> + <property name="jogl.all.natives.linux.i586.jar" value="jogl-all-natives-linux-i586.jar" /> + <property name="jogl.all.natives.linux.amd64.jar" value="jogl-all-natives-linux-amd64.jar" /> + + <property name="gluegen.rt.jar" value="gluegen-rt.jar" /> + <property name="gluegen.rt.natives.macosx.jar" value="gluegen-rt-natives-macosx-universal.jar" /> + <property name="gluegen.rt.natives.windows.i586.jar" value="gluegen-rt-natives-windows-i586.jar" /> + <property name="gluegen.rt.natives.windows.amd64.jar" value="gluegen-rt-natives-windows-amd64.jar" /> + <property name="gluegen.rt.natives.linux.i586.jar" value="gluegen-rt-natives-linux-i586.jar" /> + <property name="gluegen.rt.natives.linux.amd64.jar" value="gluegen-rt-natives-linux-amd64.jar" /> + + <path id="compiler.class.path"> + <pathelement path="../../com.amd.aparapi/dist/aparapi.jar" /> + <pathelement path="${nbody.path}/${libs.root}/${jogl.all.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${jogl.all.natives.macosx.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${jogl.all.natives.windows.i586.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${jogl.all.natives.windows.amd64.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${jogl.all.natives.linux.i586.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${jogl.all.natives.linux.amd64.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${gluegen.rt.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${gluegen.rt.natives.macosx.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${gluegen.rt.natives.windows.i586.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${gluegen.rt.natives.windows.amd64.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${gluegen.rt.natives.linux.i586.jar}" /> + <pathelement path="${nbody.path}/${libs.root}/${gluegen.rt.natives.linux.amd64.jar}" /> + <pathelement path="classes" /> + </path> + + <path id="runtime.class.path" cache="true"> + <path refid="compiler.class.path" /> + <pathelement path="${ant.project.name}.jar" /> + </path> + + <target name="build" depends="clean"> + <mkdir dir="classes" /> + <javac srcdir="src" destdir="classes" debug="on" includeantruntime="false"> + <classpath refid="compiler.class.path" /> + </javac> + <copy todir="classes/com/amd/aparapi/examples/oopnbody" file="src/com/amd/aparapi/examples/oopnbody/particle.jpg" /> + <jar jarfile="${ant.project.name}.jar" basedir="classes" /> + </target> + + <target name="clean"> + <delete dir="classes" /> + <delete file="${ant.project.name}.jar" /> + </target> + + <target name="run-jtp"> + <java classname="com.amd.aparapi.examples.oopnbody.Main" fork="true"> + <classpath refid="runtime.class.path" /> + <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni\dist;jogamp" /> + <sysproperty key="com.amd.aparapi.executionMode" value="JTP" /> + <sysproperty key="bodies" value="16384" /> + <sysproperty key="height" value="800" /> + <sysproperty key="width" value="800" /> + </java> + </target> + + <target name="run-gpu"> + <java classname="com.amd.aparapi.examples.oopnbody.Main" fork="true"> + <classpath refid="runtime.class.path" /> + <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni\dist;jogamp" /> + <sysproperty key="com.amd.aparapi.executionMode" value="GPU" /> + <sysproperty key="bodies" value="16384" /> + <sysproperty key="height" value="800" /> + <sysproperty key="width" value="800" /> + </java> + </target> + + <target name="run" depends="run-gpu" /> </project> -- GitLab