Changes between Version 23 and Version 24 of AppMultiThread
- Timestamp:
- May 29, 2009, 2:48:12 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AppMultiThread
v23 v24 1 = API for multi-thread apps = 2 3 == Why write a multi-threaded app? == 1 = Multi-thread apps = 4 2 5 3 The average number of cores per PC will increase over the next few years, 6 4 possibly at a faster rate than the average amount of available RAM. 7 5 8 Depending on your application and project, it may be desirable9 to develop a multi-threaded application.6 Depending on your application and project, 7 it may be desirable to develop a multi-thread application. 10 8 Possible reasons to do this: 11 9 … … 25 23 To deploy it: 26 24 27 * Choose a "planning class" name for the program, say "par 16" (see below).28 * Create an [UpdateVersions app version] . Include a file '''app_plan''' containing "par16".29 * Link the following function into your scheduler :25 * Choose a "planning class" name for the program, say "par64" (see below). 26 * Create an [UpdateVersions app version], specifying its plan class as "par64". 27 * Link the following function into your scheduler (customized as needed): 30 28 {{{ 31 boolapp_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) {29 int app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) { 32 30 if (!strcmp(plan_class, "par64")) { 31 // the following is for an app that can use anywhere 32 // from 1 to 64 threads, can control this exactly, 33 // and whose speedup is .95N 34 // (on a uniprocessor, we'll use a sequential app if one is available) 35 // 33 36 int ncpus, nthreads; 34 37 bool bounded; … … 41 44 sprintf(hu.cmdline, "--nthreads %d", nthreads); 42 45 hu.flops = 0.95*sreq.host.p_fpops*nthreads; 43 return true; 44 46 if (config.debug_version_select) { 47 log_messages.printf(MSG_NORMAL, 48 "[version] Multi-thread app estimate %.2f GFLOPS\n", 49 hu.flops/1e9 50 ); 51 } 52 return 0; 45 53 } 46 return false;54 return PLAN_REJECT_UNKNOWN; 47 55 } 48 56 }}} 57 58 The BOINC client will schedule applications based 59 on the average CPU usage returned by this function.