Changes between Version 23 and Version 24 of AppMultiThread


Ignore:
Timestamp:
May 29, 2009, 2:48:12 PM (15 years ago)
Author:
davea
Comment:

--

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 =
    42
    53The average number of cores per PC will increase over the next few years,
    64possibly at a faster rate than the average amount of available RAM.
    75
    8 Depending on your application and project, it may be desirable
    9 to develop a multi-threaded application.
     6Depending on your application and project,
     7it may be desirable to develop a multi-thread application.
    108Possible reasons to do this:
    119
     
    2523To deploy it:
    2624
    27  * Choose a "planning class" name for the program, say "par16" (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):
    3028{{{
    31 bool app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) {
     29int app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) {
    3230    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        //
    3336        int ncpus, nthreads;
    3437        bool bounded;
     
    4144        sprintf(hu.cmdline, "--nthreads %d", nthreads);
    4245        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;
    4553    }
    46     return false;
     54    return PLAN_REJECT_UNKNOWN;
    4755}
    4856}}}
     57
     58The BOINC client will schedule applications based
     59on the average CPU usage returned by this function.