Changes between Version 19 and Version 20 of AppMultiThread


Ignore:
Timestamp:
Apr 1, 2008, 3:35:16 PM (16 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppMultiThread

    v19 v20  
    11= API for multi-thread apps =
    2 
    3 [[T(DesignDocument)]]
    42
    53== Why write a multi-threaded app? ==
     
    2523
    2624Suppose you've developed a multi-threaded program,
    27 and that it achieves a linear speedup on up to 16 processors, and no additional speedup beyond that.
     25and that it achieves a linear speedup on up to 64 processors, and no additional speedup beyond that.
    2826To deploy it:
    2927
     
    3331{{{
    3432bool app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) {
    35     if (!strcmp(plan_class, "par16")) {
    36         if (host.ncpus < 16) {
    37             hu.ncpus = sreq.host.ncpus;
    38             hu.flops = sreq.host.p_fpops*sreq.host.p_ncpus;
    39         } else {
    40             hu.ncpus = 16;
    41             hu.flops = sreq.host.p_fpops*16;
    42         }
     33    // clients before 6.1.11 don't understand plan_class
     34    //
     35    int v = sreq.core_client_major_version*10000
     36        + sreq.core_client_minor_version*100
     37        + sreq.core_client_release;
     38    if (v < 60111) return false;
     39
     40    if (!strcmp(plan_class, "par64")) {
     41        int ncpus, nthreads;
     42        bool bounded;
     43
     44        get_ncpus(sreq, ncpus, bounded);
     45        nthreads = ncpus;
     46        if (nthreads > 64) nthreads = 64;
     47        hu.avg_ncpus = nthreads;
     48        hu.max_ncpus = nthreads;
     49        sprintf(hu.cmdline, "--nthreads %d", nthreads);
     50        hu.flops = 0.95*sreq.host.p_fpops*nthreads;
    4351        return true;
     52
    4453    }
    4554    return false;