perfmodel.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 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. #ifndef __PERFMODEL_H__
  17. #define __PERFMODEL_H__
  18. #include <common/config.h>
  19. #include <starpu.h>
  20. #include <starpu_perfmodel.h>
  21. //#include <core/jobs.h>
  22. #include <common/htable32.h>
  23. //#include <core/workers.h>
  24. #include <pthread.h>
  25. #include <stdio.h>
  26. struct starpu_buffer_descr_t;
  27. struct starpu_jobq_s;
  28. struct starpu_job_s;
  29. enum starpu_perf_archtype;
  30. struct starpu_history_entry_t {
  31. //double measured;
  32. /* mean_n = 1/n sum */
  33. double mean;
  34. /* n dev_n = sum2 - 1/n (sum)^2 */
  35. double deviation;
  36. /* sum of samples */
  37. double sum;
  38. /* sum of samples^2 */
  39. double sum2;
  40. // /* sum of ln(measured) */
  41. // double sumlny;
  42. //
  43. // /* sum of ln(size) */
  44. // double sumlnx;
  45. // double sumlnx2;
  46. //
  47. // /* sum of ln(size) ln(measured) */
  48. // double sumlnxlny;
  49. //
  50. unsigned nsample;
  51. uint32_t footprint;
  52. size_t size; /* in bytes */
  53. };
  54. struct starpu_history_list_t {
  55. struct starpu_history_list_t *next;
  56. struct starpu_history_entry_t *entry;
  57. };
  58. struct starpu_model_list_t {
  59. struct starpu_model_list_t *next;
  60. struct starpu_perfmodel_t *model;
  61. };
  62. //
  63. ///* File format */
  64. //struct model_file_format {
  65. // unsigned ncore_entries;
  66. // unsigned ncuda_entries;
  67. // /* contains core entries, then cuda ones */
  68. // struct starpu_history_entry_t entries[];
  69. //}
  70. void _starpu_get_perf_model_dir(char *path, size_t maxlen);
  71. void _starpu_get_perf_model_dir_codelets(char *path, size_t maxlen);
  72. void _starpu_get_perf_model_dir_bus(char *path, size_t maxlen);
  73. void _starpu_get_perf_model_dir_debug(char *path, size_t maxlen);
  74. double _starpu_history_based_job_expected_length(struct starpu_perfmodel_t *model, enum starpu_perf_archtype arch, struct starpu_job_s *j);
  75. void _starpu_register_model(struct starpu_perfmodel_t *model);
  76. void _starpu_initialize_registered_performance_models(void);
  77. void _starpu_deinitialize_registered_performance_models(void);
  78. double _starpu_task_expected_length(int workerid, struct starpu_task *task, enum starpu_perf_archtype arch);
  79. double _starpu_regression_based_job_expected_length(struct starpu_perfmodel_t *model,
  80. enum starpu_perf_archtype arch, struct starpu_job_s *j);
  81. void _starpu_update_perfmodel_history(struct starpu_job_s *j, enum starpu_perf_archtype arch,
  82. unsigned cpuid, double measured);
  83. double _starpu_data_expected_penalty(uint32_t memory_node, struct starpu_task *task);
  84. void _starpu_create_sampling_directory_if_needed(void);
  85. void _starpu_load_bus_performance_files(void);
  86. double _starpu_predict_transfer_time(unsigned src_node, unsigned dst_node, size_t size);
  87. void _starpu_set_calibrate_flag(unsigned val);
  88. unsigned _starpu_get_calibrate_flag(void);
  89. double _starpu_worker_get_relative_speedup(int workerid);
  90. enum starpu_perf_archtype starpu_worker_get_perf_archtype(int workerid);
  91. #if defined(STARPU_USE_CUDA)
  92. int *_starpu_get_cuda_affinity_vector(unsigned gpuid);
  93. #endif
  94. #if defined(STARPU_USE_OPENCL)
  95. int *_starpu_get_opencl_affinity_vector(unsigned gpuid);
  96. #endif
  97. #endif // __PERFMODEL_H__