perfmodel.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2014 Université de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011 Télécom-SudParis
  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. #include <common/config.h>
  21. #include <starpu.h>
  22. #include <core/task_bundle.h>
  23. #include <stdio.h>
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /**
  29. * Performance models files are stored in a directory whose name
  30. * include the version of the performance model format. The version
  31. * number is also written in the file itself.
  32. * When updating the format, the variable _STARPU_PERFMODEL_VERSION
  33. * should be updated. It is then possible to switch easily between
  34. * differents versions of StarPU having different performance model
  35. * formats.
  36. */
  37. #define _STARPU_PERFMODEL_VERSION 44
  38. struct _starpu_perfmodel_state
  39. {
  40. struct starpu_perfmodel_per_arch** per_arch; /*STARPU_MAXIMPLEMENTATIONS*/
  41. int** per_arch_is_set; /*STARPU_MAXIMPLEMENTATIONS*/
  42. starpu_pthread_rwlock_t model_rwlock;
  43. int *nimpls;
  44. int *nimpls_set;
  45. int ncombs; /* The number of combinations currently used by the model */
  46. int ncombs_set; /* The number of combinations allocated in the array nimpls and ncombs */
  47. int *combs;
  48. };
  49. struct _starpu_perfmodel_list
  50. {
  51. struct _starpu_perfmodel_list *next;
  52. struct starpu_perfmodel *model;
  53. };
  54. struct starpu_data_descr;
  55. struct _starpu_job;
  56. struct starpu_perfmodel_arch;
  57. void _starpu_get_perf_model_dir(char *path, size_t maxlen);
  58. void _starpu_get_perf_model_dir_codelets(char *path, size_t maxlen);
  59. void _starpu_get_perf_model_dir_bus(char *path, size_t maxlen);
  60. void _starpu_get_perf_model_dir_debug(char *path, size_t maxlen);
  61. double _starpu_history_based_job_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
  62. void _starpu_load_history_based_model(struct starpu_perfmodel *model, unsigned scan_history);
  63. void _starpu_init_and_load_perfmodel(struct starpu_perfmodel *model);
  64. void _starpu_initialize_registered_performance_models(void);
  65. void _starpu_deinitialize_registered_performance_models(void);
  66. void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model);
  67. double _starpu_regression_based_job_expected_perf(struct starpu_perfmodel *model,
  68. struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
  69. double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfmodel *model,
  70. struct starpu_perfmodel_arch* arch, 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. int *_starpu_get_cuda_affinity_vector(unsigned gpuid);
  80. #endif
  81. #if defined(STARPU_USE_OPENCL)
  82. int *_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);
  86. int _starpu_read_double(FILE *f, char *format, double *val);
  87. void _starpu_simgrid_get_platform_path(char *path, size_t maxlen);
  88. struct starpu_perfmodel_arch * _starpu_arch_comb_get(int comb);
  89. void _starpu_perfmodel_realloc(struct starpu_perfmodel *model, int nb);
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif // __PERFMODEL_H__