starpu.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2012 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __STARPU_H__
  18. #define __STARPU_H__
  19. #include <stdlib.h>
  20. #ifndef _MSC_VER
  21. #include <stdint.h>
  22. #else
  23. typedef unsigned char uint8_t;
  24. typedef unsigned short uint16_t;
  25. typedef unsigned long uint32_t;
  26. typedef unsigned long long uint64_t;
  27. #endif
  28. #include <starpu_config.h>
  29. #ifdef STARPU_HAVE_WINDOWS
  30. #include <windows.h>
  31. #endif
  32. #if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
  33. #include <starpu_opencl.h>
  34. #endif
  35. #include <starpu_util.h>
  36. #include <starpu_data.h>
  37. #include <starpu_data_interfaces.h>
  38. #include <starpu_data_filters.h>
  39. #include <starpu_perfmodel.h>
  40. #include <starpu_worker.h>
  41. #include <starpu_task.h>
  42. #include <starpu_task_list.h>
  43. #ifdef BUILDING_STARPU
  44. #include <util/starpu_task_list_inline.h>
  45. #endif
  46. #include <starpu_task_util.h>
  47. #include <starpu_scheduler.h>
  48. #include <starpu_sched_ctx.h>
  49. #include <starpu_expert.h>
  50. #include <starpu_rand.h>
  51. #include <starpu_cuda.h>
  52. #include <starpu_cublas.h>
  53. #include <starpu_bound.h>
  54. #include <starpu_hash.h>
  55. #include <starpu_profiling.h>
  56. #include <starpu_top.h>
  57. #include <starpu_fxt.h>
  58. #ifdef __cplusplus
  59. extern "C"
  60. {
  61. #endif
  62. #ifdef STARPU_SIMGRID
  63. #define main starpu_main
  64. #endif
  65. struct starpu_driver
  66. {
  67. enum starpu_archtype type;
  68. union
  69. {
  70. unsigned cpu_id;
  71. unsigned cuda_id;
  72. #if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
  73. cl_device_id opencl_id;
  74. #endif
  75. /*
  76. * HOWTO: add a new kind of device to the starpu_driver structure.
  77. * 1) Add a member to this union.
  78. * 2) Edit _starpu_launch_drivers() to make sure the driver is
  79. * not always launched.
  80. * 3) Edit starpu_driver_run() so that it can handle another
  81. * kind of architecture.
  82. * 4) Write _starpu_run_foobar() in the corresponding driver.
  83. * 5) Test the whole thing :)
  84. */
  85. } id;
  86. };
  87. struct starpu_conf
  88. {
  89. /* Will be initialized by starpu_conf_init */
  90. int magic;
  91. /* which scheduling policy should be used ? (NULL for default) */
  92. const char *sched_policy_name;
  93. struct starpu_sched_policy *sched_policy;
  94. /* number of CPU workers (-1 for default) */
  95. int ncpus;
  96. /* number of CUDA GPU workers (-1 for default) */
  97. int ncuda;
  98. /* number of GPU OpenCL device workers (-1 for default) */
  99. int nopencl;
  100. /* number of Cell's SPUs (-1 for default) */
  101. int nspus;
  102. unsigned use_explicit_workers_bindid;
  103. unsigned workers_bindid[STARPU_NMAXWORKERS];
  104. unsigned use_explicit_workers_cuda_gpuid;
  105. unsigned workers_cuda_gpuid[STARPU_NMAXWORKERS];
  106. unsigned use_explicit_workers_opencl_gpuid;
  107. unsigned workers_opencl_gpuid[STARPU_NMAXWORKERS];
  108. /* calibrate bus (-1 for default) */
  109. int bus_calibrate;
  110. /* calibrate performance models, if any (-1 for default) */
  111. int calibrate;
  112. /* Create only one combined worker, containing all CPU workers */
  113. int single_combined_worker;
  114. /* indicate if all asynchronous copies should be disabled */
  115. int disable_asynchronous_copy;
  116. /* indicate if asynchronous copies to CUDA devices should be disabled */
  117. int disable_asynchronous_cuda_copy;
  118. /* indicate if asynchronous copies to OpenCL devices should be disabled */
  119. int disable_asynchronous_opencl_copy;
  120. /* Enable CUDA/OpenGL interoperation on these CUDA devices */
  121. unsigned *cuda_opengl_interoperability;
  122. unsigned n_cuda_opengl_interoperability;
  123. /* A driver that the application will run in one of its own threads. */
  124. struct starpu_driver *not_launched_drivers;
  125. unsigned n_not_launched_drivers;
  126. /* Indicates whether we start the profiling automatically
  127. or we leave the appl start it if it wants to */
  128. unsigned no_auto_profile;
  129. };
  130. /* Initialize a starpu_conf structure with default values. */
  131. int starpu_conf_init(struct starpu_conf *conf);
  132. /* Initialization method: it must be called prior to any other StarPU call
  133. * Default configuration is used if NULL is passed as argument.
  134. */
  135. int starpu_init(struct starpu_conf *conf) STARPU_WARN_UNUSED_RESULT;
  136. /* Shutdown method: note that statistics are only generated once StarPU is
  137. * shutdown */
  138. void starpu_shutdown(void);
  139. /* Print topology configuration */
  140. void starpu_topology_print(FILE *f);
  141. int starpu_asynchronous_copy_disabled(void);
  142. int starpu_asynchronous_cuda_copy_disabled(void);
  143. int starpu_asynchronous_opencl_copy_disabled(void);
  144. void starpu_profiling_init();
  145. void starpu_display_stats();
  146. int starpu_driver_run(struct starpu_driver *d);
  147. void starpu_drivers_request_termination(void);
  148. int starpu_driver_init(struct starpu_driver *d);
  149. int starpu_driver_run_once(struct starpu_driver *d);
  150. int starpu_driver_deinit(struct starpu_driver *d);
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. #if defined(STARPU_USE_DEPRECATED_API)
  155. #include "starpu_deprecated_api.h"
  156. #endif /* STARPU_USE_DEPRECATED_API */
  157. #endif /* __STARPU_H__ */