perfmodel_history.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2010 (see AUTHORS file)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include <dirent.h>
  17. #include <unistd.h>
  18. #include <sys/stat.h>
  19. #include <errno.h>
  20. #include <common/config.h>
  21. #include <core/perfmodel/perfmodel.h>
  22. #include <core/jobs.h>
  23. #include <core/workers.h>
  24. #include <pthread.h>
  25. #include <datawizard/datawizard.h>
  26. #include <core/perfmodel/regression.h>
  27. #include <common/config.h>
  28. static pthread_rwlock_t registered_models_rwlock;
  29. static struct starpu_model_list_t *registered_models = NULL;
  30. /*
  31. * History based model
  32. */
  33. static void insert_history_entry(struct starpu_history_entry_t *entry, struct starpu_history_list_t **list, struct starpu_htbl32_node_s **history_ptr)
  34. {
  35. struct starpu_history_list_t *link;
  36. struct starpu_history_entry_t *old;
  37. link = malloc(sizeof(struct starpu_history_list_t));
  38. link->next = *list;
  39. link->entry = entry;
  40. *list = link;
  41. old = _starpu_htbl_insert_32(history_ptr, entry->footprint, entry);
  42. /* that may fail in case there is some concurrency issue */
  43. STARPU_ASSERT(old == NULL);
  44. }
  45. static void dump_reg_model(FILE *f, struct starpu_regression_model_t *reg_model)
  46. {
  47. fprintf(f, "# sumlnx\tsumlnx2\t\tsumlny\t\tsumlnxlny\talpha\t\tbeta\t\tn\n");
  48. fprintf(f, "%-15le\t%-15le\t%-15le\t%-15le\t%-15le\t%-15le\t%u\n", reg_model->sumlnx, reg_model->sumlnx2, reg_model->sumlny, reg_model->sumlnxlny, reg_model->alpha, reg_model->beta, reg_model->nsample);
  49. }
  50. static void scan_reg_model(FILE *f, struct starpu_regression_model_t *reg_model)
  51. {
  52. int res;
  53. starpu_drop_comments(f);
  54. res = fscanf(f, "%le\t%le\t%le\t%le\t%le\t%le\t%u\n", &reg_model->sumlnx, &reg_model->sumlnx2, &reg_model->sumlny, &reg_model->sumlnxlny, &reg_model->alpha, &reg_model->beta, &reg_model->nsample);
  55. STARPU_ASSERT(res == 7);
  56. }
  57. static void dump_history_entry(FILE *f, struct starpu_history_entry_t *entry)
  58. {
  59. fprintf(f, "%08x\t%-15lu\t%-15le\t%-15le\t%-15le\t%-15le\t%u\n", entry->footprint, (unsigned long) entry->size, entry->mean, entry->deviation, entry->sum, entry->sum2, entry->nsample);
  60. }
  61. static void scan_history_entry(FILE *f, struct starpu_history_entry_t *entry)
  62. {
  63. int res;
  64. starpu_drop_comments(f);
  65. res = fscanf(f, "%x\t%zu\t%le\t%le\t%le\t%le\t%u\n", &entry->footprint, &entry->size, &entry->mean, &entry->deviation, &entry->sum, &entry->sum2, &entry->nsample);
  66. STARPU_ASSERT(res == 7);
  67. }
  68. static void parse_per_arch_model_file(FILE *f, struct starpu_per_arch_perfmodel_t *per_arch_model, unsigned scan_history)
  69. {
  70. unsigned nentries;
  71. starpu_drop_comments(f);
  72. int res = fscanf(f, "%u\n", &nentries);
  73. STARPU_ASSERT(res == 1);
  74. scan_reg_model(f, &per_arch_model->regression);
  75. starpu_drop_comments(f);
  76. res = fscanf(f, "%le\t%le\t%le\n",
  77. &per_arch_model->regression.a,
  78. &per_arch_model->regression.b,
  79. &per_arch_model->regression.c);
  80. STARPU_ASSERT(res == 3);
  81. if (isnan(per_arch_model->regression.a)||isnan(per_arch_model->regression.b)||isnan(per_arch_model->regression.c))
  82. {
  83. per_arch_model->regression.valid = 0;
  84. }
  85. else {
  86. per_arch_model->regression.valid = 1;
  87. }
  88. if (!scan_history)
  89. return;
  90. /* parse cpu entries */
  91. unsigned i;
  92. for (i = 0; i < nentries; i++) {
  93. struct starpu_history_entry_t *entry = malloc(sizeof(struct starpu_history_entry_t));
  94. STARPU_ASSERT(entry);
  95. scan_history_entry(f, entry);
  96. /* insert the entry in the hashtable and the list structures */
  97. insert_history_entry(entry, &per_arch_model->list, &per_arch_model->history);
  98. }
  99. }
  100. static void parse_model_file(FILE *f, struct starpu_perfmodel_t *model, unsigned scan_history)
  101. {
  102. unsigned arch;
  103. for (arch = 0; arch < STARPU_NARCH_VARIATIONS; arch++)
  104. parse_per_arch_model_file(f, &model->per_arch[arch], scan_history);
  105. }
  106. static void dump_per_arch_model_file(FILE *f, struct starpu_per_arch_perfmodel_t *per_arch_model)
  107. {
  108. /* count the number of elements in the lists */
  109. struct starpu_history_list_t *ptr;
  110. unsigned nentries = 0;
  111. ptr = per_arch_model->list;
  112. while(ptr) {
  113. nentries++;
  114. ptr = ptr->next;
  115. }
  116. /* header */
  117. fprintf(f, "# number of entries\n%u\n", nentries);
  118. dump_reg_model(f, &per_arch_model->regression);
  119. double a,b,c;
  120. _starpu_regression_non_linear_power(per_arch_model->list, &a, &b, &c);
  121. fprintf(f, "# a\t\tb\t\tc\n");
  122. fprintf(f, "%-15le\t%-15le\t%-15le\n", a, b, c);
  123. fprintf(f, "# hash\t\tsize\t\tmean\t\tdev\t\tsum\t\tsum2\t\tn\n");
  124. ptr = per_arch_model->list;
  125. while (ptr) {
  126. //memcpy(&entries_array[i++], ptr->entry, sizeof(struct starpu_history_entry_t));
  127. dump_history_entry(f, ptr->entry);
  128. ptr = ptr->next;
  129. }
  130. }
  131. static void dump_model_file(FILE *f, struct starpu_perfmodel_t *model)
  132. {
  133. fprintf(f, "#################\n");
  134. unsigned arch;
  135. for (arch = 0; arch < STARPU_NARCH_VARIATIONS; arch++)
  136. {
  137. char archname[32];
  138. starpu_perfmodel_get_arch_name(arch, archname, 32);
  139. fprintf(f, "# Model for %s\n", archname);
  140. dump_per_arch_model_file(f, &model->per_arch[arch]);
  141. fprintf(f, "\n##################\n");
  142. }
  143. }
  144. static void initialize_per_arch_model(struct starpu_per_arch_perfmodel_t *per_arch_model)
  145. {
  146. per_arch_model->history = NULL;
  147. per_arch_model->list = NULL;
  148. }
  149. static void initialize_model(struct starpu_perfmodel_t *model)
  150. {
  151. unsigned arch;
  152. for (arch = 0; arch < STARPU_NARCH_VARIATIONS; arch++)
  153. initialize_per_arch_model(&model->per_arch[arch]);
  154. }
  155. static void get_model_debug_path(struct starpu_perfmodel_t *model, const char *arch, char *path, size_t maxlen)
  156. {
  157. STARPU_ASSERT(path);
  158. _starpu_get_perf_model_dir_debug(path, maxlen);
  159. strncat(path, model->symbol, maxlen);
  160. char hostname[32];
  161. gethostname(hostname, 32);
  162. strncat(path, ".", maxlen);
  163. strncat(path, hostname, maxlen);
  164. strncat(path, ".", maxlen);
  165. strncat(path, arch, maxlen);
  166. strncat(path, ".debug", maxlen);
  167. }
  168. /* registered_models_rwlock must be taken in write mode before calling this
  169. * function */
  170. void _starpu_register_model(struct starpu_perfmodel_t *model)
  171. {
  172. /* add the model to a linked list */
  173. struct starpu_model_list_t *node = malloc(sizeof(struct starpu_model_list_t));
  174. node->model = model;
  175. //model->debug_modelid = debug_modelid++;
  176. /* put this model at the beginning of the list */
  177. node->next = registered_models;
  178. registered_models = node;
  179. #ifdef STARPU_MODEL_DEBUG
  180. _starpu_create_sampling_directory_if_needed();
  181. unsigned arch;
  182. for (arch = 0; arch < NARCH_VARIATIONS; arch++)
  183. {
  184. char debugpath[256];
  185. starpu_perfmodel_debugfilepath(model, arch, debugpath, 256);
  186. model->per_arch[arch].debug_file = fopen(debugpath, "a+");
  187. STARPU_ASSERT(model->per_arch[arch].debug_file);
  188. }
  189. #endif
  190. return;
  191. }
  192. static void get_model_path(struct starpu_perfmodel_t *model, char *path, size_t maxlen)
  193. {
  194. _starpu_get_perf_model_dir_codelets(path, maxlen);
  195. strncat(path, model->symbol, maxlen);
  196. char hostname[32];
  197. gethostname(hostname, 32);
  198. strncat(path, ".", maxlen);
  199. strncat(path, hostname, maxlen);
  200. }
  201. static void save_history_based_model(struct starpu_perfmodel_t *model)
  202. {
  203. STARPU_ASSERT(model);
  204. STARPU_ASSERT(model->symbol);
  205. /* TODO checks */
  206. /* filename = $STARPU_PERF_MODEL_DIR/codelets/symbol.hostname */
  207. char path[256];
  208. get_model_path(model, path, 256);
  209. #ifdef STARPU_VERBOSE
  210. fprintf(stderr, "Opening performance model file %s for model %s\n", path, model->symbol);
  211. #endif
  212. /* overwrite existing file, or create it */
  213. FILE *f;
  214. f = fopen(path, "w+");
  215. STARPU_ASSERT(f);
  216. dump_model_file(f, model);
  217. fclose(f);
  218. #ifdef DEBUG_MODEL
  219. fclose(model->gordon_debug_file);
  220. fclose(model->cuda_debug_file);
  221. fclose(model->cpu_debug_file);
  222. #endif
  223. }
  224. static void _starpu_dump_registered_models(void)
  225. {
  226. PTHREAD_RWLOCK_WRLOCK(&registered_models_rwlock);
  227. struct starpu_model_list_t *node;
  228. node = registered_models;
  229. #ifdef STARPU_VERBOSE
  230. fprintf(stderr, "DUMP MODELS !\n");
  231. #endif
  232. while (node) {
  233. save_history_based_model(node->model);
  234. node = node->next;
  235. /* XXX free node */
  236. }
  237. PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
  238. }
  239. void _starpu_initialize_registered_performance_models(void)
  240. {
  241. registered_models = NULL;
  242. PTHREAD_RWLOCK_INIT(&registered_models_rwlock, NULL);
  243. }
  244. void _starpu_deinitialize_registered_performance_models(void)
  245. {
  246. if (_starpu_get_calibrate_flag())
  247. _starpu_dump_registered_models();
  248. PTHREAD_RWLOCK_DESTROY(&registered_models_rwlock);
  249. }
  250. /* We first try to grab the global lock in read mode to check whether the model
  251. * was loaded or not (this is very likely to have been already loaded). If the
  252. * model was not loaded yet, we take the lock in write mode, and if the model
  253. * is still not loaded once we have the lock, we do load it. */
  254. static void load_history_based_model(struct starpu_perfmodel_t *model, unsigned scan_history)
  255. {
  256. STARPU_ASSERT(model);
  257. STARPU_ASSERT(model->symbol);
  258. int already_loaded;
  259. PTHREAD_RWLOCK_RDLOCK(&registered_models_rwlock);
  260. already_loaded = model->is_loaded;
  261. PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
  262. if (already_loaded)
  263. return;
  264. /* The model is still not loaded so we grab the lock in write mode, and
  265. * if it's not loaded once we have the lock, we do load it. */
  266. PTHREAD_RWLOCK_WRLOCK(&registered_models_rwlock);
  267. /* Was the model initialized since the previous test ? */
  268. if (model->is_loaded)
  269. {
  270. PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
  271. return;
  272. }
  273. PTHREAD_RWLOCK_INIT(&model->model_rwlock, NULL);
  274. PTHREAD_RWLOCK_WRLOCK(&model->model_rwlock);
  275. /* make sure the performance model directory exists (or create it) */
  276. _starpu_create_sampling_directory_if_needed();
  277. /*
  278. * We need to keep track of all the model that were opened so that we can
  279. * possibly update them at runtime termination ...
  280. */
  281. _starpu_register_model(model);
  282. char path[256];
  283. get_model_path(model, path, 256);
  284. #ifdef STARPU_VERBOSE
  285. fprintf(stderr, "Opening performance model file %s for model %s ... ", path, model->symbol);
  286. #endif
  287. unsigned calibrate_flag = _starpu_get_calibrate_flag();
  288. model->benchmarking = calibrate_flag;
  289. /* try to open an existing file and load it */
  290. int res;
  291. res = access(path, F_OK);
  292. if (res == 0) {
  293. if (calibrate_flag == 2)
  294. {
  295. /* The user specified that the performance model should
  296. * be overwritten, so we don't load the existing file !
  297. * */
  298. #ifdef STARPU_VERBOSE
  299. fprintf(stderr, "Overwrite existing file\n");
  300. #endif
  301. initialize_model(model);
  302. }
  303. else {
  304. /* We load the available file */
  305. #ifdef STARPU_VERBOSE
  306. fprintf(stderr, "File exists\n");
  307. #endif
  308. FILE *f;
  309. f = fopen(path, "r");
  310. STARPU_ASSERT(f);
  311. parse_model_file(f, model, scan_history);
  312. fclose(f);
  313. }
  314. }
  315. else {
  316. #ifdef STARPU_VERBOSE
  317. fprintf(stderr, "File does not exists\n");
  318. #endif
  319. initialize_model(model);
  320. }
  321. model->is_loaded = 1;
  322. PTHREAD_RWLOCK_UNLOCK(&model->model_rwlock);
  323. PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
  324. }
  325. /* This function is intended to be used by external tools that should read
  326. * the performance model files */
  327. int starpu_list_models(void)
  328. {
  329. #ifdef DT_REG
  330. char path[256];
  331. DIR *dp;
  332. struct dirent *ep;
  333. char perf_model_dir_codelets[256];
  334. _starpu_get_perf_model_dir_codelets(perf_model_dir_codelets, 256);
  335. strncpy(path, perf_model_dir_codelets, 256);
  336. dp = opendir(path);
  337. if (dp != NULL) {
  338. while ((ep = readdir(dp))) {
  339. if (ep->d_type == DT_REG) {
  340. fprintf(stdout, "file: <%s>\n", ep->d_name);
  341. }
  342. }
  343. closedir (dp);
  344. return 0;
  345. }
  346. else {
  347. perror ("Couldn't open the directory");
  348. return 1;
  349. }
  350. #else
  351. perror ("not supported\n");
  352. return 1;
  353. #endif
  354. }
  355. /* This function is intended to be used by external tools that should read the
  356. * performance model files */
  357. int starpu_load_history_debug(const char *symbol, struct starpu_perfmodel_t *model)
  358. {
  359. model->symbol = symbol;
  360. /* where is the file if it exists ? */
  361. char path[256];
  362. get_model_path(model, path, 256);
  363. // fprintf(stderr, "get_model_path -> %s\n", path);
  364. /* does it exist ? */
  365. int res;
  366. res = access(path, F_OK);
  367. if (res) {
  368. fprintf(stderr, "There is no performance model for symbol %s\n", symbol);
  369. return 1;
  370. }
  371. FILE *f = fopen(path, "r");
  372. STARPU_ASSERT(f);
  373. parse_model_file(f, model, 1);
  374. return 0;
  375. }
  376. void starpu_perfmodel_get_arch_name(enum starpu_perf_archtype arch, char *archname, size_t maxlen)
  377. {
  378. if (arch == STARPU_CPU_DEFAULT)
  379. {
  380. snprintf(archname, maxlen, "cpu");
  381. }
  382. else if ((STARPU_CUDA_DEFAULT <= arch)
  383. && (arch < STARPU_CUDA_DEFAULT + STARPU_MAXCUDADEVS))
  384. {
  385. int devid = arch - STARPU_CUDA_DEFAULT;
  386. snprintf(archname, maxlen, "cuda_%d", devid);
  387. }
  388. else if ((STARPU_OPENCL_DEFAULT <= arch)
  389. && (arch < STARPU_OPENCL_DEFAULT + STARPU_MAXOPENCLDEVS))
  390. {
  391. int devid = arch - STARPU_OPENCL_DEFAULT;
  392. snprintf(archname, maxlen, "opencl_%d", devid);
  393. }
  394. else if (arch == STARPU_GORDON_DEFAULT)
  395. {
  396. snprintf(archname, maxlen, "gordon");
  397. }
  398. else
  399. {
  400. STARPU_ABORT();
  401. }
  402. }
  403. void starpu_perfmodel_debugfilepath(struct starpu_perfmodel_t *model,
  404. enum starpu_perf_archtype arch, char *path, size_t maxlen)
  405. {
  406. char archname[32];
  407. starpu_perfmodel_get_arch_name(arch, archname, 32);
  408. STARPU_ASSERT(path);
  409. get_model_debug_path(model, archname, path, maxlen);
  410. }
  411. double _starpu_regression_based_job_expected_length(struct starpu_perfmodel_t *model, enum starpu_perf_archtype arch, struct starpu_job_s *j)
  412. {
  413. double exp = -1.0;
  414. size_t size = _starpu_job_get_data_size(j);
  415. struct starpu_regression_model_t *regmodel;
  416. load_history_based_model(model, 0);
  417. regmodel = &model->per_arch[arch].regression;
  418. if (regmodel->valid)
  419. exp = regmodel->a*pow(size, regmodel->b) + regmodel->c;
  420. return exp;
  421. }
  422. double _starpu_history_based_job_expected_length(struct starpu_perfmodel_t *model, enum starpu_perf_archtype arch, struct starpu_job_s *j)
  423. {
  424. double exp;
  425. struct starpu_per_arch_perfmodel_t *per_arch_model;
  426. struct starpu_history_entry_t *entry;
  427. struct starpu_htbl32_node_s *history;
  428. load_history_based_model(model, 1);
  429. if (STARPU_UNLIKELY(!j->footprint_is_computed))
  430. _starpu_compute_buffers_footprint(j);
  431. uint32_t key = j->footprint;
  432. per_arch_model = &model->per_arch[arch];
  433. history = per_arch_model->history;
  434. if (!history)
  435. return -1.0;
  436. PTHREAD_RWLOCK_RDLOCK(&model->model_rwlock);
  437. entry = _starpu_htbl_search_32(history, key);
  438. PTHREAD_RWLOCK_UNLOCK(&model->model_rwlock);
  439. exp = entry?entry->mean:-1.0;
  440. return exp;
  441. }
  442. void _starpu_update_perfmodel_history(starpu_job_t j, enum starpu_perf_archtype arch, unsigned cpuid __attribute__((unused)), double measured)
  443. {
  444. struct starpu_perfmodel_t *model = j->task->cl->model;
  445. if (model)
  446. {
  447. struct starpu_per_arch_perfmodel_t *per_arch_model = &model->per_arch[arch];
  448. if (model->type == STARPU_HISTORY_BASED || model->type == STARPU_REGRESSION_BASED)
  449. {
  450. uint32_t key = j->footprint;
  451. struct starpu_history_entry_t *entry;
  452. struct starpu_htbl32_node_s *history;
  453. struct starpu_htbl32_node_s **history_ptr;
  454. struct starpu_regression_model_t *reg_model;
  455. struct starpu_history_list_t **list;
  456. history = per_arch_model->history;
  457. history_ptr = &per_arch_model->history;
  458. reg_model = &per_arch_model->regression;
  459. list = &per_arch_model->list;
  460. PTHREAD_RWLOCK_WRLOCK(&model->model_rwlock);
  461. entry = _starpu_htbl_search_32(history, key);
  462. if (!entry)
  463. {
  464. /* this is the first entry with such a footprint */
  465. entry = malloc(sizeof(struct starpu_history_entry_t));
  466. STARPU_ASSERT(entry);
  467. entry->mean = measured;
  468. entry->sum = measured;
  469. entry->deviation = 0.0;
  470. entry->sum2 = measured*measured;
  471. entry->size = _starpu_job_get_data_size(j);
  472. entry->footprint = key;
  473. entry->nsample = 1;
  474. insert_history_entry(entry, list, history_ptr);
  475. }
  476. else {
  477. /* there is already some entry with the same footprint */
  478. entry->sum += measured;
  479. entry->sum2 += measured*measured;
  480. entry->nsample++;
  481. unsigned n = entry->nsample;
  482. entry->mean = entry->sum / n;
  483. entry->deviation = sqrt((entry->sum2 - (entry->sum*entry->sum)/n)/n);
  484. }
  485. STARPU_ASSERT(entry);
  486. /* update the regression model as well */
  487. double logy, logx;
  488. logx = log(entry->size);
  489. logy = log(measured);
  490. reg_model->sumlnx += logx;
  491. reg_model->sumlnx2 += logx*logx;
  492. reg_model->sumlny += logy;
  493. reg_model->sumlnxlny += logx*logy;
  494. reg_model->nsample++;
  495. unsigned n = reg_model->nsample;
  496. double num = (n*reg_model->sumlnxlny - reg_model->sumlnx*reg_model->sumlny);
  497. double denom = (n*reg_model->sumlnx2 - reg_model->sumlnx*reg_model->sumlnx);
  498. reg_model->beta = num/denom;
  499. reg_model->alpha = exp((reg_model->sumlny - reg_model->beta*reg_model->sumlnx)/n);
  500. PTHREAD_RWLOCK_UNLOCK(&model->model_rwlock);
  501. }
  502. #ifdef STARPU_MODEL_DEBUG
  503. FILE * debug_file = per_arch_model->debug_file;
  504. PTHREAD_RWLOCK_WRLOCK(&model->model_rwlock);
  505. STARPU_ASSERT(j->footprint_is_computed);
  506. fprintf(debug_file, "0x%x\t%lu\t%lf\t%lf\t%d\t\t", j->footprint, (unsigned long) _starpu_job_get_data_size(j), measured, j->predicted, cpuid);
  507. unsigned i;
  508. struct starpu_task *task = j->task;
  509. for (i = 0; i < task->cl->nbuffers; i++)
  510. {
  511. struct starpu_data_state_t *state = task->buffers[i].handle;
  512. STARPU_ASSERT(state->ops);
  513. STARPU_ASSERT(state->ops->display);
  514. state->ops->display(state, debug_file);
  515. }
  516. fprintf(debug_file, "\n");
  517. PTHREAD_RWLOCK_UNLOCK(&model->model_rwlock);
  518. #endif
  519. }
  520. }