Changes between Version 1 and Version 2 of GPUApp


Ignore:
Timestamp:
Jul 1, 2010, 4:34:44 PM (14 years ago)
Author:
TuanLe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GPUApp

    v1 v2  
    1 stub
     1= Building BOINC applications with Cuda and OpenCL =
     2
     3[[PageOutline]]
     4
     5We have built sample BOINC-Cuda and BOINC-OpenCL applications as templates for making your own app.
     6
     7== Windows == #windows
     8
     9
     10== Linux == #linux
     11
     12
     13== Mac OS X == #mac
     14
     15 * Cuda (BOINC-Cuda sample app for Mac OS X can be found at "/boinc/samples/nvcuda/")
     16{{{
     17Makefile_mac; common_mac.mk; cuda_kernel_mac.cu; cuda_mac.c; readme_mac.txt
     18}}}
     19
     20 Unlike Windows and Linux, the 'nvcc' cuda compiler for Mac has some trouble compiling .cu files that
     21 contain both BOINC and Cuda codes. Any attempt to compile such .cu files might result in errors like
     22 these:
     23{{{
     24/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/mmintrin.h(55): error: identifier "__builtin_ia32_emms" is undefined
     25/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/mmintrin.h(68): error: identifier "__builtin_ia32_vec_init_v2si" is undefined
     26/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/mmintrin.h(111): error: identifier "__builtin_ia32_vec_ext_v2si" is undefined
     27/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/mmintrin.h(150): error: identifier "__builtin_ia32_packsswb" is undefined
     28/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/mmintrin.h(165): error: identifier "__builtin_ia32_packssdw" is undefined
     29...
     30...
     31}}}
     32 The solution that we came up with is to compile BOINC and Cuda seperately, meaning that compile .c files that have BOINC codes with
     33 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
     34 file names at corresponding "CUFILES := " and "CCFILES := " entries in Makefile_mac). To handle the results computed by the kernels,
     35 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.
     36
     37 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".
     38
     39 Also, note that you will need to define some environment variables before running the executable file.
     40{{{
     41export PATH=/usr/local/cuda/bin:$PATH
     42export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
     43}}}
     44
     45 One last thing to mention, the makefile for Mac is made with the assumption that the NVIDIA Cuda SDK is installed at the default path: "$ROOT/Developer/GPU Computing/" on Mac. If it is installed at a different path on your machine, then you will need to edit "common_mac.mk" file. Do so by looking for "ROOTDIR  ?= /DeveloperGPU\ Computing" in "common_mac.mk" file and replace this path with an appropriate path on your machine.