perfmodel.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2008-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. #ifndef __PERFMODEL_H__
  19. #define __PERFMODEL_H__
  20. /** @file */
  21. #include <common/config.h>
  22. #include <starpu.h>
  23. #include <core/task_bundle.h>
  24. #include <stdio.h>
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. /**
  30. * Performance models files are stored in a directory whose name
  31. * include the version of the performance model format. The version
  32. * number is also written in the file itself.
  33. * When updating the format, the variable _STARPU_PERFMODEL_VERSION
  34. * should be updated. It is then possible to switch easily between
  35. * differents versions of StarPU having different performance model
  36. * formats.
  37. */
  38. #define _STARPU_PERFMODEL_VERSION 45
  39. struct _starpu_perfmodel_state
  40. {
  41. struct starpu_perfmodel_per_arch** per_arch; /*STARPU_MAXIMPLEMENTATIONS*/
  42. int** per_arch_is_set; /*STARPU_MAXIMPLEMENTATIONS*/
  43. starpu_pthread_rwlock_t model_rwlock;
  44. int *nimpls;
  45. int *nimpls_set;
  46. /** The number of combinations currently used by the model */
  47. int ncombs;
  48. /** The number of combinations allocated in the array nimpls and ncombs */
  49. int ncombs_set;
  50. int *combs;
  51. };
  52. struct starpu_data_descr;
  53. struct _starpu_job;
  54. struct starpu_perfmodel_arch;
  55. extern unsigned _starpu_calibration_minimum;
  56. char *_starpu_get_perf_model_dir_codelet();
  57. char *_starpu_get_perf_model_dir_bus();
  58. char *_starpu_get_perf_model_dir_debug();
  59. double _starpu_history_based_job_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
  60. void _starpu_load_history_based_model(struct starpu_perfmodel *model, unsigned scan_history);
  61. void _starpu_init_and_load_perfmodel(struct starpu_perfmodel *model);
  62. void _starpu_initialize_registered_performance_models(void);
  63. void _starpu_deinitialize_registered_performance_models(void);
  64. void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model);
  65. double _starpu_regression_based_job_expected_perf(struct starpu_perfmodel *model,
  66. struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
  67. double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfmodel *model,
  68. struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
  69. double _starpu_multiple_regression_based_job_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch,
  70. struct _starpu_job *j, unsigned nimpl);
  71. void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfmodel *model, struct starpu_perfmodel_arch * arch,
  72. unsigned cpuid, double measured, unsigned nimpl);
  73. int _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch);
  74. void _starpu_create_sampling_directory_if_needed(void);
  75. void _starpu_load_bus_performance_files(void);
  76. void _starpu_set_calibrate_flag(unsigned val);
  77. unsigned _starpu_get_calibrate_flag(void);
  78. #if defined(STARPU_USE_CUDA)
  79. unsigned *_starpu_get_cuda_affinity_vector(unsigned gpuid);
  80. #endif
  81. #if defined(STARPU_USE_OPENCL)
  82. unsigned *_starpu_get_opencl_affinity_vector(unsigned gpuid);
  83. #endif
  84. void _starpu_save_bandwidth_and_latency_disk(double bandwidth_write, double bandwidth_read,
  85. double latency_write, double latency_read, unsigned node, const char *name);
  86. void _starpu_write_double(FILE *f, const char *format, double val);
  87. int _starpu_read_double(FILE *f, char *format, double *val);
  88. void _starpu_simgrid_get_platform_path(int version, char *path, size_t maxlen);
  89. void _starpu_perfmodel_realloc(struct starpu_perfmodel *model, int nb);
  90. void _starpu_free_arch_combs(void);
  91. #if defined(STARPU_HAVE_HWLOC)
  92. hwloc_topology_t _starpu_perfmodel_get_hwtopology();
  93. #endif
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97. #endif // __PERFMODEL_H__