bound.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2011 Télécom-SudParis
  5. * Copyright (C) 2013 Thibaut Lambert
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. /*
  19. * Record which kinds of tasks have been executed, to later on compute an upper
  20. * bound of the performance that could have theoretically been achieved
  21. */
  22. #include <starpu.h>
  23. #include <starpu_config.h>
  24. #include <profiling/bound.h>
  25. #include <core/jobs.h>
  26. #include <core/workers.h>
  27. #include <datawizard/memory_nodes.h>
  28. #ifdef STARPU_HAVE_GLPK_H
  29. #include <glpk.h>
  30. #endif /* STARPU_HAVE_GLPK_H */
  31. /* TODO: output duration between starpu_bound_start and starpu_bound_stop */
  32. /* TODO: compute critical path and introduce it in the LP */
  33. /*
  34. * Record without dependencies: just count each kind of task
  35. *
  36. * The linear programming problem will just have as variables:
  37. * - the number of tasks of kind `t' executed by worker `w'
  38. * - the total duration
  39. *
  40. * and the constraints will be:
  41. * - the time taken by each worker to complete its assigned tasks is lower than
  42. * the total duration.
  43. * - the total numer of tasks of a given kind is equal to the number run by the
  44. * application.
  45. */
  46. struct bound_task_pool
  47. {
  48. /* Which codelet has been executed */
  49. struct starpu_codelet *cl;
  50. /* Task footprint key (for history-based perfmodel) */
  51. uint32_t footprint;
  52. /* Number of tasks of this kind */
  53. unsigned long n;
  54. /* Other task kinds */
  55. struct bound_task_pool *next;
  56. };
  57. /*
  58. * Record with dependencies: each task is recorded separately
  59. *
  60. * The linear programming problem will have as variables:
  61. * - The start time of each task
  62. * - The completion time of each tag
  63. * - The total duration
  64. * - For each task and for each worker, whether the task is executing on that worker.
  65. * - For each pair of task, which task is scheduled first.
  66. *
  67. * and the constraints will be:
  68. * - All task start time plus duration are less than total duration
  69. * - Each task is executed on exactly one worker.
  70. * - Each task starts after all its task dependencies finish.
  71. * - Each task starts after all its tag dependencies finish.
  72. * - For each task pair and each worker, if both tasks are executed by that worker,
  73. * one is started after the other's completion.
  74. */
  75. struct task_dep
  76. {
  77. /* Task this depends on */
  78. struct bound_task *dep;
  79. /* Data transferred between tasks (i.e. implicit data dep size) */
  80. size_t size;
  81. };
  82. struct bound_task
  83. {
  84. /* Unique ID */
  85. unsigned long id;
  86. /* Tag ID, if any */
  87. starpu_tag_t tag_id;
  88. int use_tag;
  89. /* Which codelet has been executed */
  90. struct starpu_codelet *cl;
  91. /* Task footprint key */
  92. uint32_t footprint;
  93. /* Task priority */
  94. int priority;
  95. /* Tasks this one depends on */
  96. struct task_dep *deps;
  97. int depsn;
  98. /* Estimated duration */
  99. double** duration[STARPU_NARCH];
  100. /* Other tasks */
  101. struct bound_task *next;
  102. };
  103. struct bound_tag_dep
  104. {
  105. starpu_tag_t tag;
  106. starpu_tag_t dep_tag;
  107. struct bound_tag_dep *next;
  108. };
  109. static struct bound_task_pool *task_pools, *last;
  110. static struct bound_task *tasks;
  111. static struct bound_tag_dep *tag_deps;
  112. int _starpu_bound_recording;
  113. static int recorddeps;
  114. static int recordprio;
  115. static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
  116. static void _starpu_bound_clear(int record, int deps, int prio)
  117. {
  118. struct bound_task_pool *tp;
  119. struct bound_task *t;
  120. struct bound_tag_dep *td;
  121. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  122. tp = task_pools;
  123. task_pools = NULL;
  124. last = NULL;
  125. t = tasks;
  126. tasks = NULL;
  127. td = tag_deps;
  128. tag_deps = NULL;
  129. _starpu_bound_recording = record;
  130. recorddeps = deps;
  131. recordprio = prio;
  132. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  133. while (tp != NULL)
  134. {
  135. struct bound_task_pool *next = tp->next;
  136. free(tp);
  137. tp = next;
  138. }
  139. while (t != NULL)
  140. {
  141. struct bound_task *next = t->next;
  142. unsigned i,j;
  143. for (i = 0; i < STARPU_NARCH; i++)
  144. {
  145. if (t->duration[i])
  146. {
  147. for (j = 0; t->duration[i][j]; j++)
  148. free(t->duration[i][j]);
  149. free(t->duration[i]);
  150. }
  151. }
  152. free(t->deps);
  153. free(t);
  154. t = next;
  155. }
  156. while (td != NULL)
  157. {
  158. struct bound_tag_dep *next = td->next;
  159. free(td);
  160. td = next;
  161. }
  162. }
  163. void starpu_bound_clear(void)
  164. {
  165. _starpu_bound_clear(0, 0, 0);
  166. }
  167. /* Initialization */
  168. void starpu_bound_start(int deps, int prio)
  169. {
  170. _starpu_bound_clear(1, deps, prio);
  171. }
  172. /* Whether we will include it in the computation */
  173. static int good_job(struct _starpu_job *j)
  174. {
  175. /* No codelet, nothing to measure */
  176. if (j->exclude_from_dag)
  177. return 0;
  178. if (!j->task->cl)
  179. return 0;
  180. /* No performance model, no time duration estimation */
  181. if (!j->task->cl->model)
  182. return 0;
  183. /* Only support history based */
  184. if (j->task->cl->model->type != STARPU_HISTORY_BASED
  185. && j->task->cl->model->type != STARPU_NL_REGRESSION_BASED)
  186. return 0;
  187. return 1;
  188. }
  189. static double** initialize_arch_duration(int maxdevid, unsigned* maxncore_table)
  190. {
  191. int devid, maxncore;
  192. double ** arch_model;
  193. _STARPU_MALLOC(arch_model, sizeof(*arch_model)*(maxdevid+1));
  194. arch_model[maxdevid] = NULL;
  195. for(devid=0; devid<maxdevid; devid++)
  196. {
  197. if(maxncore_table != NULL)
  198. maxncore = maxncore_table[devid];
  199. else
  200. maxncore = 1;
  201. _STARPU_CALLOC(arch_model[devid], maxncore+1,sizeof(*arch_model[devid]));
  202. }
  203. return arch_model;
  204. }
  205. static void initialize_duration(struct bound_task *task)
  206. {
  207. struct _starpu_machine_config *conf = _starpu_get_machine_config();
  208. task->duration[STARPU_CPU_WORKER] = initialize_arch_duration(1,&conf->topology.nhwcpus);
  209. task->duration[STARPU_CUDA_WORKER] = initialize_arch_duration(conf->topology.nhwcudagpus,NULL);
  210. task->duration[STARPU_OPENCL_WORKER] = initialize_arch_duration(conf->topology.nhwopenclgpus,NULL);
  211. task->duration[STARPU_MIC_WORKER] = initialize_arch_duration(conf->topology.nhwmicdevices,conf->topology.nmiccores);
  212. task->duration[STARPU_MPI_MS_WORKER] = initialize_arch_duration(conf->topology.nhwmpidevices,conf->topology.nmpicores);
  213. }
  214. static struct starpu_perfmodel_device device =
  215. {
  216. .type = STARPU_CPU_WORKER,
  217. .devid = 0,
  218. .ncores = 1,
  219. };
  220. static struct starpu_perfmodel_arch dumb_arch =
  221. {
  222. .ndevices = 1,
  223. .devices = &device,
  224. };
  225. /* Create a new task (either because it has just been submitted, or a
  226. * dependency was added before submission) */
  227. static void new_task(struct _starpu_job *j)
  228. {
  229. struct bound_task *t;
  230. if (j->bound_task)
  231. return;
  232. _STARPU_CALLOC(t, 1, sizeof(*t));
  233. t->id = j->job_id;
  234. t->tag_id = j->task->tag_id;
  235. t->use_tag = j->task->use_tag;
  236. t->cl = j->task->cl;
  237. t->footprint = _starpu_compute_buffers_footprint(j->task->cl?j->task->cl->model:NULL, &dumb_arch, 0, j);
  238. t->priority = j->task->priority;
  239. t->deps = NULL;
  240. t->depsn = 0;
  241. initialize_duration(t);
  242. t->next = tasks;
  243. j->bound_task = t;
  244. tasks = t;
  245. }
  246. /* A new task was submitted, record it */
  247. void _starpu_bound_record(struct _starpu_job *j)
  248. {
  249. if (STARPU_LIKELY(!_starpu_bound_recording))
  250. return;
  251. if (!good_job(j))
  252. return;
  253. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  254. /* Re-check, this time with mutex held */
  255. if (!_starpu_bound_recording)
  256. {
  257. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  258. return;
  259. }
  260. if (recorddeps)
  261. {
  262. new_task(j);
  263. }
  264. else
  265. {
  266. struct bound_task_pool *tp;
  267. _starpu_compute_buffers_footprint(j->task->cl?j->task->cl->model:NULL, NULL, 0, j);
  268. if (last && last->cl == j->task->cl && last->footprint == j->footprint)
  269. tp = last;
  270. else
  271. for (tp = task_pools; tp; tp = tp->next)
  272. if (tp->cl == j->task->cl && tp->footprint == j->footprint)
  273. break;
  274. if (!tp)
  275. {
  276. _STARPU_MALLOC(tp, sizeof(*tp));
  277. tp->cl = j->task->cl;
  278. tp->footprint = j->footprint;
  279. tp->n = 0;
  280. tp->next = task_pools;
  281. task_pools = tp;
  282. }
  283. /* One more task of this kind */
  284. tp->n++;
  285. }
  286. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  287. }
  288. /* A tag dependency was emitted, record it */
  289. void _starpu_bound_tag_dep(starpu_tag_t id, starpu_tag_t dep_id)
  290. {
  291. struct bound_tag_dep *td;
  292. if (!_starpu_bound_recording || !recorddeps)
  293. return;
  294. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  295. /* Re-check, this time with mutex held */
  296. if (!_starpu_bound_recording || !recorddeps)
  297. {
  298. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  299. return;
  300. }
  301. _STARPU_MALLOC(td, sizeof(*td));
  302. td->tag = id;
  303. td->dep_tag = dep_id;
  304. td->next = tag_deps;
  305. tag_deps = td;
  306. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  307. }
  308. /* A task dependency was emitted, record it */
  309. void _starpu_bound_task_dep(struct _starpu_job *j, struct _starpu_job *dep_j)
  310. {
  311. struct bound_task *t;
  312. int i;
  313. if (!_starpu_bound_recording || !recorddeps)
  314. return;
  315. if (!good_job(j) || !good_job(dep_j))
  316. return;
  317. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  318. /* Re-check, this time with mutex held */
  319. if (!_starpu_bound_recording || !recorddeps)
  320. {
  321. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  322. return;
  323. }
  324. new_task(j);
  325. new_task(dep_j);
  326. t = j->bound_task;
  327. for (i = 0; i < t->depsn; i++)
  328. if (t->deps[i].dep == dep_j->bound_task)
  329. break;
  330. if (i == t->depsn)
  331. {
  332. /* Not already there, add */
  333. _STARPU_REALLOC(t->deps, ++t->depsn * sizeof(t->deps[0]));
  334. t->deps[t->depsn-1].dep = dep_j->bound_task;
  335. t->deps[t->depsn-1].size = 0; /* We don't have data information in that case */
  336. }
  337. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  338. }
  339. /* Look for job with id ID among our tasks */
  340. static struct bound_task *find_job(unsigned long id)
  341. {
  342. struct bound_task *t;
  343. for (t = tasks; t; t = t->next)
  344. if (t->id == id)
  345. return t;
  346. return NULL;
  347. }
  348. /* Job J depends on previous job of id ID (which is already finished) */
  349. void _starpu_bound_job_id_dep_size(size_t size, struct _starpu_job *j, unsigned long id)
  350. {
  351. struct bound_task *t, *dep_t;
  352. int i;
  353. if (!_starpu_bound_recording || !recorddeps)
  354. return;
  355. if (!good_job(j))
  356. return;
  357. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  358. /* Re-check, this time with mutex held */
  359. if (!_starpu_bound_recording || !recorddeps)
  360. {
  361. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  362. return;
  363. }
  364. new_task(j);
  365. dep_t = find_job(id);
  366. if (!dep_t)
  367. {
  368. _STARPU_MSG("dependency %lu not found !\n", id);
  369. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  370. return;
  371. }
  372. t = j->bound_task;
  373. for (i = 0; i < t->depsn; i++)
  374. if (t->deps[i].dep == dep_t)
  375. {
  376. /* Found, just add size */
  377. t->deps[i].size += size;
  378. break;
  379. }
  380. if (i == t->depsn)
  381. {
  382. /* Not already there, add */
  383. _STARPU_REALLOC(t->deps, ++t->depsn * sizeof(t->deps[0]));
  384. t->deps[t->depsn-1].dep = dep_t;
  385. t->deps[t->depsn-1].size = size;
  386. }
  387. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  388. }
  389. void _starpu_bound_job_id_dep(starpu_data_handle_t handle, struct _starpu_job *j, unsigned long id)
  390. {
  391. if (!_starpu_bound_recording || !recorddeps)
  392. return;
  393. if (!good_job(j))
  394. return;
  395. _starpu_bound_job_id_dep_size(_starpu_data_get_size(handle), j, id);
  396. }
  397. void starpu_bound_stop(void)
  398. {
  399. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  400. _starpu_bound_recording = 0;
  401. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  402. }
  403. /* Compute all tasks times on all workers */
  404. static void _starpu_get_tasks_times(int nw, int nt, double *times)
  405. {
  406. struct bound_task_pool *tp;
  407. int w, t;
  408. for (w = 0; w < nw; w++)
  409. {
  410. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  411. {
  412. struct _starpu_job j =
  413. {
  414. .footprint = tp->footprint,
  415. .footprint_is_computed = 1,
  416. };
  417. struct starpu_perfmodel_arch* arch = starpu_worker_get_perf_archtype(w, STARPU_NMAX_SCHED_CTXS);
  418. double length = _starpu_history_based_job_expected_perf(tp->cl->model, arch, &j, j.nimpl);
  419. if (isnan(length))
  420. times[w*nt+t] = NAN;
  421. else
  422. times[w*nt+t] = length / 1000.;
  423. }
  424. }
  425. }
  426. /* Return whether PARENT is an ancestor of CHILD */
  427. static int ancestor(struct bound_task *child, struct bound_task *parent)
  428. {
  429. int i;
  430. for (i = 0; i < child->depsn; i++)
  431. {
  432. if (parent == child->deps[i].dep)
  433. return 1;
  434. if (ancestor(child->deps[i].dep, parent))
  435. return -1;
  436. }
  437. return 0;
  438. }
  439. /* Print bound recording in .dot format */
  440. void starpu_bound_print_dot(FILE *output)
  441. {
  442. struct bound_task *t;
  443. struct bound_tag_dep *td;
  444. int i;
  445. if (!recorddeps)
  446. {
  447. fprintf(output, "Not supported\n");
  448. return;
  449. }
  450. fprintf(output, "strict digraph bounddeps {\n");
  451. for (t = tasks; t; t = t->next)
  452. {
  453. fprintf(output, "\"t%lu\" [label=\"%lu: %s\"]\n", t->id, t->id, _starpu_codelet_get_model_name(t->cl));
  454. for (i = 0; i < t->depsn; i++)
  455. fprintf(output, "\"t%lu\" -> \"t%lu\"\n", t->deps[i].dep->id, t->id);
  456. }
  457. for (td = tag_deps; td; td = td->next)
  458. fprintf(output, "\"tag%lu\" -> \"tag%lu\";\n", (unsigned long) td->dep_tag, (unsigned long) td->tag);
  459. fprintf(output, "}\n");
  460. }
  461. /*
  462. * Print bound system in lp_solve format
  463. *
  464. * When dependencies are enabled, you can check the set of tasks and deps that
  465. * were recorded by using tools/lp2paje and vite.
  466. */
  467. void starpu_bound_print_lp(FILE *output)
  468. {
  469. int nt; /* Number of different kinds of tasks */
  470. int nw; /* Number of different workers */
  471. int t;
  472. int w, w2; /* worker */
  473. unsigned n, n2;
  474. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  475. nw = starpu_worker_get_count();
  476. if (!nw)
  477. /* Make llvm happy about the VLA below */
  478. return;
  479. if (recorddeps)
  480. {
  481. struct bound_task *t1, *t2;
  482. struct bound_tag_dep *td;
  483. int i;
  484. nt = 0;
  485. for (t1 = tasks; t1; t1 = t1->next)
  486. {
  487. if (t1->cl->model->type != STARPU_HISTORY_BASED &&
  488. t1->cl->model->type != STARPU_NL_REGRESSION_BASED)
  489. /* TODO: */
  490. _STARPU_MSG("Warning: task %s uses a perf model which is neither history nor non-linear regression-based, support for such model is not implemented yet, system will not be solvable.\n", _starpu_codelet_get_model_name(t1->cl));
  491. struct _starpu_job j =
  492. {
  493. .footprint = t1->footprint,
  494. .footprint_is_computed = 1,
  495. };
  496. for (w = 0; w < nw; w++)
  497. {
  498. struct starpu_perfmodel_arch* arch = starpu_worker_get_perf_archtype(w, STARPU_NMAX_SCHED_CTXS);
  499. if (_STARPU_IS_ZERO(t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores]))
  500. {
  501. double length = _starpu_history_based_job_expected_perf(t1->cl->model, arch, &j,j.nimpl);
  502. if (isnan(length))
  503. /* Avoid problems with binary coding of doubles */
  504. t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores] = NAN;
  505. else
  506. t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores] = length / 1000.;
  507. }
  508. }
  509. nt++;
  510. }
  511. if (!nt)
  512. return;
  513. fprintf(output, "/* StarPU upper bound linear programming problem, to be run in lp_solve. */\n\n");
  514. fprintf(output, "/* !! This is a big system, it will be long to solve !! */\n\n");
  515. fprintf(output, "/* We want to minimize total execution time (ms) */\n");
  516. fprintf(output, "min: tmax;\n\n");
  517. fprintf(output, "/* Number of tasks */\n");
  518. fprintf(output, "nt = %d;\n", nt);
  519. fprintf(output, "/* Number of workers */\n");
  520. fprintf(output, "nw = %d;\n", nw);
  521. fprintf(output, "/* The total execution time is the maximum of all task completion times (ms) */\n");
  522. for (t1 = tasks; t1; t1 = t1->next)
  523. fprintf(output, "c%lu <= tmax;\n", t1->id);
  524. fprintf(output, "\n/* We have tasks executing on workers, exactly one worker executes each task */\n");
  525. for (t1 = tasks; t1; t1 = t1->next)
  526. {
  527. for (w = 0; w < nw; w++)
  528. {
  529. struct starpu_perfmodel_arch* arch = starpu_worker_get_perf_archtype(w, STARPU_NMAX_SCHED_CTXS);
  530. if (!isnan(t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores]))
  531. fprintf(output, " +t%luw%d", t1->id, w);
  532. }
  533. fprintf(output, " = 1;\n");
  534. }
  535. fprintf(output, "\n/* Completion time is start time plus computation time */\n");
  536. fprintf(output, "/* According to where the task is indeed executed */\n");
  537. for (t1 = tasks; t1; t1 = t1->next)
  538. {
  539. fprintf(output, "/* %s %x */\tc%lu = s%lu", _starpu_codelet_get_model_name(t1->cl), (unsigned) t1->footprint, t1->id, t1->id);
  540. for (w = 0; w < nw; w++)
  541. {
  542. struct starpu_perfmodel_arch* arch = starpu_worker_get_perf_archtype(w, STARPU_NMAX_SCHED_CTXS);
  543. if (!isnan(t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores]))
  544. fprintf(output, " + %f t%luw%d", t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores], t1->id, w);
  545. }
  546. fprintf(output, ";\n");
  547. }
  548. fprintf(output, "\n/* Each task starts after all its task dependencies finish and data is transferred. */\n");
  549. fprintf(output, "/* Note that the dependency finish time depends on the worker where it's working */\n");
  550. for (t1 = tasks; t1; t1 = t1->next)
  551. for (i = 0; i < t1->depsn; i++)
  552. {
  553. fprintf(output, "/* %lu bytes transferred */\n", (unsigned long) t1->deps[i].size);
  554. fprintf(output, "s%lu >= c%lu", t1->id, t1->deps[i].dep->id);
  555. /* Transfer time: pick up one source node and a worker on it */
  556. for (n = 0; n < starpu_memory_nodes_get_count(); n++)
  557. for (w = 0; w < nw; w++)
  558. if (starpu_worker_get_memory_node(w) == n)
  559. {
  560. /* pick up another destination node and a worker on it */
  561. for (n2 = 0; n2 < starpu_memory_nodes_get_count(); n2++)
  562. if (n2 != n)
  563. {
  564. for (w2 = 0; w2 < nw; w2++)
  565. if (starpu_worker_get_memory_node(w2) == n2)
  566. {
  567. /* If predecessor is on worker w and successor
  568. * on worker w2 on different nodes, we need to
  569. * transfer the data. */
  570. fprintf(output, " + d_t%luw%dt%luw%d", t1->deps[i].dep->id, w, t1->id, w2);
  571. }
  572. }
  573. }
  574. fprintf(output, ";\n");
  575. /* Transfer time: pick up one source node and a worker on it */
  576. for (n = 0; n < starpu_memory_nodes_get_count(); n++)
  577. for (w = 0; w < nw; w++)
  578. if (starpu_worker_get_memory_node(w) == n)
  579. {
  580. /* pick up another destination node and a worker on it */
  581. for (n2 = 0; n2 < starpu_memory_nodes_get_count(); n2++)
  582. if (n2 != n)
  583. {
  584. for (w2 = 0; w2 < nw; w2++)
  585. if (starpu_worker_get_memory_node(w2) == n2)
  586. {
  587. /* The data transfer is at least 0ms */
  588. fprintf(output, "d_t%luw%dt%luw%d >= 0;\n", t1->deps[i].dep->id, w, t1->id, w2);
  589. /* The data transfer from w to w2 only happens if tasks run there */
  590. fprintf(output, "d_t%luw%dt%luw%d >= %f - 2e5 + 1e5 t%luw%d + 1e5 t%luw%d;\n",
  591. t1->deps[i].dep->id, w, t1->id, w2,
  592. starpu_transfer_predict(n, n2, t1->deps[i].size)/1000.,
  593. t1->deps[i].dep->id, w, t1->id, w2);
  594. }
  595. }
  596. }
  597. }
  598. fprintf(output, "\n/* Each tag finishes when its corresponding task finishes */\n");
  599. for (t1 = tasks; t1; t1 = t1->next)
  600. if (t1->use_tag)
  601. {
  602. for (w = 0; w < nw; w++)
  603. fprintf(output, "c%lu = tag%lu;\n", t1->id, (unsigned long) t1->tag_id);
  604. }
  605. fprintf(output, "\n/* tags start after all their tag dependencies finish. */\n");
  606. for (td = tag_deps; td; td = td->next)
  607. fprintf(output, "tag%lu >= tag%lu;\n", (unsigned long) td->tag, (unsigned long) td->dep_tag);
  608. /* TODO: factorize ancestor calls */
  609. fprintf(output, "\n/* For each task pair and each worker, if both tasks are executed by the same worker,\n");
  610. fprintf(output, " one is started after the other's completion */\n");
  611. for (t1 = tasks; t1; t1 = t1->next)
  612. {
  613. for (t2 = t1->next; t2; t2 = t2->next)
  614. {
  615. if (!ancestor(t1, t2) && !ancestor(t2, t1))
  616. {
  617. for (w = 0; w < nw; w++)
  618. {
  619. struct starpu_perfmodel_arch* arch = starpu_worker_get_perf_archtype(w, STARPU_NMAX_SCHED_CTXS);
  620. if (!isnan(t1->duration[arch->devices[0].type][arch->devices[0].devid][arch->devices[0].ncores]))
  621. {
  622. fprintf(output, "s%lu - c%lu >= -3e5 + 1e5 t%luw%d + 1e5 t%luw%d + 1e5 t%luafter%lu;\n",
  623. t1->id, t2->id, t1->id, w, t2->id, w, t1->id, t2->id);
  624. fprintf(output, "s%lu - c%lu >= -2e5 + 1e5 t%luw%d + 1e5 t%luw%d - 1e5 t%luafter%lu;\n",
  625. t2->id, t1->id, t1->id, w, t2->id, w, t1->id, t2->id);
  626. }
  627. }
  628. }
  629. }
  630. }
  631. #if 0
  632. /* Doesn't help at all to actually express what "after" means */
  633. for (t1 = tasks; t1; t1 = t1->next)
  634. for (t2 = t1->next; t2; t2 = t2->next)
  635. if (!ancestor(t1, t2) && !ancestor(t2, t1))
  636. {
  637. fprintf(output, "s%lu - s%lu >= -1e5 + 1e5 t%luafter%lu;\n", t1->id, t2->id, t1->id, t2->id);
  638. fprintf(output, "s%lu - s%lu >= -1e5 t%luafter%lu;\n", t2->id, t1->id, t1->id, t2->id);
  639. }
  640. #endif
  641. if (recordprio)
  642. {
  643. fprintf(output, "\n/* For StarPU, a priority means given schedulable tasks it will consider the\n");
  644. fprintf(output, " * more prioritized first */\n");
  645. for (t1 = tasks; t1; t1 = t1->next)
  646. {
  647. for (t2 = t1->next; t2; t2 = t2->next)
  648. {
  649. if (!ancestor(t1, t2) && !ancestor(t2, t1)
  650. && t1->priority != t2->priority)
  651. {
  652. if (t1->priority > t2->priority)
  653. {
  654. /* Either t2 is scheduled before t1, but then it
  655. needs to be scheduled before some t dep finishes */
  656. /* One of the t1 deps to give the maximum start time for t2 */
  657. if (t1->depsn > 1)
  658. {
  659. for (i = 0; i < t1->depsn; i++)
  660. fprintf(output, " + t%lut%lud%d", t2->id, t1->id, i);
  661. fprintf(output, " = 1;\n");
  662. }
  663. for (i = 0; i < t1->depsn; i++)
  664. {
  665. fprintf(output, "c%lu - s%lu >= ", t1->deps[i].dep->id, t2->id);
  666. if (t1->depsn > 1)
  667. /* Only checks this when it's this dependency that is chosen */
  668. fprintf(output, "-2e5 + 1e5 t%lut%lud%d", t2->id, t1->id, i);
  669. else
  670. fprintf(output, "-1e5");
  671. /* Only check this if t1 is after t2 */
  672. fprintf(output, " + 1e5 t%luafter%lu", t1->id, t2->id);
  673. fprintf(output, ";\n");
  674. }
  675. /* Or t2 is scheduled after t1 is. */
  676. fprintf(output, "s%lu - s%lu >= -1e5 t%luafter%lu;\n", t2->id, t1->id, t1->id, t2->id);
  677. }
  678. else
  679. {
  680. /* Either t1 is scheduled before t2, but then it
  681. needs to be scheduled before some t2 dep finishes */
  682. /* One of the t2 deps to give the maximum start time for t1 */
  683. if (t2->depsn > 1)
  684. {
  685. for (i = 0; i < t2->depsn; i++)
  686. fprintf(output, " + t%lut%lud%d", t1->id, t2->id, i);
  687. fprintf(output, " = 1;\n");
  688. }
  689. for (i = 0; i < t2->depsn; i++)
  690. {
  691. fprintf(output, "c%lu - s%lu >= ", t2->deps[i].dep->id, t1->id);
  692. if (t2->depsn > 1)
  693. /* Only checks this when it's this dependency that is chosen */
  694. fprintf(output, "-1e5 + 1e5 t%lut%lud%d", t1->id, t2->id, i);
  695. /* Only check this if t2 is after t1 */
  696. fprintf(output, " - 1e5 t%luafter%lu;\n", t1->id, t2->id);
  697. }
  698. /* Or t1 is scheduled after t2 is. */
  699. fprintf(output, "s%lu - s%lu >= -1e5 + 1e5 t%luafter%lu;\n", t1->id, t2->id, t1->id, t2->id);
  700. }
  701. }
  702. }
  703. }
  704. }
  705. for (t1 = tasks; t1; t1 = t1->next)
  706. for (t2 = t1->next; t2; t2 = t2->next)
  707. if (!ancestor(t1, t2) && !ancestor(t2, t1))
  708. {
  709. fprintf(output, "bin t%luafter%lu;\n", t1->id, t2->id);
  710. if (recordprio && t1->priority != t2->priority)
  711. {
  712. if (t1->priority > t2->priority)
  713. {
  714. if (t1->depsn > 1)
  715. for (i = 0; i < t1->depsn; i++)
  716. fprintf(output, "bin t%lut%lud%d;\n", t2->id, t1->id, i);
  717. }
  718. else
  719. {
  720. if (t2->depsn > 1)
  721. for (i = 0; i < t2->depsn; i++)
  722. fprintf(output, "bin t%lut%lud%d;\n", t1->id, t2->id, i);
  723. }
  724. }
  725. }
  726. for (t1 = tasks; t1; t1 = t1->next)
  727. for (w = 0; w < nw; w++)
  728. fprintf(output, "bin t%luw%d;\n", t1->id, w);
  729. }
  730. else
  731. {
  732. struct bound_task_pool *tp;
  733. nt = 0;
  734. for (tp = task_pools; tp; tp = tp->next)
  735. nt++;
  736. if (!nt)
  737. return;
  738. {
  739. double times[nw*nt];
  740. _starpu_get_tasks_times(nw, nt, times);
  741. fprintf(output, "/* StarPU upper bound linear programming problem, to be run in lp_solve. */\n\n");
  742. fprintf(output, "/* We want to minimize total execution time (ms) */\n");
  743. fprintf(output, "min: tmax;\n\n");
  744. fprintf(output, "/* Which is the maximum of all worker execution times (ms) */\n");
  745. for (w = 0; w < nw; w++)
  746. {
  747. char name[32];
  748. starpu_worker_get_name(w, name, sizeof(name));
  749. fprintf(output, "/* worker %s */\n0", name);
  750. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  751. {
  752. if (!isnan(times[w*nt+t]))
  753. fprintf(output, "\t%+f * w%dt%dn", (float) times[w*nt+t], w, t);
  754. }
  755. fprintf(output, " <= tmax;\n");
  756. }
  757. fprintf(output, "\n");
  758. fprintf(output, "/* And we have to have computed exactly all tasks */\n");
  759. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  760. {
  761. int got_one = 0;
  762. fprintf(output, "/* task %s key %x */\n0", _starpu_codelet_get_model_name(tp->cl), (unsigned) tp->footprint);
  763. for (w = 0; w < nw; w++)
  764. {
  765. if (isnan(times[w*nt+t]))
  766. _STARPU_MSG("Warning: task %s has no performance measurement for worker %d.\n", _starpu_codelet_get_model_name(tp->cl), w);
  767. else
  768. {
  769. got_one = 1;
  770. fprintf(output, "\t+w%dt%dn", w, t);
  771. }
  772. }
  773. fprintf(output, " = %lu;\n", tp->n);
  774. if (!got_one)
  775. _STARPU_MSG("Warning: task %s has no performance measurement for any worker, system will not be solvable!\n", _starpu_codelet_get_model_name(tp->cl));
  776. /* Show actual values */
  777. fprintf(output, "/*");
  778. for (w = 0; w < nw; w++)
  779. fprintf(output, "\t+%lu", tp->cl->per_worker_stats[w]);
  780. fprintf(output, "\t*/\n\n");
  781. }
  782. fprintf(output, "/* Optionally tell that tasks can not be divided */\n");
  783. fprintf(output, "/* int ");
  784. int first = 1;
  785. for (w = 0; w < nw; w++)
  786. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  787. {
  788. if (!first)
  789. fprintf(output, ",");
  790. else
  791. first = 0;
  792. fprintf(output, "w%dt%dn", w, t);
  793. }
  794. fprintf(output, "; */\n");
  795. }
  796. }
  797. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  798. }
  799. /*
  800. * Print bound system in MPS output format
  801. */
  802. void starpu_bound_print_mps(FILE *output)
  803. {
  804. struct bound_task_pool * tp;
  805. int nt; /* Number of different kinds of tasks */
  806. int nw; /* Number of different workers */
  807. int t, w;
  808. if (recorddeps)
  809. {
  810. fprintf(output, "Not supported\n");
  811. return;
  812. }
  813. nw = starpu_worker_get_count();
  814. if (!nw)
  815. /* Make llvm happy about the VLA below */
  816. return;
  817. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  818. nt = 0;
  819. for (tp = task_pools; tp; tp = tp->next)
  820. nt++;
  821. if (!nt)
  822. {
  823. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  824. return;
  825. }
  826. {
  827. double times[nw*nt];
  828. _starpu_get_tasks_times(nw, nt, times);
  829. fprintf(output, "NAME StarPU theoretical bound\n");
  830. fprintf(output, "*\nROWS\n");
  831. fprintf(output, "* We want to minimize total execution time (ms)\n");
  832. fprintf(output, " N TMAX\n");
  833. fprintf(output, "* Which is the maximum of all worker execution times (ms)\n");
  834. for (w = 0; w < nw; w++)
  835. {
  836. char name[32];
  837. starpu_worker_get_name(w, name, sizeof(name));
  838. fprintf(output, "* worker %s\n", name);
  839. fprintf(output, " L W%d\n", w);
  840. }
  841. fprintf(output, "*\n* And we have to have computed exactly all tasks\n*\n");
  842. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  843. {
  844. fprintf(output, "* task %s key %x\n", _starpu_codelet_get_model_name(tp->cl), (unsigned) tp->footprint);
  845. fprintf(output, " E T%d\n", t);
  846. }
  847. fprintf(output, "*\nCOLUMNS\n*\n");
  848. fprintf(output, "*\n* Execution times and completion of all tasks\n*\n");
  849. for (w = 0; w < nw; w++)
  850. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  851. if (!isnan(times[w*nt+t]))
  852. {
  853. char name[23];
  854. snprintf(name, sizeof(name), "W%dT%d", w, t);
  855. fprintf(output," %-8s W%-7d %12f\n", name, w, times[w*nt+t]);
  856. fprintf(output," %-8s T%-7d %12d\n", name, t, 1);
  857. }
  858. fprintf(output, "*\n* Total execution time\n*\n");
  859. for (w = 0; w < nw; w++)
  860. fprintf(output," TMAX W%-2d %12d\n", w, -1);
  861. fprintf(output," TMAX TMAX %12d\n", 1);
  862. fprintf(output, "*\nRHS\n*\n");
  863. fprintf(output, "*\n* Total number of tasks\n*\n");
  864. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  865. fprintf(output," NT%-2d T%-7d %12lu\n", t, t, tp->n);
  866. fprintf(output, "ENDATA\n");
  867. }
  868. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  869. }
  870. /*
  871. * Solve bound system thanks to GNU Linear Programming Kit backend
  872. */
  873. #ifdef STARPU_HAVE_GLPK_H
  874. static glp_prob *_starpu_bound_glp_resolve(int integer)
  875. {
  876. struct bound_task_pool * tp;
  877. int nt; /* Number of different kinds of tasks */
  878. int nw; /* Number of different workers */
  879. int t, w;
  880. glp_prob *lp;
  881. int ret;
  882. nw = starpu_worker_get_count();
  883. if (!nw)
  884. /* Make llvm happy about the VLA below */
  885. return NULL;
  886. nt = 0;
  887. for (tp = task_pools; tp; tp = tp->next)
  888. nt++;
  889. if (!nt)
  890. return NULL;
  891. lp = glp_create_prob();
  892. glp_set_prob_name(lp, "StarPU theoretical bound");
  893. glp_set_obj_dir(lp, GLP_MIN);
  894. glp_set_obj_name(lp, "total execution time");
  895. {
  896. double times[nw*nt];
  897. int ne =
  898. nw * (nt+1) /* worker execution time */
  899. + nt * nw
  900. + 1; /* glp dumbness */
  901. int n = 1;
  902. int ia[ne], ja[ne];
  903. double ar[ne];
  904. _starpu_get_tasks_times(nw, nt, times);
  905. /* Variables: number of tasks i assigned to worker j, and tmax */
  906. glp_add_cols(lp, nw*nt+1);
  907. #define colnum(w, t) ((t)*nw+(w)+1)
  908. glp_set_obj_coef(lp, nw*nt+1, 1.);
  909. for (w = 0; w < nw; w++)
  910. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  911. {
  912. char name[32];
  913. snprintf(name, sizeof(name), "w%dt%dn", w, t);
  914. glp_set_col_name(lp, colnum(w, t), name);
  915. if (integer)
  916. glp_set_col_kind(lp, colnum(w, t), GLP_IV);
  917. glp_set_col_bnds(lp, colnum(w, t), GLP_LO, 0., 0.);
  918. }
  919. glp_set_col_bnds(lp, nw*nt+1, GLP_LO, 0., 0.);
  920. /* Total worker execution time */
  921. glp_add_rows(lp, nw);
  922. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  923. {
  924. int someone = 0;
  925. for (w = 0; w < nw; w++)
  926. if (!isnan(times[w*nt+t]))
  927. someone = 1;
  928. if (!someone)
  929. {
  930. /* This task does not have any performance model at all, abort */
  931. glp_delete_prob(lp);
  932. return NULL;
  933. }
  934. }
  935. for (w = 0; w < nw; w++)
  936. {
  937. char name[32], title[64];
  938. starpu_worker_get_name(w, name, sizeof(name));
  939. snprintf(title, sizeof(title), "worker %s", name);
  940. glp_set_row_name(lp, w+1, title);
  941. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  942. {
  943. ia[n] = w+1;
  944. ja[n] = colnum(w, t);
  945. if (isnan(times[w*nt+t]))
  946. ar[n] = 1000000000.;
  947. else
  948. ar[n] = times[w*nt+t];
  949. n++;
  950. }
  951. /* tmax */
  952. ia[n] = w+1;
  953. ja[n] = nw*nt+1;
  954. ar[n] = -1;
  955. n++;
  956. glp_set_row_bnds(lp, w+1, GLP_UP, 0, 0);
  957. }
  958. /* Total task completion */
  959. glp_add_rows(lp, nt);
  960. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  961. {
  962. char name[32], title[64];
  963. starpu_worker_get_name(w, name, sizeof(name));
  964. snprintf(title, sizeof(title), "task %s key %x", _starpu_codelet_get_model_name(tp->cl), (unsigned) tp->footprint);
  965. glp_set_row_name(lp, nw+t+1, title);
  966. for (w = 0; w < nw; w++)
  967. {
  968. ia[n] = nw+t+1;
  969. ja[n] = colnum(w, t);
  970. ar[n] = 1;
  971. n++;
  972. }
  973. glp_set_row_bnds(lp, nw+t+1, GLP_FX, tp->n, tp->n);
  974. }
  975. STARPU_ASSERT(n == ne);
  976. glp_load_matrix(lp, ne-1, ia, ja, ar);
  977. }
  978. glp_smcp parm;
  979. glp_init_smcp(&parm);
  980. parm.msg_lev = GLP_MSG_OFF;
  981. ret = glp_simplex(lp, &parm);
  982. if (ret)
  983. {
  984. glp_delete_prob(lp);
  985. lp = NULL;
  986. return NULL;
  987. }
  988. if (integer)
  989. {
  990. glp_iocp iocp;
  991. glp_init_iocp(&iocp);
  992. iocp.msg_lev = GLP_MSG_OFF;
  993. glp_intopt(lp, &iocp);
  994. }
  995. return lp;
  996. }
  997. #endif /* STARPU_HAVE_GLPK_H */
  998. /* Print the computed bound as well as the optimized distribution of tasks */
  999. void starpu_bound_print(FILE *output, int integer)
  1000. {
  1001. #ifdef STARPU_HAVE_GLPK_H
  1002. if (recorddeps)
  1003. {
  1004. fprintf(output, "Not supported\n");
  1005. return;
  1006. }
  1007. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  1008. glp_prob *lp = _starpu_bound_glp_resolve(integer);
  1009. if (lp)
  1010. {
  1011. struct bound_task_pool * tp;
  1012. int t, w;
  1013. int nw; /* Number of different workers */
  1014. double tmax;
  1015. nw = starpu_worker_get_count();
  1016. if (integer)
  1017. tmax = glp_mip_obj_val(lp);
  1018. else
  1019. tmax = glp_get_obj_val(lp);
  1020. fprintf(output, "Theoretical minimum execution time: %f ms\n", tmax);
  1021. for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
  1022. {
  1023. fprintf(output, "%s key %x\n", _starpu_codelet_get_model_name(tp->cl), (unsigned) tp->footprint);
  1024. for (w = 0; w < nw; w++)
  1025. if (integer)
  1026. fprintf(output, "\tw%dt%dn %f", w, t, glp_mip_col_val(lp, colnum(w, t)));
  1027. else
  1028. fprintf(output, "\tw%dt%dn %f", w, t, glp_get_col_prim(lp, colnum(w, t)));
  1029. fprintf(output, "\n");
  1030. }
  1031. glp_delete_prob(lp);
  1032. }
  1033. else
  1034. {
  1035. _STARPU_MSG("Simplex failed\n");
  1036. }
  1037. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  1038. #else /* STARPU_HAVE_GLPK_H */
  1039. (void) integer;
  1040. fprintf(output, "Please rebuild StarPU with glpk installed.\n");
  1041. #endif /* STARPU_HAVE_GLPK_H */
  1042. }
  1043. /* Compute and return the bound */
  1044. void starpu_bound_compute(double *res, double *integer_res, int integer)
  1045. {
  1046. #ifdef STARPU_HAVE_GLPK_H
  1047. double ret;
  1048. if (recorddeps)
  1049. {
  1050. *res = 0.;
  1051. return;
  1052. }
  1053. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  1054. glp_prob *lp = _starpu_bound_glp_resolve(integer);
  1055. if (lp)
  1056. {
  1057. ret = glp_get_obj_val(lp);
  1058. if (integer)
  1059. *integer_res = glp_mip_obj_val(lp);
  1060. glp_delete_prob(lp);
  1061. }
  1062. else
  1063. ret = 0.;
  1064. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  1065. *res = ret;
  1066. #else /* STARPU_HAVE_GLPK_H */
  1067. (void) integer_res;
  1068. (void) integer;
  1069. *res = 0.;
  1070. #endif /* STARPU_HAVE_GLPK_H */
  1071. }