| 46 | | Suppose you've developed a multicore program, |
| 47 | | and that it achieves a linear speedup on up to 64 processors, and no additional speedup beyond that. |
| 48 | | To deploy it: |
| 49 | | |
| 50 | | * Choose a "plan class" name for the program, say "mt" (see below). |
| 51 | | * Create an [AppVersionNew app version], specifying its plan class as "mt". |
| 52 | | * Edit the following in sched/sched_customize.cpp if needed: |
| 53 | | {{{ |
| 54 | | // the following is for an app that can use anywhere from 1 to 64 threads |
| 55 | | // |
| 56 | | static inline bool app_plan_mt( |
| 57 | | SCHEDULER_REQUEST& sreq, HOST_USAGE& hu |
| 58 | | ) { |
| 59 | | double ncpus = g_wreq->effective_ncpus; |
| 60 | | // number of usable CPUs, taking user prefs into account |
| 61 | | int nthreads = (int)ncpus; |
| 62 | | if (nthreads > 64) nthreads = 64; |
| 63 | | hu.avg_ncpus = nthreads; |
| 64 | | hu.max_ncpus = nthreads; |
| 65 | | sprintf(hu.cmdline, "--nthreads %d", nthreads); |
| 66 | | hu.projected_flops = sreq.host.p_fpops*hu.avg_ncpus*.99; |
| 67 | | // the .99 ensures that on uniprocessors a sequential app |
| 68 | | // will be used in preferences to this |
| 69 | | hu.peak_flops = sreq.host.p_fpops*hu.avg_ncpus; |
| 70 | | return true; |
| 71 | | } |
| 72 | | |
| 73 | | }}} |