Changes between Version 34 and Version 35 of AppCoprocessor
- Timestamp:
- Oct 12, 2011, 11:53:06 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AppCoprocessor
v34 v35 1 1 = Applications that use coprocessors = 2 3 2 BOINC supports applications that use coprocessors. 4 3 The supported coprocessor types (as of [18892])are NVIDIA and ATI GPUs. … … 8 7 It only runs an app if enough instances are available. 9 8 10 You can develop your application using any programming system, e.g. 11 CUDA (for NVIDIA), Brook+ (for ATI) or OpenCL. 9 You can develop your application using any programming system, e.g. CUDA (for NVIDIA), Brook+ (for ATI) or OpenCL. 12 10 13 11 == Dealing with GPU memory allocation failures == 14 15 12 GPUs don't have virtual memory. 16 13 GPU memory allocations may fail because other applications are using the GPU. 17 14 This is typically a temporary condition. 18 15 Rather than exiting with an error in this case, call 16 19 17 {{{ 20 18 boinc_temporary_exit(60); … … 23 21 24 22 == Device selection == 25 26 23 Some hosts have multiple GPUs. 27 24 When your application is run by BOINC, it will be passed a command-line argument 25 28 26 {{{ 29 27 --gpu_type X --device N 30 28 }}} 31 29 where X is the GPU type (e.g., 'nvidia' or 'ati') and N is the device number of the GPU that is to be used. 32 If your application uses multiple GPUs, 33 it will be passed multiple --device arguments, e.g. 30 If your application uses multiple GPUs, it will be passed multiple --device arguments, e.g. 31 34 32 {{{ 35 33 --gpu_type X --device 0 --device 3 36 34 }}} 35 == Cleanup on premature exit == 36 The BOINC client may kill your application in the middle. This may leave the GPU in a bad state. To prevent this, call 37 37 38 == Cleanup on premature exit ==39 40 The BOINC client may kill your application in the middle.41 This may leave the GPU in a bad state.42 To prevent this, call43 38 {{{ 44 39 boinc_begin_critical_section(); 45 40 }}} 46 41 before using the GPU, and between GPU kernels do 42 47 43 {{{ 48 44 if (boinc_status.quit_request || boinc_status.abort_request) { … … 52 48 } 53 49 }}} 54 55 50 == Plan classes == 56 57 Each coprocessor application has an associated [AppPlan plan class] 58 which determines the hardware and software resources that are needed 59 to run the application. 51 Each coprocessor application has an associated [wiki:AppPlan plan class] which determines the hardware and software resources that are needed to run the application. 60 52 61 53 The following plan classes for NVIDIA are pre-defined: 62 54 63 '''cuda''':: NVIDIA GPU, compute capability 1.0+, 64 driver version 177.00+, 254+ MB RAM. 55 '''cuda''':: NVIDIA GPU, compute capability 1.0+, driver version 177.00+, 254+ MB RAM. 65 56 '''cuda23''':: Requires driver version 190.38+, 384+ MB RAM. 66 57 '''cuda_fermi''':: Requires compute capability 2.0+ and CUDA version 3.0+ 67 ''' cuda_opencl''':: Requires driver 197.13+ (OpenCL support)58 '''opencl_nvidia_101''':: Requires OpenCL 1.1+ support 68 59 69 For ATI the situation is more complex because AMD changed the 70 DLL names from amd* to ati* midstream; 60 For ATI the situation is more complex because AMD changed the DLL names from amd* to ati* midstream; 71 61 applications are linked against a particular name and will fail if it's not present. 72 62 … … 75 65 '''ati13ati''':: CAL version 1.3+, ati* DLLs 76 66 '''ati14''':: CAL version 1.4+, ati* DLLs 67 '''opencl_ati_101''':: OpenCL 1.1+ 77 68 78 You can verify which DLLs your application is linked against by using [http://www.dependencywalker.com/ Dependency Walker] against your application. If your executable contains DLL names prefixed with 'amd' then your plan class will be ati or ati13amd depending on which version of the CAL SDK you are using. If the DLL names are prefixed with 'ati' then use the ati13ati or ati14 plan classes. 69 You can verify which DLLs your application is linked against by using 70 [http://www.dependencywalker.com/ Dependency Walker] against your application. 71 If your executable contains DLL names prefixed with 'amd' then your plan class 72 will be ati or ati13amd depending on which version of the CAL SDK you are using. 73 If the DLL names are prefixed with 'ati' then use the ati13ati or ati14 plan classes. 79 74 80 75 In all cases (NVIDIA and ATI), the application is assumed to use 1 GPU, … … 84 79 85 80 Once you have chosen a plan class for your executable, 86 create an [ UpdateVersions app version], specifying its plan class.81 create an [wiki:UpdateVersions app version], specifying its plan class. 87 82 88 83 == Defining a custom plan class == 89 90 If your application has properties that differ from 91 any of the pre-defined classes, you can define your own. 92 To do this, you must modify the 93 [AppPlan application planning function] that you link into your scheduler. 84 If your application has properties that differ from any of the pre-defined classes, 85 you can define your own. 86 To do this, you must modify the [wiki:AppPlan application planning function] that you link into your scheduler. 94 87 95 88 To see how to do this, let's look at the default function. 96 89 First, we check if the host has an NVIDIA GPU. 90 97 91 {{{ 98 92 int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { … … 110 104 } 111 105 }}} 106 Check the compute capability (1.0 or better): 112 107 113 Check the compute capability (1.0 or better):114 108 {{{ 115 109 int v = (cp->prop.major)*100 + cp->prop.minor; … … 125 119 } 126 120 }}} 121 Check the CUDA runtime version. 122 As of client version 6.10, all clients report the CUDA runtime version (cp->cuda_version); use that if it's present. 123 In 6.8 and earlier, the CUDA runtime version isn't reported. 124 Windows clients report the driver version, from which the CUDA version can be inferred; 125 Linux clients don't return the driver version, so we don't know what the CUDA version is. 127 126 128 Check the CUDA runtime version.129 As of client version 6.10, all clients report the CUDA runtime version130 (cp->cuda_version); use that if it's present.131 In 6.8 and earlier, the CUDA runtime version isn't reported.132 Windows clients report the driver version,133 from which the CUDA version can be inferred;134 Linux clients don't return the driver version,135 so we don't know what the CUDA version is.136 127 {{{ 137 128 // for CUDA 2.3, we need to check the CUDA RT version. … … 156 147 } 157 148 }}} 149 Check for the amount of video RAM: 158 150 159 Check for the amount of video RAM:160 151 {{{ 161 152 if (cp->prop.dtotalGlobalMem < PLAN_CUDA_MIN_RAM) { … … 174 165 } 175 166 }}} 167 Estimate the FLOPS: 176 168 177 Estimate the FLOPS:178 169 {{{ 179 170 hu.flops = cp->flops_estimate(); 180 171 }}} 172 Estimate its CPU usage: 181 173 182 Estimate its CPU usage:183 174 {{{ 184 175 // assume we'll need 0.5% as many CPU FLOPS as GPU FLOPS … … 189 180 hu.max_ncpus = x; 190 181 }}} 182 Indicate the number of GPUs used. Typically this will be 1. 183 If your application uses only a fraction X<1 of the CPU processors, 184 and a fraction Y<1 of video RAM, reports the number of GPUs as min(X, Y). 185 In this case BOINC will attempt to run multiple jobs per GPU is possible. 191 186 192 Indicate the number of GPUs used.193 Typically this will be 1.194 If your application uses only a fraction X<1 of the CPU processors,195 and a fraction Y<1 of video RAM,196 reports the number of GPUs as min(X, Y).197 In this case BOINC will attempt to run multiple jobs per GPU is possible.198 187 {{{ 199 188 hu.ncudas = 1; 200 189 }}} 190 Return true to indicate that the application can be run on the host: 201 191 202 Return true to indicate that the application can be run on the host:203 192 {{{ 204 193 return true;