Changes between Version 15 and Version 16 of AppCoprocessor
- Timestamp:
- Aug 15, 2008, 8:08:50 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AppCoprocessor
v15 v16 22 22 To deploy it: 23 23 24 * Choose a "planning class" name for the program, say "cuda _1.1" (see below).25 * Create an [UpdateVersions app version]. Include a file '''app_plan''' containing "cuda _1.1".24 * Choose a "planning class" name for the program, say "cuda" (see below). 25 * Create an [UpdateVersions app version]. Include a file '''app_plan''' containing "cuda". 26 26 * Link the following function into your scheduler: 27 27 {{{ 28 bool app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) { 29 // clients before 6.1.11 don't understand plan_class 30 // 31 int v = sreq.core_client_major_version*10000 32 + sreq.core_client_minor_version*100 33 + sreq.core_client_release; 34 if (v < 60111) return false; 28 bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { 29 if (!strcmp(plan_class, "mt")) { 30 // the following is for an app that can use anywhere 31 // from 1 to 64 threads, can control this exactly, 32 // and whose speedup is .95N 33 // (so on a uniprocessor, we'll use a sequential app 34 // if one is available) 35 // 36 int ncpus, nthreads; 37 bool bounded; 35 38 36 if (!strcmp(plan_class, "cuda_1.1")) { 37 // the following is for an app that uses a CUDA GPU 39 get_ncpus(sreq, ncpus, bounded); 40 nthreads = ncpus; 41 if (nthreads > 64) nthreads = 64; 42 hu.avg_ncpus = nthreads; 43 hu.max_ncpus = nthreads; 44 sprintf(hu.cmdline, "--nthreads %d", nthreads); 45 hu.flops = 0.95*sreq.host.p_fpops*nthreads; 46 return true; 47 } else if (!strcmp(plan_class, "cuda")) { 48 // the following is for an app that uses a CUDA GPU 38 49 // and some CPU also, and gets 50 GFLOPS total 39 50 // 40 51 for (unsigned int i=0; i<sreq.coprocs.coprocs.size(); i++) { 41 52 COPROC* cp = sreq.coprocs.coprocs[i]; 42 if (!strcmp(cp->name, "CUDA")) { 43 COPROC* cu = new COPROC; 44 strcpy(cu->name, cp->name); 53 if (!strcmp(cp->type, "CUDA")) { 54 COPROC* cu = new COPROC (cp->type); 45 55 cu->count = 1; 46 56 hu.coprocs.coprocs.push_back(cu); … … 53 63 } 54 64 } 65 if (config.debug_version_select) { 66 log_messages.printf(MSG_DEBUG, 67 "Host lacks CUDA coprocessor for plan class %s\n", plan_class 68 ); 69 } 55 70 return false; 56 71 } 72 log_messages.printf(MSG_CRITICAL, 73 "Unknown plan class: %s\n", plan_class 74 ); 57 75 return false; 58 76 } 77 59 78 }}} 60 79 == Questions ==