Changes between Version 34 and Version 35 of AppCoprocessor


Ignore:
Timestamp:
Oct 12, 2011, 11:53:06 AM (13 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppCoprocessor

    v34 v35  
    11= Applications that use coprocessors =
    2 
    32BOINC supports applications that use coprocessors.
    43The supported coprocessor types (as of [18892])are NVIDIA and ATI GPUs.
     
    87It only runs an app if enough instances are available.
    98
    10 You can develop your application using any programming system, e.g.
    11 CUDA (for NVIDIA), Brook+ (for ATI) or OpenCL.
     9You can develop your application using any programming system, e.g. CUDA (for NVIDIA), Brook+ (for ATI) or OpenCL.
    1210
    1311== Dealing with GPU memory allocation failures ==
    14 
    1512GPUs don't have virtual memory.
    1613GPU memory allocations may fail because other applications are using the GPU.
    1714This is typically a temporary condition.
    1815Rather than exiting with an error in this case, call
     16
    1917{{{
    2018boinc_temporary_exit(60);
     
    2321
    2422== Device selection ==
    25 
    2623Some hosts have multiple GPUs.
    2724When your application is run by BOINC, it will be passed a command-line argument
     25
    2826{{{
    2927--gpu_type X --device N
    3028}}}
    3129where 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.
     30If your application uses multiple GPUs, it will be passed multiple --device arguments, e.g.
     31
    3432{{{
    3533--gpu_type X --device 0 --device 3
    3634}}}
     35== Cleanup on premature exit ==
     36The BOINC client may kill your application in the middle. This may leave the GPU in a bad state. To prevent this, call
    3737
    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, call
    4338{{{
    4439boinc_begin_critical_section();
    4540}}}
    4641before using the GPU, and between GPU kernels do
     42
    4743{{{
    4844if (boinc_status.quit_request || boinc_status.abort_request) {
     
    5248}
    5349}}}
    54 
    5550== 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.
     51Each coprocessor application has an associated [wiki:AppPlan plan class] which determines the hardware and software resources that are needed to run the application.
    6052
    6153The following plan classes for NVIDIA are pre-defined:
    6254
    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.
    6556 '''cuda23''':: Requires driver version 190.38+, 384+ MB RAM.
    6657 '''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
    6859
    69 For ATI the situation is more complex because AMD changed the
    70 DLL names from amd* to ati* midstream;
     60For ATI the situation is more complex because AMD changed the DLL names from amd* to ati* midstream;
    7161applications are linked against a particular name and will fail if it's not present.
    7262
     
    7565 '''ati13ati''':: CAL version 1.3+, ati* DLLs
    7666 '''ati14''':: CAL version 1.4+, ati* DLLs
     67 '''opencl_ati_101''':: OpenCL 1.1+
    7768
    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.
     69You can verify which DLLs your application is linked against by using
     70[http://www.dependencywalker.com/ Dependency Walker] against your application.
     71If your executable contains DLL names prefixed with 'amd' then your plan class
     72will be ati or ati13amd depending on which version of the CAL SDK you are using.
     73If the DLL names are prefixed with 'ati' then use the ati13ati or ati14 plan classes.
    7974
    8075In all cases (NVIDIA and ATI), the application is assumed to use 1 GPU,
     
    8479
    8580Once you have chosen a plan class for your executable,
    86 create an [UpdateVersions app version], specifying its plan class.
     81create an [wiki:UpdateVersions app version], specifying its plan class.
    8782
    8883== 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.
     84If your application has properties that differ from any of the pre-defined classes,
     85you can define your own.
     86To do this, you must modify the [wiki:AppPlan application planning function] that you link into your scheduler.
    9487
    9588To see how to do this, let's look at the default function.
    9689First, we check if the host has an NVIDIA GPU.
     90
    9791{{{
    9892int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
     
    110104        }
    111105}}}
     106Check the compute capability (1.0 or better):
    112107
    113 Check the compute capability (1.0 or better):
    114108{{{
    115109        int v = (cp->prop.major)*100 + cp->prop.minor;
     
    125119         }
    126120}}}
     121Check the CUDA runtime version.
     122As of client version 6.10, all clients report the CUDA runtime version (cp->cuda_version); use that if it's present.
     123In 6.8 and earlier, the CUDA runtime version isn't reported.
     124Windows clients report the driver version, from which the CUDA version can be inferred;
     125Linux clients don't return the driver version, so we don't know what the CUDA version is.
    127126
    128 Check the CUDA runtime version.
    129 As of client version 6.10, all clients report the CUDA runtime version
    130 (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.
    136127{{{
    137128        // for CUDA 2.3, we need to check the CUDA RT version.
     
    156147            }
    157148}}}
     149Check for the amount of video RAM:
    158150
    159 Check for the amount of video RAM:
    160151{{{
    161152        if (cp->prop.dtotalGlobalMem < PLAN_CUDA_MIN_RAM) {
     
    174165        }
    175166}}}
     167Estimate the FLOPS:
    176168
    177 Estimate the FLOPS:
    178169{{{
    179170        hu.flops = cp->flops_estimate();
    180171}}}
     172Estimate its CPU usage:
    181173
    182 Estimate its CPU usage:
    183174{{{
    184175        // assume we'll need 0.5% as many CPU FLOPS as GPU FLOPS
     
    189180        hu.max_ncpus = x;
    190181}}}
     182Indicate the number of GPUs used. Typically this will be 1.
     183If your application uses only a fraction X<1 of the CPU processors,
     184and a fraction Y<1 of video RAM, reports the number of GPUs as min(X, Y).
     185In this case BOINC will attempt to run multiple jobs per GPU is possible.
    191186
    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.
    198187{{{
    199188        hu.ncudas = 1;
    200189}}}
     190Return true to indicate that the application can be run on the host:
    201191
    202 Return true to indicate that the application can be run on the host:
    203192{{{
    204193        return true;