11 | | BOINC-NVCuda sample app for Windows can be found at "/boinc/samples/nvcuda/". |
12 | | |
13 | | {{{ |
14 | | cuda_kernel.cu; cuda.cu; cuda_config.h |
15 | | }}} |
16 | | The example_app_nvcuda.vcproj can be found at "boinc/win_build/". Note that NVIDIA Cuda SDK 3.0 or older supports device emulation mode. If your machine doesn't have a Cuda-enabled GPU, then you should build the sample app in the device emulation mode. Do so by setting "Build -> Configuration Manger -> Configuration" to either Emudebug|Emurelease. It comes to our attention that while compiling the sample app, the linker tries to link both the debug and release libraries, and thus causing the following errors: |
| 16 | The VS project file, example_app_nvcuda.vcproj, is in "boinc/win_build/". |
| 17 | Note that NVIDIA Cuda SDK 3.0 or older supports device emulation mode. |
| 18 | If your machine doesn't have a Cuda-enabled GPU, |
| 19 | then you should build the sample app in the device emulation mode. |
| 20 | Do so by setting "Build -> Configuration Manger -> Configuration" to either Emudebug|Emurelease. |
| 21 | It comes to our attention that while compiling the sample app, |
| 22 | the linker tries to link both the debug and release libraries, and thus causing the following errors: |
23 | | One solution to this problem is to set the Hyprid Cuda/C++ Runtime Library point to "Multi-Threaded Debug (/MTd)". Do so by right click on the project. Set "Properties -> Configuration Properties -> Cuda Build Rule v3.0.14 -> Hybrid CUDA/C++ Options -> Runtime Library" to "Multi-Threaded Debug (/MTd)". |
24 | | |
25 | | The executable file can be found at "boinc/win_build/Build/Win32/build_mode/" (build_mode could be release, debug, emurelease or emudebug). |
| 29 | One solution to this problem is to set the Hyprid Cuda/C++ Runtime Library to "Multi-Threaded Debug (/MTd)". |
| 30 | Do so by right click on the project. |
| 31 | Set "Properties -> Configuration Properties -> Cuda Build Rule v3.0.14 -> Hybrid CUDA/C++ Options -> Runtime Library" |
| 32 | to "Multi-Threaded Debug (/MTd)". |
| 33 | |
| 34 | The executable file can be found at "boinc/win_build/Build/Win32/build_mode/" |
| 35 | (build_mode could be release, debug, emurelease or emudebug). |
29 | | BOINC-NVOpenCL sample app for Windows can be found at "/boinc/samples/nvopencl/". |
30 | | |
31 | | {{{ |
32 | | nvopencl.hpp; nvopencl.cpp; nvopencl_kernels.cl |
33 | | }}} |
34 | | The example_app_nvopencl.vcproj can be found at "boinc/win_build/". OpenCL doesn't have emulation mode, but it could run on CPU alone by specifying CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_ALL when creating an OpenCL context. |
| 39 | The project file, example_app_nvopencl.vcproj, is in "boinc/win_build/". |
| 40 | OpenCL doesn't have emulation mode, |
| 41 | but it could run on CPU alone by specifying CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_ALL when creating an OpenCL context. |
40 | | BOINC-ATIOpenCL sample app for Windows can be found at "/boinc/samples/atiopencl/". |
41 | | |
42 | | {{{ |
43 | | atiopencl.hpp; atiopencl.cpp; atiopencl_kernels.cl |
44 | | }}} |
45 | | The example_app_atiopencl.vcproj can be found at "boinc/win_build/". It is identical to NVIDIA OpenCL. Prior to build the app, make sure you have already reset the Runtime Library to point to "Multi-threaded Debug (/MTd)". |
| 49 | The project file, example_app_atiopencl.vcproj, is in "boinc/win_build/". |
| 50 | It is identical to NVIDIA OpenCL. |
| 51 | Prior to build the app, make sure you have already reset the Runtime Library to point to "Multi-threaded Debug (/MTd)". |
50 | | BOINC-NVCuda sample app for Linux can be found at "/boinc/samples/nvcuda/". |
51 | | |
52 | | {{{ |
53 | | Makefile; common.mk; cuda_kernel.cu; cuda.cu; cuda_config.h; readme.txt |
54 | | }}} |
55 | | |
56 | | Before running Makefile, you will need to install gcc 4.3 and g++ 4.3. This is because the NVIDIA Cuda SDK 3.0 has not yet worked with gcc 4.0 and g++ 4.0. There should be no issue compiling cuda files with gcc 4.3 and g++ 4.3 on newer NVIDIA Cuda SDK versions. For a successful compilation, please follow these steps: |
57 | | |
58 | | {{{ |
| 56 | |
| 57 | Before running the Makefile, you will need to install gcc 4.3 and g++ 4.3. |
| 58 | This is because the NVIDIA Cuda SDK 3.0 has not yet worked with gcc 4.0 and g++ 4.0. |
| 59 | There should be no issue compiling cuda files with gcc 4.3 and g++ 4.3 on newer NVIDIA Cuda SDK versions. |
| 60 | For a successful compilation, please follow these steps: |
| 61 | |
66 | | $ mkdir mygcc |
67 | | $ cd mygcc |
68 | | $ ln -s $(which g++-4.3) g++ |
69 | | $ ln -s $(which gcc-4.3) gcc |
70 | | }}} |
71 | | |
72 | | The Makefile for Linux is made with the assumption that the NVIDIA Cuda SDK is installed at the default location "$(ROOT)/home/USER_NAME/NVIDIA_GPU_Computing_SDK/". On my Linux machine, for example, it would be "$(ROOT)/home/tuanle/NVIDIA_GPU_Computing_SDK/". Since the absolute path is used in Makefile, you will probably need to edit file "common.mk" before compiling the sample app. Do so by looking for "/home/tuanle/NVIDIA_GPU_Computing_SDK" in file "common.mk" and replace this path with an appropriate path on your machine. |
73 | | |
74 | | What if your machine doesn't have an NVIDIA Cuda-enabled GPU? Then, you can compile and run your app in emulation mode. As far as we know, NVIDIA Cuda SDK 3.1 no longer supports emulation mode. Thus, you will need to install an older Cuda SDK version, like version 3.0, on your machine. To make an executable file in emulation mode, simply type "make emu=1". |
| 73 | {{{ |
| 74 | $ mkdir mygcc |
| 75 | $ cd mygcc |
| 76 | $ ln -s $(which g++-4.3) g++ |
| 77 | $ ln -s $(which gcc-4.3) gcc |
| 78 | }}} |
| 79 | |
| 80 | The Makefile for Linux is made with the assumption that the NVIDIA Cuda SDK |
| 81 | is installed at the default location "$(ROOT)/home/USER_NAME/NVIDIA_GPU_Computing_SDK/". |
| 82 | On my Linux machine, for example, it would be "$(ROOT)/home/tuanle/NVIDIA_GPU_Computing_SDK/". |
| 83 | Since the absolute path is used in Makefile, you will probably need to edit file "common.mk" before compiling the sample app. |
| 84 | Do so by looking for "/home/tuanle/NVIDIA_GPU_Computing_SDK" in file "common.mk" |
| 85 | and replace this path with an appropriate path on your machine. |
| 86 | |
| 87 | What if your machine doesn't have an NVIDIA Cuda-enabled GPU? |
| 88 | Then, you can compile and run your app in emulation mode. |
| 89 | As far as we know, NVIDIA Cuda SDK 3.1 no longer supports emulation mode. |
| 90 | Thus, you will need to install an older Cuda SDK version, like version 3.0, on your machine. |
| 91 | To make an executable file in emulation mode, simply type "make emu=1". |
84 | | BOINC-NVOpenCL sample app for Linux can be found at "/boinc/samples/nvopencl/". |
85 | | |
86 | | {{{ |
87 | | Makefile; common_opencl; nvopencl.h; nvopencl.cpp; nvopencl_kernels; readme.txt |
88 | | }}} |
89 | | It appears that NVIDIA OpenCL SDK is missing shared library file libOpenCL.so which is needed at compile time. This library file comes with the kernel driver package which can be installed only when your machine has an NVIDIA Cuda-enabled GPU. Thus, any attempt to compile OpenCL sample codes on a non-cuda-enabled GPU machine might result in the following error: |
| 101 | It appears that NVIDIA OpenCL SDK is missing shared library file libOpenCL.so which is needed at compile time. |
| 102 | This library file comes with the kernel driver package |
| 103 | which can be installed only when your machine has an NVIDIA Cuda-enabled GPU. |
| 104 | Thus, any attempt to compile OpenCL sample codes on a non-cuda-enabled GPU machine might result in the following error: |
93 | | The Makefile for Linux is made with the assumption that the NVIDIA Cuda SDK is installed at the default location "$(ROOT)/home/USER_NAME/NVIDIA_GPU_Computing_SDK/". On my Linux machine, for example, it would be "$(ROOT)/home/tuanle/NVIDIA_GPU_Computing_SDK/". Since the absolute path is used in Makefile, you will probably need to edit file "common.mk" before compiling the sample app. Do so by looking for "/home/tuanle/NVIDIA_GPU_Computing_SDK" in file "common.mk" and replace this path with an appropriate path on your machine. |
| 108 | The Makefile for Linux is made with the assumption that the NVIDIA Cuda SDK |
| 109 | is installed at the default location "$(ROOT)/home/USER_NAME/NVIDIA_GPU_Computing_SDK/". |
| 110 | On my Linux machine, for example, it would be "$(ROOT)/home/tuanle/NVIDIA_GPU_Computing_SDK/". |
| 111 | Since the absolute path is used in Makefile, you will probably need to edit file "common.mk" before compiling the sample app. |
| 112 | Do so by looking for "/home/tuanle/NVIDIA_GPU_Computing_SDK" in file "common.mk" |
| 113 | and replace this path with an appropriate path on your machine. |
97 | | BOINC-ATIOpenCL sample app for Linux can be found at "/boinc/samples/atiopencl/". |
98 | | |
99 | | {{{ |
100 | | Makefile; atiopencl.h; atiopencl.cpp; atiopencl_kernels; readme.txt |
101 | | }}} |
102 | | The Makefile for Linux is made with the assumption that the ATI Stream OpenCL SDK version 2.1 for 32-bit Linux and Boinc are installed in the same parent directory, i.e. "ati-stream-sdk-v.2.1-lnx32" directory and "boinc" directory are both installed at "$(ROOT)/home/" directory. If you are using the SDK v2.1 for 64-bit Linux, or if Boinc and the OpenCL SDK are not installed in the same parent directory, then Makefile needs to be edited prior to any compilation. Do so by looking for |
103 | | {{{ |
104 | | |
| 117 | The Makefile for Linux is made with the assumption that the ATI Stream OpenCL |
| 118 | SDK version 2.1 for 32-bit Linux and Boinc are installed in the same parent directory, |
| 119 | i.e. "ati-stream-sdk-v.2.1-lnx32" directory and "boinc" directory are both installed at "$(ROOT)/home/" directory. |
| 120 | If you are using the SDK v2.1 for 64-bit Linux, or if Boinc and the OpenCL SDK |
| 121 | are not installed in the same parent directory, |
| 122 | then Makefile needs to be edited prior to any compilation. |
| 123 | Do so by looking for |
| 124 | {{{ |
130 | | $ export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86:$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH |
131 | | }}} |
132 | | |
133 | | 2) ./atiopencl: error CL_PLATFORM_NOT_FOUND -> Solution: |
134 | | {{{ |
135 | | Need to register the OpenCL ICD by following these steps: |
136 | | - Download icd-registration.tgz at http://developer.amd.com/Downloads/icd-registration.tgz |
137 | | - In the command shell, type "cd /" |
138 | | - Type "ls", you will see a directory named "etc". The icd-registration.tgz needs to be unzipped to that directory. |
139 | | - Now copy icd-registration.tgz to "cd /" by typing "sudo cp -r /home/tuanle/Downloads/icd-registration.tgz ." |
140 | | - You will need to replace the specified path above with the appropriate path on your machine, and don't forget "sudo". Otherwise you will get a "Permission denied". |
141 | | - Unzip by typing "sudo tar xzf icd-registration.tgz" |
142 | | - Now you should be able to find an "OpenCL" directory in "etc". Check etc/OpenCL/vendors/, make sure there are "atiocl32.icd" and "atiocl64.icd" there. |
143 | | - Done! |
144 | | }}} |
| 157 | {{{ |
| 158 | $ export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86:$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH |
| 159 | }}} |
| 160 | |
| 161 | 2) ./atiopencl: error CL_PLATFORM_NOT_FOUND -> |
| 162 | |
| 163 | Solution: Register the OpenCL ICD by following these steps: |
| 164 | * Download icd-registration.tgz at http://developer.amd.com/Downloads/icd-registration.tgz |
| 165 | * In the command shell, type "cd /" |
| 166 | * Type "ls", you will see a directory named "etc". |
| 167 | The icd-registration.tgz needs to be unzipped to that directory. |
| 168 | * Now copy icd-registration.tgz to "cd /" by typing "sudo cp -r /home/tuanle/Downloads/icd-registration.tgz ." |
| 169 | * You will need to replace the specified path above with the appropriate path on your machine, and don't forget "sudo". |
| 170 | Otherwise you will get a "Permission denied". |
| 171 | * Unzip by typing "sudo tar xzf icd-registration.tgz" |
| 172 | * Now you should be able to find an "OpenCL" directory in "etc". |
| 173 | Check etc/OpenCL/vendors/, make sure there are "atiocl32.icd" and "atiocl64.icd" there. |
| 174 | * Done! |
165 | | The solution that we came up with is to compile BOINC and Cuda seperately, meaning that compile .c files that have BOINC codes with |
166 | | gcc and compile .u files that have Cuda codes such as kernel definitions with nvcc (This can simply be done by putting .cu and .c |
167 | | file names at corresponding "CUFILES := " and "CCFILES := " entries in Makefile_mac). To handle the results computed by the kernels, |
168 | | you will need to write external functions. The function definitions that make kernel calls will be put in .cu file while the function headers with "extern" prefix are put in .c file and can be called in main function or elsewhere. |
169 | | |
170 | | What if your machine doesn't have an NVIDIA Cuda-enabled GPU? Then, you can compile and run your app in emulation mode. As far as we know, NVIDIA Cuda SDK 3.1 no longer supports emulation mode. Thus, you will need to install an older Cuda SDK version, like version 3.0, on your machine. To make an executable file in emulation mode, simply type "make -f Makefile_mac emu=1". |
| 192 | The solution that we came up with is to compile BOINC and Cuda separately, |
| 193 | meaning that compile .c files that have BOINC codes with |
| 194 | gcc and compile .u files that have Cuda codes such as kernel definitions with nvcc |
| 195 | (This can simply be done by putting .cu and .c |
| 196 | file names at corresponding "CUFILES := " and "CCFILES := " entries in Makefile_mac). |
| 197 | To handle the results computed by the kernels, |
| 198 | you will need to write external functions. |
| 199 | The function definitions that make kernel calls will be put in .cu file |
| 200 | while the function headers with "extern" prefix are put in .c file and can be called in main function or elsewhere. |
| 201 | |
| 202 | What if your machine doesn't have an NVIDIA Cuda-enabled GPU? Then, you can compile and run your app in emulation mode. |
| 203 | As far as we know, NVIDIA Cuda SDK 3.1 no longer supports emulation mode. |
| 204 | Thus, you will need to install an older Cuda SDK version, like version 3.0, on your machine. |
| 205 | To make an executable file in emulation mode, simply type "make -f Makefile_mac emu=1". |
178 | | One last thing to mention, the makefile for Mac is made with the assumption that the NVIDIA Cuda SDK is installed at the default location: "$ROOT/Developer/GPU Computing/" on Mac. If it is installed at a different location on your machine, then you will need to edit file "common_mac.mk". Do so by looking for "ROOTDIR ?= /Developer/GPU\ Computing" in file "common_mac.mk" and replace this path with an appropriate path on your machine. |
| 213 | One last thing to mention, the makefile for Mac is made with the assumption |
| 214 | that the NVIDIA Cuda SDK is installed at the default location: "$ROOT/Developer/GPU Computing/" on Mac. |
| 215 | If it is installed at a different location on your machine, then you will need to edit file "common_mac.mk". |
| 216 | Do so by looking for "ROOTDIR ?= /Developer/GPU\ Computing" in file "common_mac.mk" |
| 217 | and replace this path with an appropriate path on your machine. |
| 218 | |