diff --git a/com.amd.aparapi.jni/Aparapi.suo b/com.amd.aparapi.jni/Aparapi.suo index 117d265b9625f6dc443e9f6dde562abcf51f7ded..79b046879bc8389cd16d5fd8594758cf385c92b2 100644 Binary files a/com.amd.aparapi.jni/Aparapi.suo and b/com.amd.aparapi.jni/Aparapi.suo differ diff --git a/com.amd.aparapi.jni/Aparapi.vcxproj b/com.amd.aparapi.jni/Aparapi.vcxproj index 279e7ab82c54c71d6eaf359542c6206b11d3e5b3..3023d478695b9367099c6c4d1e7208ec9ea26a47 100644 --- a/com.amd.aparapi.jni/Aparapi.vcxproj +++ b/com.amd.aparapi.jni/Aparapi.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> + <PlatformToolset>v110</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> + <PlatformToolset>v110</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -78,10 +78,10 @@ </Link> </ItemDefinitionGroup> <ItemGroup> + <ClCompile Include="src\cpp\aparapi.cpp" /> <ClCompile Include="src\cpp\clHelper.cpp" /> <ClCompile Include="src\cpp\jniHelper.cpp" /> - <ClCompile Include="src\cpp\runKernel\Aparapi.cpp" /> - <ClCompile Include="src\cpp\runKernel\JNIContext.cpp" /> + <ClCompile Include="src\cpp\opencljni.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="include\com_amd_aparapi_KernelRunner.h" /> diff --git a/com.amd.aparapi.jni/Aparapi.vcxproj.filters b/com.amd.aparapi.jni/Aparapi.vcxproj.filters index 686086d6bcdcd1ffb4744424ed43c8d02c1fb33b..2de182d55c8852a216633202ef8bc6a0e7bfcde5 100644 --- a/com.amd.aparapi.jni/Aparapi.vcxproj.filters +++ b/com.amd.aparapi.jni/Aparapi.vcxproj.filters @@ -15,16 +15,16 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="src\cpp\jniHelper.cpp"> + <ClCompile Include="src\cpp\aparapi.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\cpp\clHelper.cpp"> + <ClCompile Include="src\cpp\jniHelper.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\cpp\runKernel\Aparapi.cpp"> + <ClCompile Include="src\cpp\clHelper.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\cpp\runKernel\JNIContext.cpp"> + <ClCompile Include="src\cpp\opencljni.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/com.amd.aparapi.jni/build.xml b/com.amd.aparapi.jni/build.xml index de7ee8003bb2bd300667e7fa94aef0e14f5567ef..035bc928bbeb0a01880f7613fa7cc47b23c6534c 100644 --- a/com.amd.aparapi.jni/build.xml +++ b/com.amd.aparapi.jni/build.xml @@ -14,21 +14,26 @@ First consider editing the properties in build.properties <echo>OS Arch: ${os.arch}</echo> <echo>Java Ver: ${java.version}</echo> - <!--<property name="build.compiler" value="javac1.6"/>--> - <!-- <property name="ant.build.javac.source" value="1.6"/>--> - <!-- <property name="ant.build.javac.target" value="1.6"/> --> - + <!-- 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="amd.app.sdk.version" value="2.9-1"/> + <property environment="env" /> - <property name="msvc.dir" value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin" /> - <!-- we need env.PATH for msvc only --> - - <!-- uncomment this if you want to use mingw! --> - <!--<property name="mingw.dir" value="c:\\MinGW"/>--> + + <!-- Check for AMD APP SDK --> + <echo> + Note: Since AMD APP SDK 2.9 you can have multiple versions installed/co-exist on same machine, + so AMD introduced a completely new naming convention for their installation directories + For example C:/Program Files/AMD APP SDK/2.9-1 + </echo> <target name="init"> - <available property="win32.amd.app.sdk.exists" file="C:\Program Files (x86)\AMD APP SDK\2.9-1" type="dir"/> - - <condition property="amd.app.sdk.dir" value="C:\Program Files (x86)\AMD APP SDK\2.9-1"> + <available property="win32.amd.app.sdk.exists" file="C:/Program Files/AMD APP SDK/${amd.app.sdk.version}" type="dir"/> + <condition property="amd.app.sdk.dir" value="C:/Program Files/AMD APP SDK/${amd.app.sdk.version}"> <and> <os family="windows" /> <isset property="win32.amd.app.sdk.exists" /> @@ -38,8 +43,8 @@ First consider editing the properties in build.properties </and> </condition> - <available property="win64.amd.app.sdk.exists" file="C:\Program Files (x86)\AMD APP SDK\2.9-1" type="dir"/> - <condition property="amd.app.sdk.dir" value="C:\Program Files (x86)\AMD APP SDK\2.9-1"> + <available property="win64.amd.app.sdk.exists" file="C:/Program Files (x86)/AMD APP SDK/${amd.app.sdk.version}" type="dir"/> + <condition property="amd.app.sdk.dir" value="C:/Program Files (x86)/AMD APP SDK/${amd.app.sdk.version}"> <and> <os family="windows" /> <isset property="win64.amd.app.sdk.exists" /> @@ -49,8 +54,8 @@ First consider editing the properties in build.properties </and> </condition> - <available property="linux.amd.app.sdk.exists" file="/opt/AMDAPP" type="dir"/> - <condition property="amd.app.sdk.dir" value="/opt/AMDAPP"> + <available property="linux.amd.app.sdk.exists" file="/opt/AMDAPPSDK-${amd.app.sdk.version}" type="dir"/> + <condition property="amd.app.sdk.dir" value="/opt/AMDAPPSDK-${amd.app.sdk.version}"> <and> <os family="unix" /> <not> @@ -66,227 +71,191 @@ First consider editing the properties in build.properties </and> </condition> - <echo message=" amd.app.sdk.dir ${amd.app.sdk.dir}"/> + <echo message="amd.app.sdk.dir ${amd.app.sdk.dir}"/> - <!-- Check for Visual Studio --> - <!-- This needs to be in descending order to properly handle multiple installations --> - - <available property="msvc.32.11.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 11.0\VC\bin" type="dir"/> - <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 11.0"> + <available property="linux.intel.app.sdk.exists" file="/opt/intel/opencl" type="dir"/> + <condition property="intel.app.sdk.dir" value="/opt/intel/opencl"> <and> + <os family="unix" /> <not> - <or> - <os arch="x86" /> - <os arch="i386" /> - </or> + <os family="mac" /> </not> - <os family="windows" /> - <isset property="msvc.32.11.0.exists" /> + <isset property="linux.intel.app.sdk.exists" /> <not> - <isset property="msvc.dir" /> + <isset property="win32.amd.app.sdk.exists" /> </not> <not> - <isset property="mingw.dir" /> + <isset property="win64.amd.app.sdk.exists" /> </not> </and> </condition> - - <available property="msvc.64.10.0.exists" file="c:/Program Files/Microsoft Visual Studio 10.0\vc\bin" type="dir"/> - <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 10.0"> + + <echo message=" intel.app.sdk.dir ${intel.app.sdk.dir}"/> + + <condition property="vendor.name" value="amd"> + <isset property="amd.app.sdk.dir" /> + </condition> + + <condition property="vendor.name" value="intel"> <and> - <or> - <os arch="x86" /> - <os arch="i386" /> - </or> - <os family="windows" /> - <isset property="msvc.64.10.0.exists" /> - <not> - <isset property="msvc.dir" /> - </not> + <isset property="intel.app.sdk.dir" /> <not> - <isset property="mingw.dir" /> + <isset property="amd.app.sdk.dir" /> </not> </and> </condition> - - <available property="msvc.32.10.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 10.0\vc\bin" type="dir"/> - <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 10.0"> + + <echo message=" vendor.name ${vendor.name}"/> + + <condition property="app.sdk.dir" value="${amd.app.sdk.dir}"> + <isset property="amd.app.sdk.dir" /> + </condition> + + <condition property="app.sdk.dir" value="${intel.app.sdk.dir}"> <and> + <isset property="intel.app.sdk.dir" /> <not> - <or> - <os arch="x86" /> - <os arch="i386" /> - </or> + <isset property="app.sdk.dir" /> </not> + </and> + </condition> + + <echo message="app.sdk.dir ${app.sdk.dir}"/> + + <!-- Check for Visual Studio Compiler --> + <!-- This needs to be in descending order to properly handle multiple installations --> + <available property="msvc.32.12.0.exists" file="C:/Program Files/Microsoft Visual Studio 12.0\VC\bin" type="dir"/> + <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 12.0"> + <and> <os family="windows" /> - <isset property="msvc.32.10.0.exists" /> + <isset property="msvc.32.12.0.exists" /> <not> <isset property="msvc.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - <available property="msvc.32.9.0.exists" file="c:/Program Files/Microsoft Visual Studio 9.0\vc\bin" type="dir"/> - <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 9.0"> + <available property="msvc.64.12.0.exists" file="C:/Program Files (x86)/Microsoft Visual Studio 12.0\VC\bin" type="dir"/> + <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 12.0"> <and> - <or> - <os arch="x86" /> - <os arch="i386" /> - </or> <os family="windows" /> - <isset property="msvc.32.9.0.exists" /> + <isset property="msvc.64.12.0.exists" /> <not> <isset property="msvc.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - - <!-- Check for SDKs --> - <!-- This needs to be in descending order to properly handle multiple installations --> - - <!-- <available property="msvc.sdk.8.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A"> + + <available property="msvc.32.11.0.exists" file="C:/Program Files/Microsoft Visual Studio 11.0\VC\bin" type="dir"/> + <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 11.0"> <and> <os family="windows" /> - <isset property="msvc.sdk.8.0A.32.exists" /> - <not> - <isset property="msvc.sdk.dir" /> - </not> + <isset property="msvc.32.11.0.exists" /> <not> - <isset property="mingw.dir" /> + <isset property="msvc.dir" /> </not> </and> </condition> - <available property="msvc.sdk.8.0.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0"> + <available property="msvc.64.11.0.exists" file="C:/Program Files (x86)/Microsoft Visual Studio 11.0\VC\bin" type="dir"/> + <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 11.0"> <and> <os family="windows" /> - <isset property="msvc.sdk.8.0.32.exists" /> - <not> - <isset property="msvc.sdk.dir" /> - </not> + <isset property="msvc.64.11.0.exists" /> <not> - <isset property="mingw.dir" /> + <isset property="msvc.dir" /> </not> </and> - </condition> --> + </condition> - <available property="msvc.sdk.7.1A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1A" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1A"> + <available property="msvc.32.10.0.exists" file="c:/Program Files/Microsoft Visual Studio 10.0\vc\bin" type="dir"/> + <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 10.0"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.1A.exists" /> - <not> - <isset property="msvc.sdk.dir" /> - </not> + <isset property="msvc.32.10.0.exists" /> <not> - <isset property="mingw.dir" /> + <isset property="msvc.dir" /> </not> </and> </condition> - <available property="msvc.sdk.7.1A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A"> + <available property="msvc.64.10.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 10.0\vc\bin" type="dir"/> + <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 10.0"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.1A.32.exists" /> - <not> - <isset property="msvc.sdk.dir" /> - </not> + <isset property="msvc.64.10.0.exists" /> <not> - <isset property="mingw.dir" /> + <isset property="msvc.dir" /> </not> </and> </condition> - - <available property="msvc.sdk.7.1.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1"> + + <!-- Check for SDKs --> + <!-- This needs to be in descending order to properly handle multiple installations --> + + <available property="msvc.sdk.7.1A.32.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1A" type="dir"/> + <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1A"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.1.exists" /> + <isset property="msvc.sdk.7.1A.32.exists" /> <not> <isset property="msvc.sdk.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - - <available property="msvc.sdk.7.1.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1"> + + <available property="msvc.sdk.7.1A.64.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A" type="dir"/> + <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.1.32.exists" /> + <isset property="msvc.sdk.7.1A.64.exists" /> <not> <isset property="msvc.sdk.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - - <available property="msvc.sdk.7.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0A" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0A"> + + <available property="msvc.sdk.7.1.32.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1" type="dir"/> + <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.0A.exists" /> + <isset property="msvc.sdk.7.1.32.exists" /> <not> <isset property="msvc.sdk.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - <available property="msvc.sdk.7.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A"> + <available property="msvc.sdk.7.1.64.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1" type="dir"/> + <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.0A.32.exists" /> + <isset property="msvc.sdk.7.1.64.exists" /> <not> <isset property="msvc.sdk.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - - <available property="msvc.sdk.7.0.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0"> + + <available property="msvc.sdk.7.0A.32.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0A" type="dir"/> + <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0A"> <and> <os family="windows" /> - <isset property="msvc.sdk.7.0.exists" /> + <isset property="msvc.sdk.7.0A.32.exists" /> <not> <isset property="msvc.sdk.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> - <available property="msvc.sdk.6.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v6.0A" type="dir"/> - <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v6.0A"> + <available property="msvc.sdk.7.0A.64.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A" type="dir"/> + <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A"> <and> <os family="windows" /> - <isset property="msvc.sdk.6.0A.exists" /> + <isset property="msvc.sdk.7.0A.64.exists" /> <not> <isset property="msvc.sdk.dir" /> </not> - <not> - <isset property="mingw.dir" /> - </not> </and> </condition> @@ -295,7 +264,6 @@ First consider editing the properties in build.properties </target> <target name="check" depends="init"> - <fail message="Error:"> <condition> <and> @@ -307,9 +275,9 @@ First consider editing the properties in build.properties </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code - At present msvc.dir seems to be Configured but not msvc.sdk.dir + At present msvc.dir seems to be configured but not msvc.sdk.dir ]]> </fail> @@ -324,11 +292,12 @@ First consider editing the properties in build.properties </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code - At present msvc.sdk.dir seems to be Configured but not msvc.dir + At present msvc.sdk.dir seems to be configured but not msvc.dir ]]> </fail> + <available file="${msvc.dir}" type="dir" property="msvc.dir.exists" /> <available file="${msvc.sdk.dir}" type="dir" property="msvc.sdk.dir.exists" /> @@ -343,11 +312,12 @@ First consider editing the properties in build.properties </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code At present msvc.dir is set (to ${msvc.dir}) but that dir does not exist ]]> </fail> + <fail message="Error:"> <condition> <and> @@ -359,34 +329,12 @@ First consider editing the properties in build.properties </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code At present msvc.sdk.dir is set (to ${msvc.sdk.dir}) but that dir does not exist ]]> </fail> - - - <available file="${mingw.dir}" type="dir" property="mingw.dir.exists" /> - <fail message="Error:"> - <condition> - <and> - <os family="windows" /> - <isset property="mingw.dir" /> - <not> - <isset property="mingw.dir.exists" /> - </not> - </and> - </condition> - <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code - - At present mingw.dir is set (to ${mingw.dir}) but that dir does not exist - ]]> - </fail> - <echo message="java.home ${java.home}"/> - <!--<echo message="msvc.dir.exists ${msvc.dir.exists}"/>--> - <!--<echo message="msvc.sdk.dir.exists ${msvc.sdk.dir.exists}"/>--> - <!--<echo message="mingw.dir.exists ${mingw.dir.exists}"/>--> + <condition property="use.msvc"> <and> <os family="windows" /> @@ -394,54 +342,6 @@ First consider editing the properties in build.properties <isset property="msvc.sdk.dir.exists" /> </and> </condition> - <!--<echo message="use.msvc ${use.msvc}"/>--> - - <condition property="use.mingw"> - <and> - <os family="windows" /> - <isset property="mingw.dir.exists" /> - </and> - </condition> - <!--<echo message="use.mingw ${use.mingw}"/>--> - - <fail message="Error:"> - <condition> - <and> - <isset property="use.mingw" /> - <isset property="use.msvc" /> - </and> - </condition> - <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code - - At present ant is Configured for both MinGW AND Microsoft Visual Studio. You need to pick one or the other :) ! - - Just comment out the properties for the compiler that you *do not* wish to use. - ]]> - </fail> - - <fail message="Error:"> - <condition> - <and> - <os family="windows" /> - <not> - <or> - <isset property="use.mingw" /> - <isset property="use.msvc" /> - </or> - </not> - </and> - </condition> - <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code - - This looks like a windows machine so you probably need to Configure either:- - - * msvc.dir and msvc.sdk.dir if you wish to use Microsoft Visual Studio compiler - - * mingw.dir if you prefer if you prefer to use MinGW - ]]> - </fail> <condition property="use.gcc"> <and> @@ -464,24 +364,25 @@ First consider editing the properties in build.properties </condition> <condition property="optional.amd64.subdir" value="" else="amd64\"> - <or> - <os arch="x86" /> - <os arch="i386" /> - </or> + <equals arg1="${x86_or_x86_64}" arg2="x86"/> </condition> <condition property="optional.x64.subdir" value="" else="x64\"> - <or> - <os arch="x86" /> - <os arch="i386" /> - </or> + <equals arg1="${x86_or_x86_64}" arg2="x86"/> </condition> - <available file="${msvc.dir}\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" /> + <condition property="optional.app.sdk.lib.subdir" value="lib\" else="lib64\"> + <equals arg1="${x86_or_x86_64}" arg2="x86"/> + + </condition> + + <condition property="gcc.m.value" value="32" else="64"> + <equals arg1="${x86_or_x86_64}" arg2="x86"/> + </condition> + + <available file="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" /> - <echo message="${msvc.dir}\${optional.amd64.subdir}cl.exe"/> - <fail message="Error:"> <condition> <and> @@ -492,12 +393,10 @@ First consider editing the properties in build.properties </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code - - - Could not find vc\bin\${optional.amd64.subdir}cl under Configured msvc.dir. Check if msvc.dir is pointing - to a valid visual studio installation + Could not find vc\bin\${optional.amd64.subdir}cl under configured msvc.dir. Check if msvc.dir is pointing + to a valid Visual Studio installation ]]> </fail> @@ -508,17 +407,18 @@ First consider editing the properties in build.properties <os family="mac" /> </not> <not> - <isset property="amd.app.sdk.dir" /> + <isset property="app.sdk.dir" /> </not> </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code - You need to set amd.app.sdk.dir to point to the location where AMD APP SDK is installed + You need to set app.sdk.dir to point to the location where OpenCL SDK is installed ]]> </fail> - <available file="${amd.app.sdk.dir}" type="dir" property="amd.app.sdk.dir.exists" /> + + <available file="${app.sdk.dir}" type="dir" property="app.sdk.dir.exists" /> <fail message="Error:"> <condition> @@ -527,14 +427,14 @@ First consider editing the properties in build.properties <os family="mac" /> </not> <not> - <isset property="amd.app.sdk.dir.exists" /> + <isset property="app.sdk.dir.exists" /> </not> </and> </condition> <![CDATA[ - You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code + You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code - At present amd.app.sdk.dir is set (to ${amd.app.sdk.dir}) but that dir does not exist + At present app.sdk.dir is set (to ${app.sdk.dir}) but that dir does not exist ]]> </fail> </target> @@ -601,11 +501,11 @@ First consider editing the properties in build.properties </javah> </target> - <target name="gcc" if="use.gcc"> <mkdir dir="${basedir}/dist"/> <echo message="linuxcc ${os.arch}" /> - <exec executable="g++"> + <exec executable="g++" failonerror="true"> + <arg value="-m${gcc.m.value}" /> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> @@ -613,7 +513,7 @@ First consider editing the properties in build.properties <arg value="-I${java.home}/../include" /> <arg value="-I${java.home}/../include/linux" /> <arg value="-Iinclude" /> - <arg value="-I${amd.app.sdk.dir}/include" /> + <arg value="-I${app.sdk.dir}/include" /> <arg value="-Isrc/cpp" /> <arg value="-Isrc/cpp/runKernel" /> <arg value="-Isrc/cpp/invoke" /> @@ -635,7 +535,8 @@ First consider editing the properties in build.properties <arg value="src/cpp/classtools.cpp" /> <arg value="src/cpp/JNIHelper.cpp" /> <arg value="src/cpp/agent.cpp" /> - <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" /> + <arg value="-L${app.sdk.dir}/lib/${x86_or_x86_64}" /> + <arg value="-L${app.sdk.dir}/${optional.app.sdk.lib.subdir}" /> <arg value="-lOpenCL" /> </exec> </target> @@ -643,7 +544,7 @@ First consider editing the properties in build.properties <target name="gcc_mac" if="use.gcc_mac"> <mkdir dir="${basedir}/dist"/> <echo message="gcc ${os.arch}" /> - <exec executable="g++"> + <exec executable="g++" failonerror="true"> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> @@ -651,9 +552,9 @@ First consider editing the properties in build.properties <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/> <!-- JDK 6 --> <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" /> - <!-- JDK 7u51 without JDK 6 --> - <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home/include/" /> - <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home/include/darwin/" /> + <!-- LATEST JDK 7 without JDK 6 --> + <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/" /> + <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/darwin/" /> <arg value="-Iinclude" /> <arg value="-Isrc/cpp" /> <arg value="-Isrc/cpp/runKernel" /> @@ -685,7 +586,7 @@ First consider editing the properties in build.properties <target name="msvc" if="use.msvc"> <mkdir dir="${basedir}\dist"/> <echo message="msvc ${os.arch}" /> - <exec executable="${msvc.dir}\${optional.amd64.subdir}cl.exe"> + <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" failonerror="true"> <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" /> <arg value="/nologo" /> <arg value="/TP" /> @@ -698,10 +599,9 @@ First consider editing the properties in build.properties <arg value="/I${java.home}\..\include" /> <arg value="/I${java.home}\..\include\win32" /> <arg value="/Iinclude" /> - <arg value="/I${amd.app.sdk.dir}\include" /> + <arg value="/I${app.sdk.dir}\include" /> <arg value="/IC:\Program Files (x86)\Windows Kits\8.0\Include\shared" /> <arg value="/IC:\Program Files (x86)\Windows Kits\8.0\Include\um" /> - <arg value="/Isrc/cpp" /> <arg value="/Isrc/cpp/runKernel" /> <arg value="/Isrc/cpp/invoke" /> @@ -724,58 +624,20 @@ First consider editing the properties in build.properties <arg value="/link" /> <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" /> <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" /> - <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" /> + <arg value="/libpath:${app.sdk.dir}\lib\${x86_or_x86_64}" /> + <arg value="/libpath:${app.sdk.dir}\${optional.app.sdk.lib.subdir}" /> <arg value="/libpath:C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64" /> - <arg value="C:\Program Files (x86)\AMD APP SDK\2.9-1\lib\x86\OpenCL.lib" /> + <arg value="OpenCL.lib" /> <arg value="/out:${basedir}\dist\aparapi_${x86_or_x86_64}.dll" /> </exec> </target> - <target name="mingw" if="use.mingw"> - <mkdir dir="${basedir}\dist"/> - <echo message="mingw ${os.arch}" /> - <exec executable="${mingw.dir}/bin/g++"> - <env key="PATH" path="${env.PATH};${mingw.dir}/bin" /> - <arg value="-Wall" /> - <arg value="-O3" /> - <arg value="-Wl,--kill-at" /> - <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/> - <arg value="-I${java.home}\..\include" /> - <arg value="-I${java.home}\..\include\win32" /> - <arg value="-Iinclude" /> - <arg value="-I${amd.app.sdk.dir}\include" /> - <arg value="-Isrc/cpp" /> - <arg value="-Isrc/cpp/runKernel" /> - <arg value="-Isrc/cpp/invoke" /> - <arg value="-shared" /> - <arg value="-o" /> - <arg value="${basedir}\dist\aparapi_${x86_or_x86_64}.dll" /> - <arg value="src/cpp/runKernel/Aparapi.cpp" /> - <arg value="src/cpp/runKernel/ArrayBuffer.cpp" /> - <arg value="src/cpp/runKernel/AparapiBuffer.cpp" /> - <arg value="src/cpp/runKernel/Config.cpp" /> - <arg value="src/cpp/runKernel/JNIContext.cpp" /> - <arg value="src/cpp/runKernel/KernelArg.cpp" /> - <arg value="src/cpp/runKernel/ProfileInfo.cpp" /> - <arg value="src/cpp/runKernel/Range.cpp" /> - <arg value="src/cpp/invoke/OpenCLJNI.cpp" /> - <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" /> - <arg value="src/cpp/invoke/OpenCLMem.cpp" /> - <arg value="src/cpp/CLHelper.cpp" /> - <arg value="src/cpp/classtools.cpp" /> - <arg value="src/cpp/JNIHelper.cpp" /> - <arg value="src/cpp/agent.cpp" /> - <arg value="-L${amd.app.sdk.dir}\lib\${x86_or_x86_64}" /> - <arg value="-lOpenCL" /> - </exec> - </target> - - <target name="build" depends="clean, javah, msvc, mingw, gcc, gcc_mac" /> + <target name="build" depends="clean, javah, msvc, gcc, gcc_mac" /> <target name="msvc_cltest" if="use.msvc"> <mkdir dir="${basedir}\dist"/> <echo message="msvc_cltest ${os.arch}" /> - <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe"> + <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" failonerror="true"> <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" /> <arg value="/nologo" /> <arg value="/TP" /> @@ -783,7 +645,7 @@ First consider editing the properties in build.properties <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/> <arg value="/I${msvc.dir}\vc\include" /> <arg value="/I${msvc.sdk.dir}\include" /> - <arg value="/I${amd.app.sdk.dir}\include" /> + <arg value="/I${app.sdk.dir}\include" /> <arg value="/Isrc/cpp" /> <arg value="/Isrc/cpp/runKernel" /> <arg value="/Isrc/cpp/invoke" /> @@ -791,7 +653,8 @@ First consider editing the properties in build.properties <arg value="/link" /> <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" /> <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" /> - <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" /> + <arg value="/libpath:${app.sdk.dir}\lib\${x86_or_x86_64}" /> + <arg value="/libpath:${app.sdk.dir}\${optional.app.sdk.lib.subdir}" /> <arg value="OpenCL.lib" /> <arg value="/out:${basedir}/dist/cltest_${x86_or_x86_64}.exe" /> </exec> @@ -800,16 +663,16 @@ First consider editing the properties in build.properties <target name="mac_cltest" if="use.gcc_mac"> <mkdir dir="${basedir}/dist"/> <echo message="gcc cltest ${os.arch}" /> - <exec executable="g++"> + <exec executable="g++" failonerror="true"> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/> <!-- JDK 6 --> <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" /> - <!-- JDK 7u51 without JDK 6 --> - <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include/" /> - <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include/darwin/" /> + <!-- Latest JDK 7 without JDK 6 --> + <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/" /> + <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/darwin/" /> <arg value="-Iinclude" /> <arg value="-Isrc/cpp" /> <arg value="-Isrc/cpp/runKernel" /> @@ -825,16 +688,17 @@ First consider editing the properties in build.properties <target name="gcc_cltest" if="use.gcc"> <mkdir dir="${basedir}/dist"/> <echo message="gcc cltest ${os.arch}" /> - <exec executable="g++"> + <exec executable="g++" failonerror="true"> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/> <arg value="-I${java.home}/../include" /> <arg value="-I${java.home}/../include/linux" /> - <arg value="-I${amd.app.sdk.dir}/include" /> + <arg value="-I${app.sdk.dir}/include" /> <arg value="src/cpp/cltest.cpp" /> - <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" /> + <arg value="-L${app.sdk.dir}/lib/${x86_or_x86_64}" /> + <arg value="-L${app.sdk.dir}/${optional.app.sdk.lib.subdir}" /> <arg value="-lOpenCL" /> <arg value="-o" /> <arg value="${basedir}/cltest_${x86_or_x86_64}" /> @@ -844,7 +708,7 @@ First consider editing the properties in build.properties <target name="gcc_clt" if="use.gcc"> <mkdir dir="${basedir}/dist"/> <echo message="gcc cltest ${os.arch}" /> - <exec executable="g++"> + <exec executable="g++" failonerror="true"> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> @@ -855,11 +719,10 @@ First consider editing the properties in build.properties </exec> </target> - <target name="mac_clt" if="use.gcc_mac"> <mkdir dir="${basedir}/dist"/> <echo message="gcc clt ${os.arch}" /> - <exec executable="g++"> + <exec executable="g++" failonerror="true"> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> diff --git a/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp b/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp index d9c969705e2aa8d2fe814f54fde8f1a5a5db48c9..cbad7e81539f48989f847e32edc5ebf643f2b413 100644 --- a/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp +++ b/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp @@ -52,7 +52,7 @@ static const int PASS_ID_PREPARING_EXECUTION = -2; static const int PASS_ID_COMPLETED_EXECUTION = -1; -static const int CANCEL_STATUS_FALSE = 0; +static const int CANCEL_STATUS_FALSE = 0; static const int CANCEL_STATUS_TRUE = 1; //compiler dependant code @@ -141,10 +141,10 @@ jint writeProfileInfo(JNIContext* jniContext){ fprintf(jniContext->profileFile, "%d write %s,", pos++, arg->name); fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", - (unsigned long)(arg->arrayBuffer->write.queued - currSampleBaseTime)/1000, - (unsigned long)(arg->arrayBuffer->write.submit - currSampleBaseTime)/1000, - (unsigned long)(arg->arrayBuffer->write.start - currSampleBaseTime)/1000, - (unsigned long)(arg->arrayBuffer->write.end - currSampleBaseTime)/1000); + (unsigned long)(arg->arrayBuffer->write.queued - currSampleBaseTime)/1000, + (unsigned long)(arg->arrayBuffer->write.submit - currSampleBaseTime)/1000, + (unsigned long)(arg->arrayBuffer->write.start - currSampleBaseTime)/1000, + (unsigned long)(arg->arrayBuffer->write.end - currSampleBaseTime)/1000); } } @@ -181,10 +181,10 @@ jint writeProfileInfo(JNIContext* jniContext){ fprintf(jniContext->profileFile, "%d read %s,", pos++, arg->name); fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", - (unsigned long)(arg->arrayBuffer->read.queued - currSampleBaseTime)/1000, - (unsigned long)(arg->arrayBuffer->read.submit - currSampleBaseTime)/1000, - (unsigned long)(arg->arrayBuffer->read.start - currSampleBaseTime)/1000, - (unsigned long)(arg->arrayBuffer->read.end - currSampleBaseTime)/1000); + (unsigned long)(arg->arrayBuffer->read.queued - currSampleBaseTime)/1000, + (unsigned long)(arg->arrayBuffer->read.submit - currSampleBaseTime)/1000, + (unsigned long)(arg->arrayBuffer->read.start - currSampleBaseTime)/1000, + (unsigned long)(arg->arrayBuffer->read.end - currSampleBaseTime)/1000); } } } @@ -789,15 +789,15 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, cl_int status = CL_SUCCESS; for (int passid=0; passid < passes; passid++) { - - int cancelCode = kernelInBytesAsInts[0]; - kernelOutBytesAsInts[0] = passid; + + int cancelCode = kernelInBytesAsInts[0]; + kernelOutBytesAsInts[0] = passid; - if (cancelCode == CANCEL_STATUS_TRUE) { - fprintf(stderr, "received cancellation, aborting at pass %d\n", passid); - kernelOutBytes[0] = -1; - break; - } + if (cancelCode == CANCEL_STATUS_TRUE) { + fprintf(stderr, "received cancellation, aborting at pass %d\n", passid); + kernelOutBytes[0] = -1; + break; + } //size_t offset = 1; // (size_t)((range.globalDims[0]/jniContext->deviceIdc)*dev); status = clSetKernelArg(jniContext->kernel, argPos, sizeof(passid), &(passid)); @@ -1079,16 +1079,16 @@ JNI_JAVA(jint, KernelRunnerJNI, runKernelJNI) cl_int status = CL_SUCCESS; JNIContext* jniContext = JNIContext::getJNIContext(jniContextHandle); - jniContext->runKernelInBytes = (jbyte*)jenv->GetDirectBufferAddress(inBuffer); - jniContext->runKernelOutBytes = (jbyte*)jenv->GetDirectBufferAddress(outBuffer); + jniContext->runKernelInBytes = (jbyte*)jenv->GetDirectBufferAddress(inBuffer); + jniContext->runKernelOutBytes = (jbyte*)jenv->GetDirectBufferAddress(outBuffer); - jbyte* kernelInBytes = jniContext->runKernelInBytes; - int* kernelInBytesAsInts = reinterpret_cast<int*>(kernelInBytes); - kernelInBytesAsInts[0] = CANCEL_STATUS_FALSE; + jbyte* kernelInBytes = jniContext->runKernelInBytes; + int* kernelInBytesAsInts = reinterpret_cast<int*>(kernelInBytes); + kernelInBytesAsInts[0] = CANCEL_STATUS_FALSE; - jbyte* kernelOutBytes = jniContext->runKernelOutBytes; - int* kernelOutBytesAsInts = reinterpret_cast<int*>(kernelOutBytes); - kernelOutBytesAsInts[0] = PASS_ID_PREPARING_EXECUTION; + jbyte* kernelOutBytes = jniContext->runKernelOutBytes; + int* kernelOutBytesAsInts = reinterpret_cast<int*>(kernelOutBytes); + kernelOutBytesAsInts[0] = PASS_ID_PREPARING_EXECUTION; if (jniContext->firstRun && config->isProfilingEnabled()){ try {