simgrid.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2016,2017 Inria
  4. * Copyright (C) 2012,2013,2015-2018 CNRS
  5. * Copyright (C) 2012-2018 Université de Bordeaux
  6. * Copyright (C) 2013 Thibaut Lambert
  7. *
  8. * StarPU is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * StarPU is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  17. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. */
  19. #include <starpu.h>
  20. #include <datawizard/memory_nodes.h>
  21. #include <common/config.h>
  22. #ifdef HAVE_UNISTD_H
  23. #include <unistd.h>
  24. #endif
  25. #include <core/perfmodel/perfmodel.h>
  26. #include <core/workers.h>
  27. #include <core/simgrid.h>
  28. #if defined(HAVE_SIMGRID_SIMDAG_H) && (SIMGRID_VERSION >= 31300)
  29. #include <simgrid/simdag.h>
  30. #endif
  31. #ifdef STARPU_SIMGRID
  32. #ifdef HAVE_GETRLIMIT
  33. #include <sys/resource.h>
  34. #endif
  35. #include <simgrid/simix.h>
  36. #ifdef STARPU_HAVE_SIMGRID_HOST_H
  37. #include <simgrid/host.h>
  38. #endif
  39. #pragma weak starpu_main
  40. extern int starpu_main(int argc, char *argv[]);
  41. #if SIMGRID_VERSION < 31600
  42. #pragma weak smpi_main
  43. extern int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[]);
  44. #endif
  45. #pragma weak _starpu_mpi_simgrid_init
  46. extern int _starpu_mpi_simgrid_init(int argc, char *argv[]);
  47. /* 1 when MSG_init was done, 2 when initialized through redirected main, 3 when
  48. * initialized through MSG_process_attach */
  49. static int simgrid_started;
  50. static int runners_running;
  51. starpu_pthread_queue_t _starpu_simgrid_transfer_queue[STARPU_MAXNODES];
  52. static struct transfer_runner
  53. {
  54. struct transfer *first_transfer, *last_transfer;
  55. msg_sem_t sem;
  56. msg_process_t runner;
  57. } transfer_runner[STARPU_MAXNODES][STARPU_MAXNODES];
  58. static int transfer_execute(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[] STARPU_ATTRIBUTE_UNUSED);
  59. starpu_pthread_queue_t _starpu_simgrid_task_queue[STARPU_NMAXWORKERS];
  60. static struct worker_runner
  61. {
  62. struct task *first_task, *last_task;
  63. msg_sem_t sem;
  64. msg_process_t runner;
  65. } worker_runner[STARPU_NMAXWORKERS];
  66. static int task_execute(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[] STARPU_ATTRIBUTE_UNUSED);
  67. #if defined(HAVE_SG_ZONE_GET_BY_NAME) || defined(sg_zone_get_by_name)
  68. #define HAVE_STARPU_SIMGRID_GET_AS_BY_NAME
  69. msg_as_t _starpu_simgrid_get_as_by_name(const char *name)
  70. {
  71. return sg_zone_get_by_name(name);
  72. }
  73. #elif defined(HAVE_MSG_ZONE_GET_BY_NAME) || defined(MSG_zone_get_by_name)
  74. #define HAVE_STARPU_SIMGRID_GET_AS_BY_NAME
  75. msg_as_t _starpu_simgrid_get_as_by_name(const char *name)
  76. {
  77. return MSG_zone_get_by_name(name);
  78. }
  79. #elif defined(HAVE_MSG_GET_AS_BY_NAME) || defined(MSG_get_as_by_name)
  80. #define HAVE_STARPU_SIMGRID_GET_AS_BY_NAME
  81. msg_as_t _starpu_simgrid_get_as_by_name(const char *name)
  82. {
  83. return MSG_get_as_by_name(name);
  84. }
  85. #elif defined(HAVE_MSG_ENVIRONMENT_GET_ROUTING_ROOT) || defined(MSG_environment_as_get_routing_sons)
  86. #define HAVE_STARPU_SIMGRID_GET_AS_BY_NAME
  87. static msg_as_t __starpu_simgrid_get_as_by_name(msg_as_t root, const char *name)
  88. {
  89. xbt_dict_t dict;
  90. xbt_dict_cursor_t cursor;
  91. const char *key;
  92. msg_as_t as, ret;
  93. dict = MSG_environment_as_get_routing_sons(root);
  94. xbt_dict_foreach(dict, cursor, key, as)
  95. {
  96. if (!strcmp(MSG_environment_as_get_name(as), name))
  97. return as;
  98. ret = __starpu_simgrid_get_as_by_name(as, name);
  99. if (ret)
  100. return ret;
  101. }
  102. return NULL;
  103. }
  104. msg_as_t _starpu_simgrid_get_as_by_name(const char *name)
  105. {
  106. return __starpu_simgrid_get_as_by_name(MSG_environment_get_routing_root(), name);
  107. }
  108. #endif /* HAVE_MSG_ENVIRONMENT_GET_ROUTING_ROOT */
  109. int _starpu_simgrid_get_nbhosts(const char *prefix)
  110. {
  111. int ret;
  112. xbt_dynar_t hosts;
  113. unsigned i, nb;
  114. unsigned len = strlen(prefix);
  115. if (_starpu_simgrid_running_smpi())
  116. {
  117. #ifdef HAVE_STARPU_SIMGRID_GET_AS_BY_NAME
  118. char new_prefix[32];
  119. char name[32];
  120. STARPU_ASSERT(starpu_mpi_world_rank);
  121. snprintf(name, sizeof(name), STARPU_MPI_AS_PREFIX"%d", starpu_mpi_world_rank());
  122. #if defined(HAVE_MSG_ZONE_GET_HOSTS) || defined(MSG_zone_get_hosts)
  123. hosts = xbt_dynar_new(sizeof(sg_host_t), NULL);
  124. MSG_zone_get_hosts(_starpu_simgrid_get_as_by_name(name), hosts);
  125. #else
  126. hosts = MSG_environment_as_get_hosts(_starpu_simgrid_get_as_by_name(name));
  127. #endif
  128. snprintf(new_prefix, sizeof(new_prefix), "%s-%s", name, prefix);
  129. prefix = new_prefix;
  130. len = strlen(prefix);
  131. #else
  132. STARPU_ABORT_MSG("can not continue without an implementation for _starpu_simgrid_get_as_by_name");
  133. #endif /* HAVE_STARPU_SIMGRID_GET_AS_BY_NAME */
  134. }
  135. else
  136. hosts = MSG_hosts_as_dynar();
  137. nb = xbt_dynar_length(hosts);
  138. ret = 0;
  139. for (i = 0; i < nb; i++)
  140. {
  141. const char *name;
  142. name = MSG_host_get_name(xbt_dynar_get_as(hosts, i, msg_host_t));
  143. if (!strncmp(name, prefix, len))
  144. ret++;
  145. }
  146. xbt_dynar_free(&hosts);
  147. return ret;
  148. }
  149. unsigned long long _starpu_simgrid_get_memsize(const char *prefix, unsigned devid)
  150. {
  151. char name[32];
  152. msg_host_t host;
  153. const char *memsize;
  154. snprintf(name, sizeof(name), "%s%u", prefix, devid);
  155. host = _starpu_simgrid_get_host_by_name(name);
  156. if (!host)
  157. return 0;
  158. if (!MSG_host_get_properties(host))
  159. return 0;
  160. memsize = MSG_host_get_property_value(host, "memsize");
  161. if (!memsize)
  162. return 0;
  163. return atoll(memsize);
  164. }
  165. msg_host_t _starpu_simgrid_get_host_by_name(const char *name)
  166. {
  167. if (_starpu_simgrid_running_smpi())
  168. {
  169. char mpiname[32];
  170. STARPU_ASSERT(starpu_mpi_world_rank);
  171. snprintf(mpiname, sizeof(mpiname), STARPU_MPI_AS_PREFIX"%d-%s", starpu_mpi_world_rank(), name);
  172. return MSG_get_host_by_name(mpiname);
  173. }
  174. else
  175. return MSG_get_host_by_name(name);
  176. }
  177. msg_host_t _starpu_simgrid_get_host_by_worker(struct _starpu_worker *worker)
  178. {
  179. char *prefix;
  180. char name[16];
  181. msg_host_t host;
  182. switch (worker->arch)
  183. {
  184. case STARPU_CPU_WORKER:
  185. prefix = "CPU";
  186. break;
  187. case STARPU_CUDA_WORKER:
  188. prefix = "CUDA";
  189. break;
  190. case STARPU_OPENCL_WORKER:
  191. prefix = "OpenCL";
  192. break;
  193. default:
  194. STARPU_ASSERT(0);
  195. }
  196. snprintf(name, sizeof(name), "%s%u", prefix, worker->devid);
  197. host = _starpu_simgrid_get_host_by_name(name);
  198. STARPU_ASSERT_MSG(host, "Could not find host %s!", name);
  199. return host;
  200. }
  201. /* Simgrid up to 3.15 would rename main into smpi_simulated_main_, and call that
  202. * from SMPI initialization
  203. * In case the MPI application didn't use smpicc to build the file containing
  204. * main(), but included our #define main starpu_main, try to cope by calling
  205. * starpu_main */
  206. int _starpu_smpi_simulated_main_(int argc, char *argv[])
  207. {
  208. if (!starpu_main)
  209. {
  210. _STARPU_ERROR("In simgrid mode, the file containing the main() function of this application needs to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main\n");
  211. }
  212. return starpu_main(argc, argv);
  213. }
  214. int smpi_simulated_main_(int argc, char *argv[]) __attribute__((weak, alias("_starpu_smpi_simulated_main_")));
  215. /* This is used to start a non-MPI simgrid environment */
  216. void _starpu_start_simgrid(int *argc, char **argv)
  217. {
  218. char path[256];
  219. if (simgrid_started)
  220. return;
  221. simgrid_started = 1;
  222. MSG_init(argc, argv);
  223. /* Simgrid uses tiny stacks by default. This comes unexpected to our users. */
  224. unsigned stack_size = 8192;
  225. #ifdef HAVE_GETRLIMIT
  226. struct rlimit rlim;
  227. if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur != 0 && rlim.rlim_cur != RLIM_INFINITY)
  228. stack_size = rlim.rlim_cur / 1024;
  229. #endif
  230. #if SIMGRID_VERSION < 31300
  231. extern xbt_cfg_t _sg_cfg_set;
  232. xbt_cfg_set_int(_sg_cfg_set, "contexts/stack_size", stack_size);
  233. #else
  234. xbt_cfg_set_int("contexts/stack-size", stack_size);
  235. #endif
  236. /* Load XML platform */
  237. #if SIMGRID_VERSION < 31300
  238. _starpu_simgrid_get_platform_path(3, path, sizeof(path));
  239. #else
  240. _starpu_simgrid_get_platform_path(4, path, sizeof(path));
  241. #endif
  242. MSG_create_environment(path);
  243. }
  244. static int main_ret;
  245. int do_starpu_main(int argc, char *argv[])
  246. {
  247. /* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
  248. MSG_process_sleep(0.000001);
  249. main_ret = starpu_main(argc, argv);
  250. return main_ret;
  251. }
  252. /* We need it only when using smpi */
  253. #pragma weak smpi_process_get_user_data
  254. extern void *smpi_process_get_user_data();
  255. /* This is hopefully called before the application and simgrid */
  256. #undef main
  257. #pragma weak main
  258. int main(int argc, char **argv)
  259. {
  260. #ifdef HAVE_SG_CONFIG_CONTINUE_AFTER_HELP
  261. sg_config_continue_after_help();
  262. #endif
  263. if (_starpu_simgrid_running_smpi())
  264. {
  265. if (!smpi_process_get_user_data)
  266. {
  267. _STARPU_ERROR("Your version of simgrid does not provide smpi_process_get_user_data, we can not continue without it\n");
  268. }
  269. #if SIMGRID_VERSION >= 31600
  270. /* Recent versions of simgrid dlopen() us, so we don't need to
  271. * do circumvolutions, just init MPI early and run the application's main */
  272. return _starpu_mpi_simgrid_init(argc, argv);
  273. #else
  274. /* Oops, we are running old SMPI, let it start Simgrid, and we'll
  275. * take back hand in _starpu_simgrid_init from starpu_init() */
  276. return smpi_main(_starpu_mpi_simgrid_init, argc, argv);
  277. #endif
  278. }
  279. /* Already initialized? It probably has been done through a
  280. * constructor and MSG_process_attach, directly jump to real main */
  281. if (simgrid_started == 3)
  282. {
  283. return do_starpu_main(argc, argv);
  284. }
  285. /* Managed to catch application's main, initialize simgrid first */
  286. _starpu_start_simgrid(&argc, argv);
  287. simgrid_started = 2;
  288. /* Create a simgrid process for main */
  289. char **argv_cpy;
  290. _STARPU_MALLOC(argv_cpy, argc * sizeof(char*));
  291. int i;
  292. for (i = 0; i < argc; i++)
  293. argv_cpy[i] = strdup(argv[i]);
  294. void **tsd;
  295. _STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
  296. /* Run the application in a separate thread */
  297. MSG_process_create_with_arguments("main", &do_starpu_main, tsd, MSG_get_host_by_name("MAIN"), argc, argv_cpy);
  298. /* And run maestro in the main thread */
  299. MSG_main();
  300. return main_ret;
  301. }
  302. #if defined(HAVE_MSG_PROCESS_ATTACH) || defined(MSG_process_attach)
  303. static void maestro(void *data STARPU_ATTRIBUTE_UNUSED)
  304. {
  305. MSG_main();
  306. }
  307. #endif
  308. /* This is called early from starpu_init, so thread functions etc. can work */
  309. void _starpu_simgrid_init_early(int *argc STARPU_ATTRIBUTE_UNUSED, char ***argv STARPU_ATTRIBUTE_UNUSED)
  310. {
  311. #ifdef HAVE_SG_CONFIG_CONTINUE_AFTER_HELP
  312. sg_config_continue_after_help();
  313. #endif
  314. #if defined(HAVE_MSG_PROCESS_ATTACH) || defined(MSG_process_attach)
  315. if (simgrid_started < 2 && !_starpu_simgrid_running_smpi())
  316. {
  317. /* "Cannot create_maestro with this ContextFactory.
  318. * Try using --cfg=contexts/factory:thread instead."
  319. * See https://github.com/simgrid/simgrid/issues/141 */
  320. _STARPU_DISP("Warning: In simgrid mode, the file containing the main() function of this application should to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main to avoid having to use --cfg=contexts/factory:thread which reduces performance\n");
  321. #if SIMGRID_VERSION >= 31400 /* Only recent versions of simgrid support setting xbt_cfg_set_string before starting simgrid */
  322. xbt_cfg_set_string("contexts/factory", "thread");
  323. #endif
  324. /* We didn't catch application's main. */
  325. /* Start maestro as a separate thread */
  326. SIMIX_set_maestro(maestro, NULL);
  327. /* Initialize simgrid */
  328. _starpu_start_simgrid(argc, *argv);
  329. /* And attach the main thread to the main simgrid process */
  330. void **tsd;
  331. _STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
  332. MSG_process_attach("main", tsd, MSG_get_host_by_name("MAIN"), NULL);
  333. /* We initialized through MSG_process_attach */
  334. simgrid_started = 3;
  335. }
  336. #endif
  337. if (!simgrid_started && !starpu_main && !_starpu_simgrid_running_smpi())
  338. {
  339. /* Oops, we don't have MSG_process_attach and didn't catch the
  340. * 'main' symbol, there is no way for us */
  341. _STARPU_ERROR("In simgrid mode, the file containing the main() function of this application needs to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main\n");
  342. }
  343. if (_starpu_simgrid_running_smpi())
  344. {
  345. #ifndef STARPU_STATIC_ONLY
  346. _STARPU_ERROR("Simgrid currently does not support privatization for dynamically-linked libraries in SMPI. Please reconfigure and build StarPU with --disable-shared");
  347. #endif
  348. void **tsd;
  349. _STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
  350. MSG_process_set_data(MSG_process_self(), tsd);
  351. }
  352. unsigned i;
  353. for (i = 0; i < STARPU_MAXNODES; i++)
  354. starpu_pthread_queue_init(&_starpu_simgrid_transfer_queue[i]);
  355. for (i = 0; i < STARPU_NMAXWORKERS; i++)
  356. starpu_pthread_queue_init(&_starpu_simgrid_task_queue[i]);
  357. }
  358. /* This is called late from starpu_init, to start task executors */
  359. void _starpu_simgrid_init(void)
  360. {
  361. unsigned i;
  362. runners_running = 1;
  363. for (i = 0; i < starpu_worker_get_count(); i++)
  364. {
  365. char s[32];
  366. snprintf(s, sizeof(s), "worker %u runner", i);
  367. void **tsd;
  368. _STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
  369. worker_runner[i].sem = MSG_sem_init(0);
  370. tsd[0] = (void*)(uintptr_t) i;
  371. worker_runner[i].runner = MSG_process_create_with_arguments(s, task_execute, tsd, _starpu_simgrid_get_host_by_worker(_starpu_get_worker_struct(i)), 0, NULL);
  372. }
  373. }
  374. void _starpu_simgrid_deinit_late(void)
  375. {
  376. #if defined(HAVE_MSG_PROCESS_ATTACH) || defined(MSG_process_attach)
  377. if (simgrid_started == 3)
  378. {
  379. /* Started with MSG_process_attach, now detach */
  380. MSG_process_detach();
  381. simgrid_started = 0;
  382. }
  383. #endif
  384. }
  385. void _starpu_simgrid_deinit(void)
  386. {
  387. unsigned i, j;
  388. runners_running = 0;
  389. for (i = 0; i < STARPU_MAXNODES; i++)
  390. {
  391. for (j = 0; j < STARPU_MAXNODES; j++)
  392. {
  393. struct transfer_runner *t = &transfer_runner[i][j];
  394. if (t->runner)
  395. {
  396. MSG_sem_release(t->sem);
  397. #if SIMGRID_VERSION >= 31400
  398. MSG_process_join(t->runner, 1000000);
  399. #else
  400. MSG_process_sleep(1);
  401. #endif
  402. STARPU_ASSERT(t->first_transfer == NULL);
  403. STARPU_ASSERT(t->last_transfer == NULL);
  404. MSG_sem_destroy(t->sem);
  405. }
  406. }
  407. /* FIXME: queue not empty at this point, needs proper unregistration */
  408. /* starpu_pthread_queue_destroy(&_starpu_simgrid_transfer_queue[i]); */
  409. }
  410. for (i = 0; i < starpu_worker_get_count(); i++)
  411. {
  412. struct worker_runner *w = &worker_runner[i];
  413. MSG_sem_release(w->sem);
  414. #if SIMGRID_VERSION >= 31400
  415. MSG_process_join(w->runner, 1000000);
  416. #else
  417. MSG_process_sleep(1);
  418. #endif
  419. STARPU_ASSERT(w->first_task == NULL);
  420. STARPU_ASSERT(w->last_task == NULL);
  421. MSG_sem_destroy(w->sem);
  422. starpu_pthread_queue_destroy(&_starpu_simgrid_task_queue[i]);
  423. }
  424. #if SIMGRID_VERSION >= 31300
  425. /* clean-atexit introduced in simgrid 3.13 */
  426. if ( xbt_cfg_get_boolean("clean-atexit"))
  427. {
  428. _starpu_simgrid_deinit_late();
  429. }
  430. #endif
  431. }
  432. /*
  433. * Tasks
  434. */
  435. struct task
  436. {
  437. msg_task_t task;
  438. /* communication termination signalization */
  439. unsigned *finished;
  440. /* Next task on this worker */
  441. struct task *next;
  442. };
  443. /* Actually execute the task. */
  444. static int task_execute(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[] STARPU_ATTRIBUTE_UNUSED)
  445. {
  446. /* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
  447. MSG_process_sleep(0.000001);
  448. unsigned workerid = (uintptr_t) STARPU_PTHREAD_GETSPECIFIC(0);
  449. struct worker_runner *w = &worker_runner[workerid];
  450. _STARPU_DEBUG("worker runner %u started\n", workerid);
  451. while (1)
  452. {
  453. struct task *task;
  454. MSG_sem_acquire(w->sem);
  455. if (!runners_running)
  456. break;
  457. task = w->first_task;
  458. w->first_task = task->next;
  459. if (w->last_task == task)
  460. w->last_task = NULL;
  461. _STARPU_DEBUG("task %p started\n", task);
  462. MSG_task_execute(task->task);
  463. MSG_task_destroy(task->task);
  464. _STARPU_DEBUG("task %p finished\n", task);
  465. *task->finished = 1;
  466. /* The worker which started this task may be sleeping out of tasks, wake it */
  467. _starpu_wake_worker_relax(workerid);
  468. free(task);
  469. }
  470. _STARPU_DEBUG("worker %u stopped\n", workerid);
  471. return 0;
  472. }
  473. /* Wait for completion of all asynchronous tasks for this worker */
  474. void _starpu_simgrid_wait_tasks(int workerid)
  475. {
  476. struct task *task = worker_runner[workerid].last_task;
  477. if (!task)
  478. return;
  479. unsigned *finished = task->finished;
  480. starpu_pthread_wait_t wait;
  481. starpu_pthread_wait_init(&wait);
  482. starpu_pthread_queue_register(&wait, &_starpu_simgrid_task_queue[workerid]);
  483. while(1)
  484. {
  485. starpu_pthread_wait_reset(&wait);
  486. if (*finished)
  487. break;
  488. starpu_pthread_wait_wait(&wait);
  489. }
  490. starpu_pthread_queue_unregister(&wait, &_starpu_simgrid_task_queue[workerid]);
  491. starpu_pthread_wait_destroy(&wait);
  492. }
  493. /* Task execution submitted by StarPU */
  494. void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *j, struct starpu_perfmodel_arch* perf_arch, double length, unsigned *finished)
  495. {
  496. struct starpu_task *starpu_task = j->task;
  497. msg_task_t simgrid_task;
  498. if (j->internal)
  499. /* This is not useful to include in simulation (and probably
  500. * doesn't have a perfmodel anyway) */
  501. return;
  502. if (isnan(length))
  503. {
  504. length = starpu_task_expected_length(starpu_task, perf_arch, j->nimpl);
  505. STARPU_ASSERT_MSG(!_STARPU_IS_ZERO(length) && !isnan(length),
  506. "Codelet %s does not have a perfmodel, or is not calibrated enough, please re-run in non-simgrid mode until it is calibrated",
  507. _starpu_job_get_model_name(j));
  508. /* TODO: option to add variance according to performance model,
  509. * to be able to easily check scheduling robustness */
  510. }
  511. simgrid_task = MSG_task_create(_starpu_job_get_task_name(j),
  512. #if defined(HAVE_SG_HOST_SPEED) || defined(sg_host_speed)
  513. length/1000000.0*sg_host_speed(MSG_host_self()),
  514. #elif defined HAVE_MSG_HOST_GET_SPEED || defined(MSG_host_get_speed)
  515. length/1000000.0*MSG_host_get_speed(MSG_host_self()),
  516. #else
  517. length/1000000.0*MSG_get_host_speed(MSG_host_self()),
  518. #endif
  519. 0, NULL);
  520. if (finished == NULL)
  521. {
  522. /* Synchronous execution */
  523. /* First wait for previous tasks */
  524. _starpu_simgrid_wait_tasks(workerid);
  525. MSG_task_execute(simgrid_task);
  526. MSG_task_destroy(simgrid_task);
  527. }
  528. else
  529. {
  530. /* Asynchronous execution */
  531. struct task *task;
  532. struct worker_runner *w = &worker_runner[workerid];
  533. _STARPU_MALLOC(task, sizeof(*task));
  534. task->task = simgrid_task;
  535. task->finished = finished;
  536. *finished = 0;
  537. task->next = NULL;
  538. /* Sleep 10µs for the GPU task queueing */
  539. if (_starpu_simgrid_queue_malloc_cost())
  540. MSG_process_sleep(0.000010);
  541. if (w->last_task)
  542. {
  543. /* Already running a task, queue */
  544. w->last_task->next = task;
  545. w->last_task = task;
  546. }
  547. else
  548. {
  549. STARPU_ASSERT(!w->first_task);
  550. w->first_task = task;
  551. w->last_task = task;
  552. }
  553. MSG_sem_release(w->sem);
  554. }
  555. }
  556. /*
  557. * Transfers
  558. */
  559. /* Note: simgrid is not parallel, so there is no need to hold locks for management of transfers. */
  560. LIST_TYPE(transfer,
  561. msg_task_t task;
  562. int src_node;
  563. int dst_node;
  564. int run_node;
  565. /* communication termination signalization */
  566. unsigned *finished;
  567. /* transfers which wait for this transfer */
  568. struct transfer **wake;
  569. unsigned nwake;
  570. /* Number of transfers that this transfer waits for */
  571. unsigned nwait;
  572. /* Next transfer on this stream */
  573. struct transfer *next;
  574. )
  575. struct transfer_list pending;
  576. /* Tell for two transfers whether they should be handled in sequence */
  577. static int transfers_are_sequential(struct transfer *new_transfer, struct transfer *old_transfer)
  578. {
  579. int new_is_cuda STARPU_ATTRIBUTE_UNUSED, old_is_cuda STARPU_ATTRIBUTE_UNUSED;
  580. int new_is_opencl STARPU_ATTRIBUTE_UNUSED, old_is_opencl STARPU_ATTRIBUTE_UNUSED;
  581. int new_is_gpu_gpu, old_is_gpu_gpu;
  582. new_is_cuda = starpu_node_get_kind(new_transfer->src_node) == STARPU_CUDA_RAM;
  583. new_is_cuda |= starpu_node_get_kind(new_transfer->dst_node) == STARPU_CUDA_RAM;
  584. old_is_cuda = starpu_node_get_kind(old_transfer->src_node) == STARPU_CUDA_RAM;
  585. old_is_cuda |= starpu_node_get_kind(old_transfer->dst_node) == STARPU_CUDA_RAM;
  586. new_is_opencl = starpu_node_get_kind(new_transfer->src_node) == STARPU_OPENCL_RAM;
  587. new_is_opencl |= starpu_node_get_kind(new_transfer->dst_node) == STARPU_OPENCL_RAM;
  588. old_is_opencl = starpu_node_get_kind(old_transfer->src_node) == STARPU_OPENCL_RAM;
  589. old_is_opencl |= starpu_node_get_kind(old_transfer->dst_node) == STARPU_OPENCL_RAM;
  590. new_is_gpu_gpu = new_transfer->src_node && new_transfer->dst_node;
  591. old_is_gpu_gpu = old_transfer->src_node && old_transfer->dst_node;
  592. /* We ignore cuda-opencl transfers, they can not happen */
  593. STARPU_ASSERT(!((new_is_cuda && old_is_opencl) || (old_is_cuda && new_is_opencl)));
  594. /* The following constraints have been observed with CUDA alone */
  595. /* Same source/destination, sequential */
  596. if (new_transfer->src_node == old_transfer->src_node && new_transfer->dst_node == old_transfer->dst_node)
  597. return 1;
  598. /* Crossed GPU-GPU, sequential */
  599. if (new_is_gpu_gpu
  600. && new_transfer->src_node == old_transfer->dst_node
  601. && old_transfer->src_node == new_transfer->dst_node)
  602. return 1;
  603. /* GPU-GPU transfers are sequential with any RAM->GPU transfer */
  604. if (new_is_gpu_gpu
  605. && (old_transfer->dst_node == new_transfer->src_node
  606. || old_transfer->dst_node == new_transfer->dst_node))
  607. return 1;
  608. if (old_is_gpu_gpu
  609. && (new_transfer->dst_node == old_transfer->src_node
  610. || new_transfer->dst_node == old_transfer->dst_node))
  611. return 1;
  612. /* StarPU's constraint on CUDA transfers is using one stream per
  613. * source/destination pair, which is already handled above */
  614. return 0;
  615. }
  616. static void transfer_queue(struct transfer *transfer)
  617. {
  618. unsigned src = transfer->src_node;
  619. unsigned dst = transfer->dst_node;
  620. struct transfer_runner *t = &transfer_runner[src][dst];
  621. if (!t->runner)
  622. {
  623. /* No runner yet, start it */
  624. static starpu_pthread_mutex_t mutex; /* process_create may yield */
  625. STARPU_PTHREAD_MUTEX_LOCK(&mutex);
  626. if (!t->runner)
  627. {
  628. char s[64];
  629. snprintf(s, sizeof(s), "transfer %u-%u runner", src, dst);
  630. void **tsd;
  631. _STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
  632. tsd[0] = (void*)(uintptr_t)((src<<16) + dst);
  633. t->runner = MSG_process_create_with_arguments(s, transfer_execute, tsd, _starpu_simgrid_get_memnode_host(src), 0, NULL);
  634. t->sem = MSG_sem_init(0);
  635. }
  636. STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
  637. }
  638. if (t->last_transfer)
  639. {
  640. /* Already running a transfer, queue */
  641. t->last_transfer->next = transfer;
  642. t->last_transfer = transfer;
  643. }
  644. else
  645. {
  646. STARPU_ASSERT(!t->first_transfer);
  647. t->first_transfer = transfer;
  648. t->last_transfer = transfer;
  649. }
  650. MSG_sem_release(t->sem);
  651. }
  652. /* Actually execute the transfer, and then start transfers waiting for this one. */
  653. static int transfer_execute(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[] STARPU_ATTRIBUTE_UNUSED)
  654. {
  655. /* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
  656. MSG_process_sleep(0.000001);
  657. unsigned src_dst = (uintptr_t) STARPU_PTHREAD_GETSPECIFIC(0);
  658. unsigned src = src_dst >> 16;
  659. unsigned dst = src_dst & 0xffff;
  660. struct transfer_runner *t = &transfer_runner[src][dst];
  661. _STARPU_DEBUG("transfer runner %u-%u started\n", src, dst);
  662. while (1)
  663. {
  664. struct transfer *transfer;
  665. MSG_sem_acquire(t->sem);
  666. if (!runners_running)
  667. break;
  668. transfer = t->first_transfer;
  669. t->first_transfer = transfer->next;
  670. if (t->last_transfer == transfer)
  671. t->last_transfer = NULL;
  672. if (transfer->task)
  673. {
  674. _STARPU_DEBUG("transfer %p started\n", transfer);
  675. MSG_task_execute(transfer->task);
  676. MSG_task_destroy(transfer->task);
  677. _STARPU_DEBUG("transfer %p finished\n", transfer);
  678. }
  679. *transfer->finished = 1;
  680. transfer_list_erase(&pending, transfer);
  681. /* The workers which started this request may be sleeping out of tasks, wake it */
  682. _starpu_wake_all_blocked_workers_on_node(transfer->run_node);
  683. unsigned i;
  684. /* Wake transfers waiting for my termination */
  685. /* Note: due to possible preemption inside process_create, the array
  686. * may grow while doing this */
  687. for (i = 0; i < transfer->nwake; i++)
  688. {
  689. struct transfer *wake = transfer->wake[i];
  690. STARPU_ASSERT(wake->nwait > 0);
  691. wake->nwait--;
  692. if (!wake->nwait)
  693. {
  694. _STARPU_DEBUG("triggering transfer %p\n", wake);
  695. transfer_queue(wake);
  696. }
  697. }
  698. free(transfer->wake);
  699. free(transfer);
  700. }
  701. return 0;
  702. }
  703. /* Look for sequentialization between this transfer and pending transfers, and submit this one */
  704. static void transfer_submit(struct transfer *transfer)
  705. {
  706. struct transfer *old;
  707. for (old = transfer_list_begin(&pending);
  708. old != transfer_list_end(&pending);
  709. old = transfer_list_next(old))
  710. {
  711. if (transfers_are_sequential(transfer, old))
  712. {
  713. _STARPU_DEBUG("transfer %p(%d->%d) waits for %p(%d->%d)\n",
  714. transfer, transfer->src_node, transfer->dst_node,
  715. old, old->src_node, old->dst_node);
  716. /* Make new wait for the old */
  717. transfer->nwait++;
  718. /* Make old wake the new */
  719. _STARPU_REALLOC(old->wake, (old->nwake + 1) * sizeof(old->wake));
  720. old->wake[old->nwake] = transfer;
  721. old->nwake++;
  722. }
  723. }
  724. transfer_list_push_front(&pending, transfer);
  725. if (!transfer->nwait)
  726. {
  727. _STARPU_DEBUG("transfer %p waits for nobody, starting\n", transfer);
  728. transfer_queue(transfer);
  729. }
  730. }
  731. int _starpu_simgrid_wait_transfer_event(union _starpu_async_channel_event *event)
  732. {
  733. /* this is not associated to a request so it's synchronous */
  734. starpu_pthread_wait_t wait;
  735. starpu_pthread_wait_init(&wait);
  736. starpu_pthread_queue_register(&wait, event->queue);
  737. while(1)
  738. {
  739. starpu_pthread_wait_reset(&wait);
  740. if (event->finished)
  741. break;
  742. starpu_pthread_wait_wait(&wait);
  743. }
  744. starpu_pthread_queue_unregister(&wait, event->queue);
  745. starpu_pthread_wait_destroy(&wait);
  746. return 0;
  747. }
  748. int _starpu_simgrid_test_transfer_event(union _starpu_async_channel_event *event)
  749. {
  750. return event->finished;
  751. }
  752. /* Wait for completion of all transfers */
  753. static void _starpu_simgrid_wait_transfers(void)
  754. {
  755. unsigned finished = 0;
  756. struct transfer *sync = transfer_new();
  757. struct transfer *cur;
  758. sync->task = NULL;
  759. sync->finished = &finished;
  760. sync->src_node = STARPU_MAIN_RAM;
  761. sync->dst_node = STARPU_MAIN_RAM;
  762. sync->run_node = STARPU_MAIN_RAM;
  763. sync->wake = NULL;
  764. sync->nwake = 0;
  765. sync->nwait = 0;
  766. sync->next = NULL;
  767. for (cur = transfer_list_begin(&pending);
  768. cur != transfer_list_end(&pending);
  769. cur = transfer_list_next(cur))
  770. {
  771. sync->nwait++;
  772. _STARPU_REALLOC(cur->wake, (cur->nwake + 1) * sizeof(cur->wake));
  773. cur->wake[cur->nwake] = sync;
  774. cur->nwake++;
  775. }
  776. if (sync->nwait == 0)
  777. {
  778. /* No transfer to wait for */
  779. free(sync);
  780. return;
  781. }
  782. /* Push synchronization pseudo-transfer */
  783. transfer_list_push_front(&pending, sync);
  784. /* And wait for it */
  785. starpu_pthread_wait_t wait;
  786. starpu_pthread_wait_init(&wait);
  787. starpu_pthread_queue_register(&wait, &_starpu_simgrid_transfer_queue[STARPU_MAIN_RAM]);
  788. while(1)
  789. {
  790. starpu_pthread_wait_reset(&wait);
  791. if (finished)
  792. break;
  793. starpu_pthread_wait_wait(&wait);
  794. }
  795. starpu_pthread_queue_unregister(&wait, &_starpu_simgrid_transfer_queue[STARPU_MAIN_RAM]);
  796. starpu_pthread_wait_destroy(&wait);
  797. }
  798. /* Data transfer issued by StarPU */
  799. int _starpu_simgrid_transfer(size_t size, unsigned src_node, unsigned dst_node, struct _starpu_data_request *req)
  800. {
  801. /* Simgrid does not like 0-bytes transfers */
  802. if (!size)
  803. return 0;
  804. msg_task_t task;
  805. msg_host_t *hosts;
  806. double *computation;
  807. double *communication;
  808. union _starpu_async_channel_event *event, myevent;
  809. double start = 0.;
  810. _STARPU_CALLOC(hosts, 2, sizeof(*hosts));
  811. _STARPU_CALLOC(computation, 2, sizeof(*computation));
  812. _STARPU_CALLOC(communication, 4, sizeof(*communication));
  813. hosts[0] = _starpu_simgrid_memory_node_get_host(src_node);
  814. hosts[1] = _starpu_simgrid_memory_node_get_host(dst_node);
  815. STARPU_ASSERT(hosts[0] != hosts[1]);
  816. communication[1] = size;
  817. task = MSG_parallel_task_create("copy", 2, hosts, computation, communication, NULL);
  818. struct transfer *transfer = transfer_new();
  819. _STARPU_DEBUG("creating transfer %p for %lu bytes\n", transfer, (unsigned long) size);
  820. transfer->task = task;
  821. transfer->src_node = src_node;
  822. transfer->dst_node = dst_node;
  823. transfer->run_node = _starpu_memory_node_get_local_key();
  824. if (req)
  825. event = &req->async_channel.event;
  826. else
  827. event = &myevent;
  828. event->finished = 0;
  829. transfer->finished = &event->finished;
  830. event->queue = &_starpu_simgrid_transfer_queue[transfer->run_node];
  831. transfer->wake = NULL;
  832. transfer->nwake = 0;
  833. transfer->nwait = 0;
  834. transfer->next = NULL;
  835. if (req)
  836. starpu_interface_start_driver_copy_async(src_node, dst_node, &start);
  837. /* Sleep 10µs for the GPU transfer queueing */
  838. if (_starpu_simgrid_queue_malloc_cost())
  839. MSG_process_sleep(0.000010);
  840. transfer_submit(transfer);
  841. /* Note: from here, transfer might be already freed */
  842. if (req)
  843. {
  844. starpu_interface_end_driver_copy_async(src_node, dst_node, start);
  845. _STARPU_TRACE_DATA_COPY(src_node, dst_node, size);
  846. return -EAGAIN;
  847. }
  848. else
  849. {
  850. /* this is not associated to a request so it's synchronous */
  851. _starpu_simgrid_wait_transfer_event(event);
  852. return 0;
  853. }
  854. }
  855. /* Sync all GPUs (used on CUDA Free, typically) */
  856. void _starpu_simgrid_sync_gpus(void)
  857. {
  858. _starpu_simgrid_wait_transfers();
  859. }
  860. int
  861. _starpu_simgrid_thread_start(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[])
  862. {
  863. void *(*f)(void*) = (void*) (uintptr_t) strtol(argv[0], NULL, 16);
  864. void *arg = (void*) (uintptr_t) strtol(argv[1], NULL, 16);
  865. /* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
  866. MSG_process_sleep(0.000001);
  867. /* _args is freed with process context */
  868. f(arg);
  869. return 0;
  870. }
  871. msg_host_t
  872. _starpu_simgrid_get_memnode_host(unsigned node)
  873. {
  874. const char *fmt;
  875. char name[16];
  876. switch (starpu_node_get_kind(node))
  877. {
  878. case STARPU_CPU_RAM:
  879. fmt = "RAM";
  880. break;
  881. case STARPU_CUDA_RAM:
  882. fmt = "CUDA%u";
  883. break;
  884. case STARPU_OPENCL_RAM:
  885. fmt = "OpenCL%u";
  886. break;
  887. case STARPU_DISK_RAM:
  888. fmt = "DISK%u";
  889. break;
  890. default:
  891. STARPU_ABORT();
  892. break;
  893. }
  894. snprintf(name, sizeof(name), fmt, _starpu_memory_node_get_devid(node));
  895. return _starpu_simgrid_get_host_by_name(name);
  896. }
  897. void _starpu_simgrid_count_ngpus(void)
  898. {
  899. #if (defined(HAVE_SG_LINK_NAME) || defined sg_link_name) && (SIMGRID_VERSION >= 31300)
  900. unsigned src, dst;
  901. msg_host_t ramhost = _starpu_simgrid_get_host_by_name("RAM");
  902. /* For each pair of memory nodes, get the route */
  903. for (src = 1; src < STARPU_MAXNODES; src++)
  904. for (dst = 1; dst < STARPU_MAXNODES; dst++)
  905. {
  906. int busid;
  907. msg_host_t srchost, dsthost;
  908. #if defined(HAVE_SG_HOST_ROUTE) || defined(sg_host_route)
  909. xbt_dynar_t route_dynar = xbt_dynar_new(sizeof(SD_link_t), NULL);
  910. SD_link_t *route;
  911. #else
  912. const SD_link_t *route;
  913. #endif
  914. int i, routesize;
  915. int through;
  916. unsigned src2;
  917. unsigned ngpus;
  918. const char *name;
  919. if (dst == src)
  920. continue;
  921. busid = starpu_bus_get_id(src, dst);
  922. if (busid == -1)
  923. continue;
  924. srchost = _starpu_simgrid_get_memnode_host(src);
  925. dsthost = _starpu_simgrid_get_memnode_host(dst);
  926. #if defined(HAVE_SG_HOST_ROUTE) || defined(sg_host_route)
  927. sg_host_route(srchost, dsthost, route_dynar);
  928. routesize = xbt_dynar_length(route_dynar);
  929. route = xbt_dynar_to_array(route_dynar);
  930. #else
  931. routesize = SD_route_get_size(srchost, dsthost);
  932. route = SD_route_get_list(srchost, dsthost);
  933. #endif
  934. /* If it goes through "Host", do not care, there is no
  935. * direct transfer support */
  936. for (i = 0; i < routesize; i++)
  937. if (!strcmp(sg_link_name(route[i]), "Host"))
  938. break;
  939. if (i < routesize)
  940. continue;
  941. /* Get the PCI bridge between down and up links */
  942. through = -1;
  943. for (i = 0; i < routesize; i++)
  944. {
  945. name = sg_link_name(route[i]);
  946. size_t len = strlen(name);
  947. if (!strcmp(" through", name+len-8))
  948. through = i;
  949. else if (!strcmp(" up", name+len-3))
  950. break;
  951. }
  952. /* Didn't find it ?! */
  953. if (through == -1)
  954. {
  955. _STARPU_DEBUG("Didn't find through-link for %d->%d\n", src, dst);
  956. continue;
  957. }
  958. name = sg_link_name(route[through]);
  959. /*
  960. * count how many direct routes go through it between
  961. * GPUs and RAM
  962. */
  963. ngpus = 0;
  964. for (src2 = 1; src2 < STARPU_MAXNODES; src2++)
  965. {
  966. int numa;
  967. int nnumas = starpu_memory_nodes_get_numa_count();
  968. int found = 0;
  969. for (numa = 0; numa < nnumas; numa++)
  970. if (starpu_bus_get_id(src2, numa) != -1)
  971. {
  972. found = 1;
  973. break;
  974. }
  975. if (!found)
  976. continue;
  977. msg_host_t srchost2 = _starpu_simgrid_get_memnode_host(src2);
  978. int routesize2;
  979. #if defined(HAVE_SG_HOST_ROUTE) || defined(sg_host_route)
  980. xbt_dynar_t route_dynar2 = xbt_dynar_new(sizeof(SD_link_t), NULL);
  981. SD_link_t *route2;
  982. sg_host_route(srchost2, ramhost, route_dynar2);
  983. routesize2 = xbt_dynar_length(route_dynar2);
  984. route2 = xbt_dynar_to_array(route_dynar2);
  985. #else
  986. const SD_link_t *route2 = SD_route_get_list(srchost2, ramhost);
  987. routesize2 = SD_route_get_size(srchost2, ramhost);
  988. #endif
  989. for (i = 0; i < routesize2; i++)
  990. if (!strcmp(name, sg_link_name(route2[i])))
  991. {
  992. /* This GPU goes through this PCI bridge to access RAM */
  993. ngpus++;
  994. break;
  995. }
  996. #if defined(HAVE_SG_HOST_ROUTE) || defined(sg_host_route)
  997. free(route2);
  998. #endif
  999. }
  1000. _STARPU_DEBUG("%d->%d through %s, %u GPUs\n", src, dst, name, ngpus);
  1001. starpu_bus_set_ngpus(busid, ngpus);
  1002. #if defined(HAVE_SG_HOST_ROUTE) || defined(sg_host_route)
  1003. free(route);
  1004. #endif
  1005. }
  1006. #endif
  1007. }
  1008. #if 0
  1009. static size_t used;
  1010. void _starpu_simgrid_data_new(size_t size)
  1011. {
  1012. // Note: this is just declarative
  1013. //_STARPU_DISP("data new: %zd, now %zd\n", size, used);
  1014. }
  1015. void _starpu_simgrid_data_increase(size_t size)
  1016. {
  1017. used += size;
  1018. _STARPU_DISP("data increase: %zd, now %zd\n", size, used);
  1019. }
  1020. void _starpu_simgrid_data_alloc(size_t size)
  1021. {
  1022. used += size;
  1023. _STARPU_DISP("data alloc: %zd, now %zd\n", size, used);
  1024. }
  1025. void _starpu_simgrid_data_free(size_t size)
  1026. {
  1027. used -= size;
  1028. _STARPU_DISP("data free: %zd, now %zd\n", size, used);
  1029. }
  1030. void _starpu_simgrid_data_transfer(size_t size, unsigned src_node, unsigned dst_node)
  1031. {
  1032. _STARPU_DISP("data transfer %zd from %u to %u\n", size, src_node, dst_node);
  1033. }
  1034. #endif
  1035. #endif