17 #ifndef __STARPU_MPI_PRIVATE_H__ 18 #define __STARPU_MPI_PRIVATE_H__ 21 #include <common/config.h> 23 #include <starpu_mpi.h> 38 extern starpu_pthread_wait_t _starpu_mpi_thread_wait;
39 extern starpu_pthread_queue_t _starpu_mpi_thread_dontsleep;
45 starpu_pthread_queue_t *queue;
49 int _starpu_mpi_simgrid_mpi_test(
unsigned *done,
int *flag);
50 void _starpu_mpi_simgrid_wait_req(MPI_Request *request, MPI_Status *status, starpu_pthread_queue_t *queue,
unsigned *done);
53 extern int _starpu_debug_rank;
54 char *_starpu_mpi_get_mpi_error_code(
int code);
55 extern int _starpu_mpi_comm_debug;
57 #ifdef STARPU_MPI_VERBOSE 58 extern int _starpu_debug_level_min;
59 extern int _starpu_debug_level_max;
60 void _starpu_mpi_set_debug_level_min(
int level);
61 void _starpu_mpi_set_debug_level_max(
int level);
63 extern int _starpu_mpi_fake_world_size;
64 extern int _starpu_mpi_fake_world_rank;
65 extern int _starpu_mpi_use_prio;
66 extern int _starpu_mpi_nobind;
67 extern int _starpu_mpi_thread_cpuid;
68 extern int _starpu_mpi_use_coop_sends;
69 void _starpu_mpi_env_init(
void);
71 #ifdef STARPU_NO_ASSERT 72 # define STARPU_MPI_ASSERT_MSG(x, msg, ...) do { if (0) { (void) (x); }} while(0) 74 # if defined(__CUDACC__) && defined(STARPU_HAVE_WINDOWS) 75 int _starpu_debug_rank;
76 # define STARPU_MPI_ASSERT_MSG(x, msg, ...) \ 79 if (STARPU_UNLIKELY(!(x))) \ 81 if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 82 fprintf(stderr, "\n[%d][starpu_mpi][%s][assert failure] " msg "\n\n", _starpu_debug_rank, __starpu_func__, ## __VA_ARGS__); *(int*)NULL = 0; \ 86 # define STARPU_MPI_ASSERT_MSG(x, msg, ...) \ 89 if (STARPU_UNLIKELY(!(x))) \ 91 if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 92 fprintf(stderr, "\n[%d][starpu_mpi][%s][assert failure] " msg "\n\n", _starpu_debug_rank, __starpu_func__, ## __VA_ARGS__); \ 100 #define _STARPU_MPI_MALLOC(ptr, size) do { ptr = malloc(size); STARPU_MPI_ASSERT_MSG(ptr != NULL, "Cannot allocate %ld bytes\n", (long) (size)); } while (0) 101 #define _STARPU_MPI_CALLOC(ptr, nmemb, size) do { ptr = calloc(nmemb, size); STARPU_MPI_ASSERT_MSG(ptr != NULL, "Cannot allocate %ld bytes\n", (long) (nmemb*size)); } while (0) 102 #define _STARPU_MPI_REALLOC(ptr, size) do { void *_new_ptr = realloc(ptr, size); STARPU_MPI_ASSERT_MSG(_new_ptr != NULL, "Cannot reallocate %ld bytes\n", (long) (size)); ptr = _new_ptr; } while (0) 104 #ifdef STARPU_MPI_VERBOSE 105 # define _STARPU_MPI_COMM_DEBUG(ptr, count, datatype, node, tag, utag, comm, way) \ 108 if (_starpu_mpi_comm_debug) \ 111 char _comm_name[128]; \ 112 int _comm_name_len; \ 114 starpu_mpi_comm_rank(comm, &_rank); \ 115 MPI_Type_size(datatype, &__size); \ 116 MPI_Comm_get_name(comm, _comm_name, &_comm_name_len); \ 117 fprintf(stderr, "[%d][starpu_mpi] :%d:%s:%d:%d:%ld:%s:%p:%ld:%d:%s:%d\n", _rank, _rank, way, node, tag, utag, _comm_name, ptr, count, __size, __starpu_func__ , __LINE__); \ 121 # define _STARPU_MPI_COMM_TO_DEBUG(ptr, count, datatype, dest, tag, utag, comm) _STARPU_MPI_COMM_DEBUG(ptr, count, datatype, dest, tag, utag, comm, "-->") 122 # define _STARPU_MPI_COMM_FROM_DEBUG(ptr, count, datatype, source, tag, utag, comm) _STARPU_MPI_COMM_DEBUG(ptr, count, datatype, source, tag, utag, comm, "<--") 123 # define _STARPU_MPI_DEBUG(level, fmt, ...) \ 126 if (!_starpu_silent && _starpu_debug_level_min <= level && level <= _starpu_debug_level_max) \ 128 if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 129 fprintf(stderr, "%*s[%d][starpu_mpi][%s:%d] " fmt , (_starpu_debug_rank+1)*4, "", _starpu_debug_rank, __starpu_func__ , __LINE__,## __VA_ARGS__); \ 134 # define _STARPU_MPI_COMM_DEBUG(ptr, count, datatype, node, tag, utag, comm, way) do { } while(0) 135 # define _STARPU_MPI_COMM_TO_DEBUG(ptr, count, datatype, dest, tag, utag, comm) do { } while(0) 136 # define _STARPU_MPI_COMM_FROM_DEBUG(ptr, count, datatype, source, tag, utag, comm) do { } while(0) 137 # define _STARPU_MPI_DEBUG(level, fmt, ...) do { } while(0) 140 #define _STARPU_MPI_DISP(fmt, ...) do { if (!_starpu_silent) { \ 141 if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 142 fprintf(stderr, "%*s[%d][starpu_mpi][%s:%d] " fmt , (_starpu_debug_rank+1)*4, "", _starpu_debug_rank, __starpu_func__ , __LINE__ ,## __VA_ARGS__); \ 143 fflush(stderr); }} while(0); 144 #define _STARPU_MPI_MSG(fmt, ...) do { if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 145 fprintf(stderr, "[%d][starpu_mpi][%s:%d] " fmt , _starpu_debug_rank, __starpu_func__ , __LINE__ ,## __VA_ARGS__); \ 146 fflush(stderr); } while(0); 148 #ifdef STARPU_MPI_EXTRA_VERBOSE 149 # define _STARPU_MPI_LOG_IN() do { if (!_starpu_silent) { \ 150 if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 151 fprintf(stderr, "%*s[%d][starpu_mpi][%s:%d] -->\n", (_starpu_debug_rank+1)*4, "", _starpu_debug_rank, __starpu_func__ , __LINE__); \ 152 fflush(stderr); }} while(0) 153 # define _STARPU_MPI_LOG_OUT() do { if (!_starpu_silent) { \ 154 if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank); \ 155 fprintf(stderr, "%*s[%d][starpu_mpi][%s:%d] <--\n", (_starpu_debug_rank+1)*4, "", _starpu_debug_rank, __starpu_func__, __LINE__ ); \ 156 fflush(stderr); }} while(0) 158 # define _STARPU_MPI_LOG_IN() 159 # define _STARPU_MPI_LOG_OUT() 162 enum _starpu_mpi_request_type
182 starpu_mpi_tag_t data_tag;
190 struct _starpu_mpi_req_multilist_coop_sends reqs;
197 unsigned redirects_sent;
213 struct _starpu_mpi_data *_starpu_mpi_data_get(starpu_data_handle_t data_handle);
219 starpu_data_handle_t data_handle;
224 MPI_Datatype datatype;
227 starpu_ssize_t count;
228 int registered_datatype;
237 struct _starpu_mpi_req_multilist_coop_sends coop_sends;
246 enum _starpu_mpi_request_type request_type;
255 void (*callback)(
void *);
259 int sequential_consistency;
262 long post_sync_jobid;
264 #ifdef STARPU_SIMGRID 265 MPI_Status status_store;
266 starpu_pthread_queue_t queue;
277 void _starpu_mpi_submit_ready_request(
void *arg);
284 void _starpu_mpi_coop_send(starpu_data_handle_t data_handle,
struct _starpu_mpi_req *req,
enum starpu_data_access_mode mode,
int sequential_consistency);
294 void _starpu_mpi_submit_coop_sends(
struct _starpu_mpi_coop_sends *coop_sends,
int submit_control,
int submit_data);
296 void _starpu_mpi_submit_ready_request_inc(
struct _starpu_mpi_req *req);
298 struct _starpu_mpi_req * _starpu_mpi_request_fill(starpu_data_handle_t data_handle,
299 int srcdst, starpu_mpi_tag_t data_tag, MPI_Comm comm,
300 unsigned detached,
unsigned sync,
int prio,
void (*callback)(
void *),
void *arg,
301 enum _starpu_mpi_request_type request_type,
void (*func)(
struct _starpu_mpi_req *),
302 int sequential_consistency,
304 starpu_ssize_t count);
309 int _starpu_mpi_wait(starpu_mpi_req *public_req, MPI_Status *status);
310 int _starpu_mpi_test(starpu_mpi_req *public_req,
int *flag, MPI_Status *status);
311 int _starpu_mpi_barrier(MPI_Comm comm);
327 void _starpu_mpi_progress_shutdown(
void **value);
329 #ifdef STARPU_SIMGRID 330 void _starpu_mpi_wait_for_initialization();
332 void _starpu_mpi_data_flush(starpu_data_handle_t data_handle);
339 void (*_starpu_mpi_backend_init)(
struct starpu_conf *conf);
340 void (*_starpu_mpi_backend_shutdown)(void);
341 int (*_starpu_mpi_backend_reserve_core)(void);
343 void (*_starpu_mpi_backend_request_fill)(
struct _starpu_mpi_req *req, MPI_Comm comm,
int is_internal_req);
344 void (*_starpu_mpi_backend_request_destroy)(
struct _starpu_mpi_req *req);
345 void (*_starpu_mpi_backend_data_clear)(starpu_data_handle_t data_handle);
346 void (*_starpu_mpi_backend_data_register)(starpu_data_handle_t data_handle, starpu_mpi_tag_t data_tag);
347 void (*_starpu_mpi_backend_comm_register)(MPI_Comm comm);
355 #endif // __STARPU_MPI_PRIVATE_H__ Definition: starpu_mpi_private.h:201
#define struct
Definition: list.h:172
Definition: starpu_mpi_private.h:217
Definition: starpu_mpi_mpi_backend.h:51
Definition: starpu_mpi_private.h:179
char ** fargv
Definition: starpu_mpi_private.h:322
Definition: starpu_mpi_private.h:337
int fargc
Definition: starpu_mpi_private.h:320
Definition: starpu_mpi_private.h:187
Definition: starpu_spinlock.h:81
Definition: starpu_mpi_private.h:313
Definition: starpu_mpi_private.h:173
Definition: starpu_mpi_private.h:41