NewMadeleine

Documentation

« back to PM2 home.
nm_mpi_private.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2006-2026 (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 General Public License as published by
7 * the Free Software Foundation; either version 2 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. See the GNU
13 * General Public License for more details.
14 */
16#ifndef NM_MPI_PRIVATE_H
17#define NM_MPI_PRIVATE_H
18
30#include <stdint.h>
31#include <limits.h>
32#include <unistd.h>
33#include <assert.h>
34#include <complex.h>
35#include <sys/stat.h>
36
37#include <Padico/Puk.h>
38#include <nm_private_config.h>
39#include <nm_public.h>
40#include <nm_core_interface.h>
42#include <nm_pack_interface.h>
45
46#include <nm_private.h>
47
48#ifdef PIOMAN
49#include <pioman.h>
50#endif /* PIOMAN */
52#include "nm_mpi_ext.h"
53#include "mpi.h"
54
55#ifndef NM_MPI_H
56#error including mpi.h does not include MadMPI; another mpi.h is in the way.
57#endif /* NM_MPI_H */
58
64#define nm_mpi_spinlock_t nm_spinlock_t
65#define nm_mpi_spin_init(LOCK) nm_spin_init(LOCK)
66#define nm_mpi_spin_destroy(LOCK) nm_spin_destroy(LOCK)
67#define nm_mpi_spin_lock(LOCK) nm_spin_lock(LOCK)
68#define nm_mpi_spin_unlock(LOCK) nm_spin_unlock(LOCK)
70/* fixed-size floats */
71#if SIZEOF_FLOAT==4
72typedef float nm_mpi_float4_t;
73#elif SIZEOF_DOUBLE==4
74typedef double nm_mpi_float4_t;
75#else
76# error "no C type for 4 bytes floats"
77#endif
78
79#if SIZEOF_FLOAT==8
80typedef float nm_mpi_float8_t;
81#elif SIZEOF_DOUBLE==8
82typedef double nm_mpi_float8_t;
83#else
84# error "no C type for 8 bytes floats"
85#endif
88typedef struct nm_mpi_errhandler_s
89{
90 int id;
91 union
92 {
108
111
112#define nm_mpi_errhandler_exec(P_ERRHANDLER, KIND, HANDLE, ERR) \
113 nm_mpi_errhandler_exec_internal(P_ERRHANDLER, KIND, HANDLE, ERR, \
114 __FUNCTION__, __FILE__, __LINE__)
115
117#define NM_MPI_ERROR_INTERNAL(ERRORCODE) (ERRORCODE)
118
119#define NM_MPI_ERROR_COMM(P_COMM, ERRORCODE) \
120 ( ( ((ERRORCODE) == MPI_SUCCESS) ? MPI_SUCCESS : \
121 nm_mpi_errhandler_exec((P_COMM)->p_errhandler, NM_MPI_ERRHANDLER_COMM, (P_COMM)->id, (ERRORCODE)) ) \
122 , ERRORCODE )
123
125#define NM_MPI_ERROR_SESSION(P_SESSION, ERRORCODE) \
126 ( ( ((ERRORCODE) == MPI_SUCCESS) ? MPI_SUCCESS : \
127 nm_mpi_errhandler_exec((P_SESSION)->p_errhandler, NM_MPI_ERRHANDLER_SESSION, (P_SESSION)->id, (ERRORCODE)) ) \
128 , ERRORCODE )
129
131#define NM_MPI_ERROR_WIN(P_WIN, ERRORCODE) \
132 ( ( ((ERRORCODE) == MPI_SUCCESS) ? MPI_SUCCESS : \
133 nm_mpi_errhandler_exec((P_WIN)->p_errhandler, NM_MPI_ERRHANDLER_WIN, (P_WIN)->id, (ERRORCODE)) ) \
134 , ERRORCODE )
135
137#define NM_MPI_ERROR_FILE(P_FILE, ERRORCODE) \
138 ( ( ((ERRORCODE) == MPI_SUCCESS) ? MPI_SUCCESS : \
139 nm_mpi_errhandler_exec((P_FILE)->p_errhandler, NM_MPI_ERRHANDLER_FILE, (P_FILE)->id, (ERRORCODE)) ) \
140 , ERRORCODE )
141
143#define NM_MPI_ERROR_FILE_DEFAULT(ERRORCODE) \
144 ( ( ((ERRORCODE) == MPI_SUCCESS) ? MPI_SUCCESS : \
145 nm_mpi_errhandler_exec(nm_mpi_file_errhandler, NM_MPI_ERRHANDLER_FILE, MPI_FILE_NULL, (ERRORCODE)) ) \
146 , ERRORCODE )
147
148#define NM_MPI_ERROR_WORLD(ERRORCODE) \
149 ( ( ((ERRORCODE) == MPI_SUCCESS) ? MPI_SUCCESS : \
150 nm_mpi_errhandler_exec(nm_mpi_communicator_get(MPI_COMM_WORLD)->p_errhandler, NM_MPI_ERRHANDLER_COMM, MPI_COMM_WORLD, (ERRORCODE)) ) \
151 , ERRORCODE )
152
154#define NM_MPI_COMMUNICATOR_CHECK(P_COMM) \
155 PUK_CHECK_TYPE(struct nm_mpi_communicator_s*, P_COMM); \
156 do { if((P_COMM) == NULL) return NM_MPI_ERROR_WORLD(MPI_ERR_COMM); } while(0)
157
159#define NM_MPI_GROUP_CHECK(P_GROUP) \
160 PUK_CHECK_TYPE(struct nm_mpi_group_s*, P_GROUP); \
161 do { if((P_GROUP) == NULL) return NM_MPI_ERROR_WORLD(MPI_ERR_GROUP); } while(0)
162
164#define NM_MPI_SESSION_CHECK(P_SESSION) \
165 PUK_CHECK_TYPE(struct nm_mpi_session_s*, P_SESSION); \
166 do { if((P_SESSION) == NULL) return NM_MPI_ERROR_WORLD(MPI_ERR_SESSION); } while(0)
167
169#define NM_MPI_DATATYPE_CHECK(P_DATATYPE) \
170 PUK_CHECK_TYPE(struct nm_mpi_datatype_s*, P_DATATYPE); \
171 do { if((P_DATATYPE) == NULL) return NM_MPI_ERROR_COMM(p_comm, MPI_ERR_TYPE); } while(0)
172
174#define NM_MPI_TAG_CHECK_RECV(TAG) \
175 do { if(((TAG) != MPI_ANY_TAG) && ((TAG) < 0 || (TAG) > NM_MPI_TAG_MAX)) return NM_MPI_ERROR_COMM(p_comm, MPI_ERR_TAG); } while(0)
176
178#define NM_MPI_TAG_CHECK_SEND(TAG) \
179 do { if( ((TAG) < 0) || ((TAG) > NM_MPI_TAG_MAX) || ((TAG) == MPI_ANY_TAG)) return NM_MPI_ERROR_COMM(p_comm, MPI_ERR_TAG); } while(0)
180
181#define NM_MPI_WARNING(...) NM_WARN(__VA_ARGS__)
182
183#define NM_MPI_FATAL_ERROR(...) NM_FATAL(__VA_ARGS__)
184
185#define NM_MPI_TRACE(str, ...) NM_TRACEF(str, ## __VA_ARGS__)
186
187#define FREE_AND_SET_NULL(p) do { padico_free(p); p = NULL; } while (0/*CONSTCOND*/)
188
189static inline void nm_mpi_refcount_init(struct nm_refcount_s*p_refcount, const char*type __attribute__((unused)), int id)
190{
191 char*object_id = NULL;
192#ifdef NMAD_DEBUG
193 object_id = padico_string_fmt("type = %s; id = %d", type, id);
194#endif
195 nm_refcount_init(p_refcount, object_id, NULL);
196}
197
198
200#define NM_MPI_TAG_MAX ((nm_tag_t)(0x7FFFFFFF))
202#define NM_MPI_TAG_PRIVATE_MASK ((nm_tag_t)(0x80000000))
204#define NM_MPI_TAG_PRIVATE_BASE ((nm_tag_t)(0xF0000000))
205#define NM_MPI_TAG_PRIVATE_BARRIER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x11))
206#define NM_MPI_TAG_PRIVATE_BCAST ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x12))
207#define NM_MPI_TAG_PRIVATE_GATHER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x13))
208#define NM_MPI_TAG_PRIVATE_GATHERV ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x14))
209#define NM_MPI_TAG_PRIVATE_SCATTER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x15))
210#define NM_MPI_TAG_PRIVATE_SCATTERV ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x16))
211#define NM_MPI_TAG_PRIVATE_ALLTOALL ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x17))
212#define NM_MPI_TAG_PRIVATE_ALLTOALLV ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x18))
213#define NM_MPI_TAG_PRIVATE_REDUCE ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x19))
214#define NM_MPI_TAG_PRIVATE_ALLREDUCE ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x1A))
215#define NM_MPI_TAG_PRIVATE_SCAN ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x1B))
216#define NM_MPI_TAG_PRIVATE_REDUCESCATTER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x1C))
217#define NM_MPI_TAG_PRIVATE_ALLGATHER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x1D))
218#define NM_MPI_TAG_PRIVATE_TYPE_ADD ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x21))
219#define NM_MPI_TAG_PRIVATE_TYPE_ADD_ACK ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x22))
220#define NM_MPI_TAG_PRIVATE_WIN_INIT ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x23))
221#define NM_MPI_TAG_PRIVATE_WIN_FENCE ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x24))
222#define NM_MPI_TAG_PRIVATE_WIN_BARRIER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x25))
223#define NM_MPI_TAG_PRIVATE_COMM_SPLIT ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0xF1))
224#define NM_MPI_TAG_PRIVATE_COMM_CREATE ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0xF2))
225#define NM_MPI_TAG_PRIVATE_COMM_INFO ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0xF3))
226#define NM_MPI_TAG_PRIVATE_FILE_OPEN ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0xF4))
228#define NM_MPI_TAG_PRIVATE_RMA_BASE ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x08000000))
229#define NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC ((nm_tag_t)(NM_MPI_TAG_PRIVATE_BASE | 0x04000000))
230#define NM_MPI_TAG_PRIVATE_RMA_MASK_OP ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x0F))
231#define NM_MPI_TAG_PRIVATE_RMA_MASK_AOP ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0xF0))
232#define NM_MPI_TAG_PRIVATE_RMA_MASK_FOP ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_MASK_OP | \
233 NM_MPI_TAG_PRIVATE_RMA_MASK_AOP))
234#define NM_MPI_TAG_PRIVATE_RMA_MASK_SEQ ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0xFFFF00))
235#define NM_MPI_TAG_PRIVATE_RMA_MASK_WIN ((nm_tag_t)(0xFFFFFFFF00000000 | NM_MPI_TAG_PRIVATE_RMA_BASE))
236#define NM_MPI_TAG_PRIVATE_RMA_MASK_USER ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_MASK_FOP | \
237 NM_MPI_TAG_PRIVATE_RMA_MASK_SEQ))
238#define NM_MPI_TAG_PRIVATE_RMA_MASK ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_MASK_WIN | \
239 NM_MPI_TAG_PRIVATE_RMA_MASK_USER))
240#define NM_MPI_TAG_PRIVATE_RMA_MASK_SYNC ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0xFFFFFFFF000000FF))
241#define NM_MPI_TAG_PRIVATE_RMA_START ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x01))
242#define NM_MPI_TAG_PRIVATE_RMA_END ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x02))
243#define NM_MPI_TAG_PRIVATE_RMA_LOCK ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x13))
244#define NM_MPI_TAG_PRIVATE_RMA_LOCK_R ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x04))
245#define NM_MPI_TAG_PRIVATE_RMA_UNLOCK ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x05))
246#define NM_MPI_TAG_PRIVATE_RMA_UNLOCK_R ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x06))
248#define NM_MPI_TAG_PRIVATE_RMA_OP_CHECK ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE_SYNC | 0x0F))
249#define NM_MPI_TAG_PRIVATE_RMA_PUT ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x1))
250#define NM_MPI_TAG_PRIVATE_RMA_GET_REQ ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x2))
251#define NM_MPI_TAG_PRIVATE_RMA_ACC ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x3))
252#define NM_MPI_TAG_PRIVATE_RMA_GACC_REQ ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x4))
253#define NM_MPI_TAG_PRIVATE_RMA_FAO_REQ ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x5))
254#define NM_MPI_TAG_PRIVATE_RMA_CAS_REQ ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0x6))
255#define NM_MPI_TAG_PRIVATE_RMA_REQ_RESP ((nm_tag_t)(NM_MPI_TAG_PRIVATE_RMA_BASE | 0xF))
256
257
258void nm_mpi_info_destructor(char*p_key, char*p_data);
259
261PUK_HASHTABLE_TYPE(nm_mpi_info, char*, char*,
262 &puk_hash_string_default_hash, &puk_hash_string_default_eq, &nm_mpi_info_destructor);
263
266{
267 int id;
268 struct nm_mpi_info_hashtable_s content;
269};
270
275typedef void (nm_mpi_copy_subroutine_t)(int*id, int*keyval, void*extra_state,
276 void*attribute_val_in, void*attribute_val_out, int*flag, int*ierr);
277typedef void (nm_mpi_delete_subroutine_t)(int*id, int*keyval, void*attribute_val, void*extra_state, int*ierr);
278
280typedef int (nm_mpi_attr_copy_fn_t)(int object_id, int keyval_id, void*extra_state,
281 void*attribute_val_in, void*attribute_val_out, int*flag);
282typedef int (nm_mpi_attr_delete_fn_t)(int object_id, int keyval_id, void*attribute_val, void*extra_state);
283
295
296void nm_mpi_attr_destructor(struct nm_mpi_keyval_s*p_keyval, void*p_value);
297PUK_HASHTABLE_TYPE(nm_mpi_attr, struct nm_mpi_keyval_s*, void*,
298 &puk_hash_pointer_default_hash,
299 &puk_hash_pointer_default_eq,
301
304{
305 struct nm_mpi_attr_hashtable_s table;
306 int id;
307};
308
320
372struct nm_mpi_window_s;
374struct nm_mpi_win_epoch_s;
381typedef int32_t nm_mpi_request_type_t;
382#define NM_MPI_REQUEST_ZERO ((nm_mpi_request_type_t)0x0000)
383#define NM_MPI_REQUEST_RECV ((nm_mpi_request_type_t)0x0001)
384#define NM_MPI_REQUEST_PRECV ((nm_mpi_request_type_t)0x0041)
385#define NM_MPI_REQUEST_PROBE ((nm_mpi_request_type_t)0x0002)
386#define NM_MPI_REQUEST_SEND ((nm_mpi_request_type_t)0x0004)
387#define NM_MPI_REQUEST_RSEND ((nm_mpi_request_type_t)0x0014)
388#define NM_MPI_REQUEST_SSEND ((nm_mpi_request_type_t)0x0024)
389#define NM_MPI_REQUEST_PSEND ((nm_mpi_request_type_t)0x0044)
390#define NM_MPI_REQUEST_FILE ((nm_mpi_request_type_t)0x0008)
391#define NM_MPI_REQUEST_GREQUEST ((nm_mpi_request_type_t)0x0080)
392#define NM_MPI_REQUEST_IBARRIER ((nm_mpi_request_type_t)0x1100)
393#define NM_MPI_REQUEST_IBCAST ((nm_mpi_request_type_t)0x2100)
394#define NM_MPI_REQUEST_IREDUCE ((nm_mpi_request_type_t)0x3100)
395#define NM_MPI_REQUEST_IALLREDUCE ((nm_mpi_request_type_t)0x4100)
396#define NM_MPI_REQUEST_IALLTOALL ((nm_mpi_request_type_t)0x5100)
397#define NM_MPI_REQUEST_IALLTOALLV ((nm_mpi_request_type_t)0x6100)
398#define NM_MPI_REQUEST_IGATHER ((nm_mpi_request_type_t)0x7100)
399#define NM_MPI_REQUEST_IALLGATHER ((nm_mpi_request_type_t)0x8100)
400
402#define NM_MPI_REQUEST_COLLECTIVE ((nm_mpi_request_type_t)0x0100)
404#define NM_MPI_REQUEST_PARTITIONED ((nm_mpi_request_type_t)0x0040)
405
406typedef int8_t nm_mpi_status_t;
407#define NM_MPI_STATUS_NONE ((nm_mpi_status_t)0x00)
408#define NM_MPI_REQUEST_CANCELLED ((nm_mpi_status_t)0x04)
409#define NM_MPI_REQUEST_PERSISTENT ((nm_mpi_status_t)0x08)
411#define _NM_MPI_MAX_DATATYPE_SIZE 64
412
413PUK_LIST_DECLARE_TYPE(nm_mpi_request);
414
416typedef struct nm_mpi_request_s
417{
443 union
444 {
445 void*rbuf;
446 const void*sbuf;
448 struct nm_mpi_file_op_s*p_file_op;
449 struct nm_mpi_grequest_s*p_grequest;
450 };
452 union
453 {
454 struct
455 {
457 union
458 {
459 struct
460 {
461 int root;
463 struct
464 {
465 int root;
466 const void*sendbuf;
470 struct
471 {
472 const void*sendbuf;
473 void*recvbuf;
474 struct nm_mpi_operator_s*p_op;
476 struct
477 {
478 int root;
482 struct
483 {
484 const void*sendbuf;
485 void*recvbuf;
489 struct
490 {
491 const void*sendbuf;
492 void*recvbuf;
496 struct
497 {
498 const void*sendbuf;
502 void*recvbuf;
507 };
509 struct
510 {
513 struct nm_mpi_grequest_s
514 {
521 struct
522 {
525 } rma;
526 };
528 PUK_LIST_LINK(nm_mpi_request);
529} __attribute__((__may_alias__)) nm_mpi_request_t;
530
531PUK_LIST_CREATE_FUNCS(nm_mpi_request);
532
552typedef uint32_t nm_mpi_datatype_hash_t;
553
557{
563 size_t ser_size;
568 {
658 } p;
660
662typedef struct nm_mpi_datatype_s
663{
664 int id;
682 size_t size;
689 union
690 {
691 struct
692 {
695 struct
696 {
699 struct
700 {
703 struct
704 {
709 struct
710 {
715 struct
716 {
718 struct nm_mpi_type_indexed_map_s
719 {
720 nm_mpi_count_t blocklength;
724 struct
725 {
727 struct nm_mpi_type_hindexed_map_s
728 {
729 nm_mpi_count_t blocklength;
730 nm_mpi_aint_t displacement;
733 struct
734 {
739 struct
740 {
745 struct
746 {
748 int ndims;
749 int order;
750 struct nm_mpi_type_subarray_dim_s
751 {
752 int size;
754 int start;
757 struct
758 {
759 struct nm_mpi_type_struct_map_s
760 {
761 struct nm_mpi_datatype_s*p_old_type;
762 nm_mpi_count_t blocklength;
763 nm_mpi_aint_t displacement;
766 };
767 char*name;
769 size_t ser_size;
773
781__PUK_SYM_INTERNAL extern const struct nm_data_ops_s nm_mpi_datatype_ops;
783
785typedef void (*nm_mpi_datatype_apply_t)(void*ptr, nm_len_t len, void*_ref);
786
793
800__PUK_SYM_INTERNAL extern const struct nm_data_ops_s nm_mpi_datatype_wrapper_ops;
802
803__PUK_SYM_INTERNAL extern const struct nm_data_ops_s nm_mpi_datatype_serialize_ops;
805
815{
817 struct nm_mpi_request_list_s pending;
819
826{
827 volatile int mode;
828 uint64_t nmsg;
829 uint64_t completed;
830};
831
844
908
911#define NM_MPI_WIN_UNUSED 0
912#define NM_MPI_WIN_ACTIVE_TARGET 1
913#define NM_MPI_WIN_PASSIVE_TARGET 2
914#define NM_MPI_WIN_PASSIVE_TARGET_END 4
915#define NM_MPI_WIN_PASSIVE_TARGET_PENDING 8
920#define NM_MPI_LOCK_NONE ((uint16_t)0)
921#define NM_MPI_LOCK_EXCLUSIVE ((uint16_t)MPI_LOCK_EXCLUSIVE)
922#define NM_MPI_LOCK_SHARED ((uint16_t)MPI_LOCK_SHARED)
923#define _NM_MPI_LOCK_OFFSET ((uint16_t)3)
928#ifdef NMAD_PROFILE
930struct nm_mpi_profiling_s
931{
932 unsigned long cur_req_send, max_req_send;
933 unsigned long cur_req_recv, max_req_recv;
934 unsigned long cur_req_total, max_req_total;
935};
936extern struct nm_mpi_profiling_s nm_mpi_profile;
937#endif /* NMAD_PROFILE */
938
939/* ********************************************************* */
940
941#ifdef NMAD_DEBUG
942#define NM_MPI_HANDLE_DEBUG 1
943#else /* NMAD_DEBUG */
944#define NM_MPI_HANDLE_DEBUG 0
945#endif /* NMAD_DEBUG */
946
947
950#define NM_MPI_HANDLE_TYPE(ENAME, TYPE, OFFSET, SLABSIZE) \
951 PUK_VECT_TYPE(nm_mpi_entry_ ## ENAME, TYPE*); \
952 NM_ALLOCATOR_TYPE(ENAME, TYPE); \
953 struct nm_mpi_handle_##ENAME##_s \
954 { \
955 struct nm_mpi_entry_##ENAME##_vect_s table; \
956 struct puk_int_vect_s pool; \
957 int next_id; \
958 nm_mpi_spinlock_t lock; \
959 struct ENAME##_allocator_s allocator; \
960 char*(*display)(TYPE*); \
961 }; \
962 __attribute__((unused)) \
963 static int nm_mpi_handle_##ENAME##_initialized(struct nm_mpi_handle_##ENAME##_s*p_allocator) \
964 { \
965 return (p_allocator->next_id != -1); \
966 } \
967 \
968 __attribute__((unused)) \
969 static int nm_mpi_handle_##ENAME##_load(struct nm_mpi_handle_##ENAME##_s*p_allocator) \
970 { \
971 int load = 0; \
972 nm_mpi_entry_##ENAME##_vect_itor_t i; \
973 puk_vect_foreach(i, nm_mpi_entry_##ENAME, &p_allocator->table) \
974 { \
975 if(*i != NULL) \
976 { \
977 load++; \
978 } \
979 } \
980 return load; \
981 } \
982 \
983 __attribute__((unused)) \
984 static void nm_mpi_handle_##ENAME##_dump(struct nm_mpi_handle_##ENAME##_s*p_allocator) \
985 { \
986 NM_MPI_TRACE("dump pending objects of kind %s\n", #ENAME); \
987 if( nm_mpi_handle_##ENAME##_initialized(p_allocator) && \
988 !nm_mpi_entry_##ENAME##_vect_empty(&p_allocator->table)) \
989 { \
990 nm_mpi_entry_##ENAME##_vect_itor_t i; \
991 puk_vect_foreach(i, nm_mpi_entry_##ENAME, &p_allocator->table) \
992 { \
993 if(*i != NULL) \
994 { \
995 const int index = nm_mpi_entry_##ENAME##_vect_rank(&p_allocator->table, i); \
996 if(index != (*i)->id) \
997 { \
998 NM_MPI_WARNING("inconsistency in " #ENAME " entry; index = %d; id = %d\n", index, (*i)->id); \
999 } \
1000 if(index >= (OFFSET)) \
1001 { \
1002 char*d = NULL; \
1003 if(p_allocator->display != NULL) \
1004 { \
1005 d = (*p_allocator->display)(*i); \
1006 } \
1007 NM_MPI_WARNING("pending object; type = " #ENAME "; id = %d; ptr = %p; %s\n", (*i)->id, *i, \
1008 (d ? d : "")); \
1009 if(d) padico_free(d); \
1010 } \
1011 } \
1012 } \
1013 } \
1014 } \
1015 \
1016 __attribute__((unused)) \
1017 static void nm_mpi_handle_##ENAME##_init(struct nm_mpi_handle_##ENAME##_s*p_allocator) \
1018 { \
1019 nm_mpi_entry_##ENAME##_vect_init(&p_allocator->table); \
1020 puk_int_vect_init(&p_allocator->pool); \
1021 p_allocator->next_id = OFFSET; \
1022 nm_mpi_spin_init(&p_allocator->lock); \
1023 p_allocator->display = NULL; \
1024 ENAME##_allocator_init(&p_allocator->allocator, SLABSIZE); \
1025 int i; \
1026 for(i = 0; i < OFFSET; i++) \
1027 { \
1028 nm_mpi_entry_##ENAME##_vect_push_back(&p_allocator->table, NULL); \
1029 } \
1030 nm_mpi_cleanup_register((void (*)(void*))&nm_mpi_handle_ ## ENAME ## _dump, p_allocator); \
1031 } \
1032 __attribute__((unused)) \
1033 static void nm_mpi_handle_##ENAME##_finalize(struct nm_mpi_handle_##ENAME##_s*p_allocator, void(*destructor)(TYPE*)) \
1034 { \
1035 nm_mpi_cleanup_unregister((void (*)(void*))&nm_mpi_handle_##ENAME##_dump, p_allocator); \
1036 if(NM_MPI_HANDLE_DEBUG) \
1037 nm_mpi_handle_##ENAME##_dump(p_allocator); \
1038 if(destructor != NULL) \
1039 { \
1040 nm_mpi_entry_##ENAME##_vect_itor_t i; \
1041 puk_vect_foreach(i, nm_mpi_entry_##ENAME, &p_allocator->table) \
1042 { \
1043 if(*i != NULL) \
1044 { \
1045 (*destructor)(*i); \
1046 } \
1047 } \
1048 } \
1049 nm_mpi_entry_##ENAME##_vect_destroy(&p_allocator->table); \
1050 puk_int_vect_destroy(&p_allocator->pool); \
1051 ENAME##_allocator_destroy(&p_allocator->allocator); \
1052 } \
1053 \
1054 __attribute__((unused)) \
1055 static TYPE*nm_mpi_handle_##ENAME##_store(struct nm_mpi_handle_##ENAME##_s*p_allocator, int id) \
1056 { \
1057 assert(nm_mpi_handle_##ENAME##_initialized(p_allocator)); \
1058 TYPE*e = ENAME##_malloc(&p_allocator->allocator); \
1059 if((id <= 0) || (id > OFFSET)) \
1060 { \
1061 NM_MPI_FATAL_ERROR("madmpi: cannot store invalid %s handle id %d\n", #ENAME, id); \
1062 } \
1063 if(nm_mpi_entry_##ENAME##_vect_at(&p_allocator->table, id) != NULL) \
1064 { \
1065 NM_MPI_FATAL_ERROR("madmpi: %s handle %d busy; cannot store.", #ENAME, id); \
1066 } \
1067 nm_mpi_entry_##ENAME##_vect_put(&p_allocator->table, e, id); \
1068 e->id = id; \
1069 return e; \
1070 } \
1071 \
1072 __attribute__((unused)) \
1073 static TYPE*nm_mpi_handle_##ENAME##_alloc(struct nm_mpi_handle_##ENAME##_s*p_allocator) \
1074 { \
1075 assert(nm_mpi_handle_##ENAME##_initialized(p_allocator)); \
1076 TYPE*e = ENAME##_malloc(&p_allocator->allocator); \
1077 int new_id = -1; \
1078 nm_mpi_spin_lock(&p_allocator->lock); \
1079 if(puk_int_vect_empty(&p_allocator->pool)) \
1080 { \
1081 new_id = p_allocator->next_id++; \
1082 nm_mpi_entry_##ENAME##_vect_resize(&p_allocator->table, new_id); \
1083 } \
1084 else \
1085 { \
1086 new_id = puk_int_vect_pop_back(&p_allocator->pool); \
1087 } \
1088 nm_mpi_entry_##ENAME##_vect_put(&p_allocator->table, e, new_id); \
1089 nm_mpi_spin_unlock(&p_allocator->lock); \
1090 e->id = new_id; \
1091 return e; \
1092 } \
1093 \
1094 __attribute__((unused)) \
1095 static void nm_mpi_handle_##ENAME##_release(struct nm_mpi_handle_##ENAME##_s*p_allocator, TYPE*e) \
1096 { \
1097 const int id = e->id; \
1098 assert(id > 0); \
1099 nm_mpi_spin_lock(&p_allocator->lock); \
1100 assert(nm_mpi_entry_##ENAME##_vect_at(&p_allocator->table, id) == e); \
1101 nm_mpi_entry_##ENAME##_vect_put(&p_allocator->table, NULL, id); \
1102 puk_int_vect_push_back(&p_allocator->pool, id); \
1103 e->id = -1; \
1104 nm_mpi_spin_unlock(&p_allocator->lock); \
1105 } \
1106 \
1107 __attribute__((unused)) \
1108 static void nm_mpi_handle_##ENAME##_free(struct nm_mpi_handle_##ENAME##_s*p_allocator, TYPE*e) \
1109 { \
1110 if(e->id > 0) \
1111 nm_mpi_handle_##ENAME##_release(p_allocator, e); \
1112 ENAME##_free(&p_allocator->allocator, e); \
1113 } \
1114 \
1115 __attribute__((unused)) \
1116 static TYPE*nm_mpi_handle_##ENAME##_get(struct nm_mpi_handle_##ENAME##_s*p_allocator, int id) \
1117 { \
1118 assert(nm_mpi_handle_##ENAME##_initialized(p_allocator)); \
1119 TYPE*e = NULL; \
1120 if((id > 0) && (id < nm_mpi_entry_##ENAME##_vect_size(&p_allocator->table))) \
1121 { \
1122 nm_mpi_spin_lock(&p_allocator->lock); \
1123 e = nm_mpi_entry_##ENAME##_vect_at(&p_allocator->table, id); \
1124 nm_mpi_spin_unlock(&p_allocator->lock); \
1125 } \
1126 else \
1127 { \
1128 return NULL; \
1129 } \
1130 return e; \
1131 } \
1132 __attribute__((unused)) \
1133 static void nm_mpi_handle_##ENAME##_set_display(struct nm_mpi_handle_##ENAME##_s*p_allocator, char*(*display)(TYPE*)) \
1134 { \
1135 p_allocator->display = display; \
1136 }
1137
1138#define NM_MPI_HANDLE_NULL { .next_id = -1 }
1139
1140
1141/* ********************************************************* */
1142
1143/* ** submodules init/exit */
1144
1149
1152
1154
1157
1159
1161
1163
1166
1168
1172
1175
1177
1179
1182
1184
1186
1188
1191
1193
1196
1198
1201
1202void nm_mpi_cleanup_register(void(*p_func)(void*), void*p_arg);
1203void nm_mpi_cleanup_unregister(void(*p_func)(void*), void*p_arg);
1204
1205
1206/* ** Communicators **************************************** */
1207
1210{
1211 assert(p_comm->kind != NM_MPI_COMMUNICATOR_UNSPEC);
1212 if(p_comm->kind == NM_MPI_COMMUNICATOR_INTRA)
1213 return nm_comm_get_gate(p_comm->p_nm_comm, node);
1214 else if(p_comm->kind == NM_MPI_COMMUNICATOR_INTER)
1216 else
1217 NM_MPI_FATAL_ERROR("wrong kind %d for communicator %d.\n", p_comm->kind, p_comm->id);
1218 return NULL;
1219}
1220
1223{
1225 if(p_comm->kind == NM_MPI_COMMUNICATOR_INTER)
1226 {
1229 assert(rank >= 0);
1230 }
1231 return rank;
1232}
1233
1238
1239
1240/* ** Groups *********************************************** */
1241
1246
1251
1252
1253/* ** Err handlers ***************************************** */
1254
1259
1264
1265void nm_mpi_errhandler_exec_internal(struct nm_mpi_errhandler_s*p_errhandler, enum nm_mpi_errhandler_kind_e kind, int handle, int err,
1266 const char*func, const char*file, const int line);
1267
1270
1271/* ** Info Operations ************************************** */
1272
1277
1282
1287
1289void nm_mpi_info_define(struct nm_mpi_info_s*p_info, const char*p_key, const char*p_value);
1290
1295
1297void nm_mpi_info_copy(struct nm_mpi_info_s*p_dest_info, struct nm_mpi_info_s*p_src_info);
1298
1304void nm_mpi_info_update(struct nm_mpi_info_s*p_info_up, struct nm_mpi_info_s*p_info_origin);
1305
1306
1307/* ** Datatype functionalities ***************************** */
1308
1313
1314
1317
1322
1327
1328void nm_mpi_datatype_traversal_apply(const void*_content, struct nm_data_op_s*p_op);
1329
1335
1337#define nm_mpi_datatype_ref_inc(P_DATATYPE, P_HOLDER) nm_refcount_inc(&(P_DATATYPE)->refcount, (P_HOLDER))
1338
1339
1342
1345{
1346 return buf + count * p_datatype->extent;
1347}
1348
1351{
1352 nm_data_mpi_datatype_set(p_data, (struct nm_data_mpi_datatype_s){ .ptr = ptr, .p_datatype = p_datatype, .count = count });
1353}
1354
1356static inline void nm_mpi_datatype_pack(void*outbuf, const void*inbuf, nm_mpi_datatype_t*p_datatype, nm_mpi_count_t count)
1357{
1358 struct nm_data_s data;
1359 nm_mpi_data_build(&data, (void*)inbuf, p_datatype, count);
1360 nm_data_copy_from(&data, 0 /* offset */, nm_data_size(&data), outbuf);
1361}
1362
1364static inline void nm_mpi_datatype_unpack(const void*inbuf, void*outbuf, nm_mpi_datatype_t*p_datatype, nm_mpi_count_t count)
1365{
1366 struct nm_data_s data;
1367 nm_mpi_data_build(&data, outbuf, p_datatype, count);
1368 nm_data_copy_to(&data, 0 /* offset */, nm_data_size(&data), inbuf);
1369}
1370
1372static inline void nm_mpi_datatype_copy(const void*src_buf, nm_mpi_datatype_t*p_src_type, nm_mpi_count_t src_count,
1373 void*dest_buf, nm_mpi_datatype_t*p_dest_type, nm_mpi_count_t dest_count)
1374{
1375 struct nm_data_s src_data;
1376 nm_mpi_data_build(&src_data, (void*)src_buf, p_src_type, src_count);
1377 struct nm_data_s dest_data;
1378 nm_mpi_data_build(&dest_data, dest_buf, p_dest_type, dest_count);
1379 nm_data_copy(&dest_data, &src_data);
1380}
1381
1387
1394
1396
1398{
1399 nm_mpi_datatype_hash_t z = puk_hash_oneatatime((const void*)&p_datatype->combiner, sizeof(nm_mpi_type_combiner_t))
1400 + puk_hash_oneatatime((const void*)&p_datatype->count, sizeof(MPI_Count))
1401 + puk_hash_oneatatime((const void*)&p_datatype->lb, sizeof(MPI_Aint))
1402 + puk_hash_oneatatime((const void*)&p_datatype->extent, sizeof(MPI_Aint))
1403 + puk_hash_oneatatime((const void*)&p_datatype->size, sizeof(size_t));
1404 return z;
1405}
1406
1407/* ** Requests functions *********************************** */
1408
1409nm_mpi_request_t*nm_mpi_request_alloc(void);
1410
1413
1416
1419
1420void nm_mpi_request_free(nm_mpi_request_t*req);
1421
1422nm_mpi_request_t*nm_mpi_request_get(MPI_Request req_id);
1423
1424int nm_mpi_request_test(nm_mpi_request_t*p_req);
1425
1426int nm_mpi_request_wait(nm_mpi_request_t*p_req);
1427
1428void nm_mpi_request_complete(nm_mpi_request_t*p_req, MPI_Request*request);
1429
1431static inline void nm_mpi_request_set_datatype(nm_mpi_request_t*p_req, struct nm_mpi_datatype_s*p_datatype)
1432{
1433 p_req->p_datatype = p_datatype;
1434 if(p_datatype != NULL)
1436}
1437
1439static inline void nm_mpi_request_add_datatype2(nm_mpi_request_t*p_req, struct nm_mpi_datatype_s*p_datatype2)
1440{
1441 if(p_datatype2 != NULL)
1442 {
1443 assert(p_req != NULL);
1444 assert(p_req->p_datatype2 == NULL);
1445 p_req->p_datatype2 = p_datatype2;
1447 }
1448}
1449
1450void nm_mpi_file_request_status_update(nm_mpi_request_t*p_req, struct nm_mpi_status_s*p_status);
1451
1452int nm_mpi_file_request_test(nm_mpi_request_t*p_req);
1453
1454int nm_mpi_file_request_wait(nm_mpi_request_t*p_req);
1455
1456
1457/* ** Send/recv/status functions *************************** */
1458
1462int nm_mpi_isend_init(nm_mpi_request_t *p_req, int dest, nm_mpi_communicator_t *p_comm);
1463
1467int nm_mpi_isend_start(nm_mpi_request_t *p_req);
1468
1472int nm_mpi_isend(nm_mpi_request_t *p_req, int dest, nm_mpi_communicator_t *p_comm);
1473
1477int nm_mpi_irecv_init(nm_mpi_request_t *p_req, int source, nm_mpi_communicator_t *p_comm);
1478
1482int nm_mpi_irecv_start(nm_mpi_request_t *p_req);
1483
1487int nm_mpi_irecv(nm_mpi_request_t *p_req, int source, nm_mpi_communicator_t *p_comm);
1488
1489
1490/* ** Collectives ****************************************** */
1491
1496
1501
1505void nm_mpi_coll_wait(nm_mpi_request_t*p_req);
1506
1509int nm_mpi_coll_start(nm_mpi_request_t*p_req);
1510
1511void nm_mpi_coll_free(nm_mpi_request_t*p_req);
1512
1513
1517 const void*sendbuf, void*recvbuf,
1518 nm_tag_t tag, nm_mpi_operator_t*p_operator,
1524
1528 const void*sendbuf, void*recvbuf,
1529 nm_tag_t tag, nm_mpi_operator_t*p_operator);
1530
1531/* ** iallreduce */
1532
1535 const void*sendbuf, void*recvbuf,
1536 nm_tag_t tag, nm_mpi_operator_t*p_operator);
1537
1538/* ** ialltoall */
1539
1541 const void*sendbuf, nm_mpi_count_t sendcount, nm_mpi_datatype_t*p_send_datatype,
1542 void*recvbuf, nm_mpi_count_t recvcount, nm_mpi_datatype_t*p_recv_datatype);
1543
1544/* ** ialltoallv */
1545
1547 const void*sendbuf, const nm_mpi_count_t*sendcounts, const nm_mpi_aint_t*sdispls, nm_mpi_datatype_t*p_send_datatype,
1548 void*recvbuf, const nm_mpi_count_t*recvcounts, const nm_mpi_aint_t*rdispls, nm_mpi_datatype_t*p_recv_datatype);
1549
1550/* ** iallgather */
1551
1553 const void*sendbuf, nm_mpi_count_t sendcount, nm_mpi_datatype_t*p_send_datatype,
1554 void*recvbuf, nm_mpi_count_t recvcount, nm_mpi_datatype_t*p_recv_datatype);
1555
1556
1557/* ** Operators ******************************************** */
1558
1563
1571 nm_mpi_operator_t*p_operator);
1572
1573/* ** Communicator operations ****************************** */
1574
1576 enum nm_mpi_communicator_kind_e kind);
1577
1582
1584#define nm_mpi_communicator_ref_inc(P_COMM, P_HOLDER) nm_refcount_inc(&(P_COMM)->refcount, (P_HOLDER));
1585
1587
1588
1589/* ** Attributes ******************************************* */
1590
1592
1594
1596
1597void nm_mpi_attrs_create(struct nm_mpi_attrs_s*p_attrs, int id);
1598
1599int nm_mpi_attrs_copy(struct nm_mpi_attrs_s*p_old_attrs, struct nm_mpi_attrs_s*p_new_attrs);
1600
1601void nm_mpi_attrs_destroy(struct nm_mpi_attrs_s*p_old_attrs);
1602
1603int nm_mpi_attr_put(struct nm_mpi_attrs_s*p_attrs, struct nm_mpi_keyval_s*p_keyval, void*attr_value);
1604
1605void nm_mpi_attr_get(struct nm_mpi_attrs_s*p_attrs, struct nm_mpi_keyval_s*p_keyval, void**p_attr_value, int*flag);
1606
1607int nm_mpi_attr_delete(struct nm_mpi_attrs_s*p_attrs, struct nm_mpi_keyval_s*p_keyval);
1608
1609
1610/* ** Window operations *************************************/
1611
1616
1622{
1623 return __sync_fetch_and_add(&p_win->next_seq, 1);
1624}
1625
1630{
1631 int ret = __sync_bool_compare_and_swap(&p_epoch->nmsg, p_epoch->completed, p_epoch->nmsg);
1632 return ret;
1633}
1634
1640{
1641 int ret = NM_MPI_WIN_UNUSED != p_epoch->mode;
1642 return ret;
1643}
1644
1649static inline int nm_mpi_win_valid_assert(int assert)
1650{
1653 return ret;
1654}
1655
1661
1669
1670
1671/* ** RMA operations *************************************** */
1672
1677{
1678 return (tag & NM_MPI_TAG_PRIVATE_RMA_MASK_WIN) >> 32;
1679}
1680
1684static inline nm_tag_t nm_mpi_rma_win_to_tag(int win_id)
1685{
1686 return ((nm_tag_t)win_id) << 32;
1687}
1688
1692static inline uint16_t nm_mpi_rma_tag_to_seq(nm_tag_t tag)
1693{
1694 return (tag & NM_MPI_TAG_PRIVATE_RMA_MASK_SEQ) >> 8;
1695}
1696
1700static inline nm_tag_t nm_mpi_rma_seq_to_tag(uint16_t seq)
1701{
1702 return (nm_tag_t)((((nm_tag_t)seq) << 8) & 0xFFFF00);
1703}
1704
1709{
1710 return (tag & 0xF0) >> 4;
1711}
1712
1718{
1719 return (nm_tag_t)((((nm_tag_t)op) << 4) & 0xF0);
1720}
1721
1727{
1728 return nm_mpi_rma_seq_to_tag(seq) + (((nm_tag_t)user_tag) & 0xFC0000FF);
1729}
1730
1735static inline nm_tag_t nm_mpi_rma_create_tag(int win_id, uint16_t seq_num, int user_tag)
1736{
1737 return nm_mpi_rma_win_to_tag(win_id) + nm_mpi_rma_create_usertag(seq_num, user_tag);
1738}
1739
1740/* ** Keyval operations *************************************** */
1741
1743 nm_mpi_delete_subroutine_t*comm_delete_attr_fn,
1744 int*comm_keyval, void*extra_state);
1745
1747 nm_mpi_delete_subroutine_t*type_delete_attr_fn,
1748 int*type_keyval, void*extra_state);
1749
1751 nm_mpi_delete_subroutine_t*win_delete_attr_fn,
1752 int*win_keyval, void*extra_state);
1753
1754/* ** Threading ******************************************** */
1755
1756int nm_mpi_thread_level_get(int required);
1757
1758
1759/* ** Large counts ***************************************** */
1760
1762static inline nm_mpi_count_t*nm_mpi_array_count_from_int(nm_mpi_count_t n, const int*array_int)
1763{
1764 if(array_int == NULL)
1765 return NULL;
1766 nm_mpi_count_t*array_count = padico_malloc(sizeof(nm_mpi_count_t) * n);
1768 for(i = 0; i < n; i++)
1769 {
1770 array_count[i] = array_int[i];
1771 }
1772 return array_count;
1773}
1774
1776static inline nm_mpi_aint_t*nm_mpi_array_aint_from_int(nm_mpi_count_t n, const int*array_int)
1777{
1778 if(array_int == NULL)
1779 return NULL;
1780 nm_mpi_aint_t*array_aint = padico_malloc(sizeof(nm_mpi_aint_t) * n);
1782 for(i = 0; i < n; i++)
1783 {
1784 array_aint[i] = array_int[i];
1785 }
1786 return array_aint;
1787}
1788
1791{
1792 if(array_aint == NULL)
1793 return NULL;
1794 nm_mpi_count_t*array_count = padico_malloc(sizeof(nm_mpi_count_t) * n);
1796 for(i = 0; i < n; i++)
1797 {
1798 array_count[i] = array_aint[i];
1799 }
1800 return array_count;
1801}
1802
1804{
1805 if(array_count == NULL)
1806 return NULL;
1807 nm_mpi_count_t*copy_array_count = padico_malloc(sizeof(nm_mpi_count_t) * n);
1809 for(i = 0; i < n; i++)
1810 {
1811 copy_array_count[i] = array_count[i];
1812 }
1813 return copy_array_count;
1814}
1815
1817{
1818 if(array_aint == NULL)
1819 return NULL;
1820 nm_mpi_aint_t*copy_array_aint = padico_malloc(sizeof(nm_mpi_aint_t) * n);
1822 for(i = 0; i < n; i++)
1823 {
1824 copy_array_aint[i] = array_aint[i];
1825 }
1826 return copy_array_aint;
1827}
1828
1829static inline void nm_mpi_array_count_free(nm_mpi_count_t*array_count)
1830{
1831 if(array_count != NULL)
1832 padico_free(array_count);
1833}
1834
1835static inline void nm_mpi_array_aint_free(nm_mpi_aint_t*array_aint)
1836{
1837 if(array_aint != NULL)
1838 padico_free(array_aint);
1839}
1840
1841
1844#endif /* NM_MPI_PRIVATE_H */
struct nm_group_s * nm_group_t
type for groups
Definition nm_group.h:37
struct nm_mpi_errhandler_s nm_mpi_errhandler_t
error handler
#define NM_MPI_TAG_PRIVATE_RMA_MASK_SEQ
#define NM_MPI_TAG_PRIVATE_RMA_MASK_WIN
void nm_mpi_info_destructor(char *p_key, char *p_data)
#define nm_mpi_spinlock_t
static void nm_mpi_refcount_init(struct nm_refcount_s *p_refcount, const char *type __attribute__((unused)), int id)
struct nm_mpi_errhandler_s * nm_mpi_file_errhandler
default errhandler for files, attached to MPI_FILE_NULL
#define NM_MPI_FATAL_ERROR(...)
PUK_HASHTABLE_TYPE(nm_mpi_info, char *, char *, &puk_hash_string_default_hash, &puk_hash_string_default_eq, &nm_mpi_info_destructor)
hashtable type for info entries
struct nm_core_event_s __attribute__
Definition nm_data.h:530
#define NM_DATA_TYPE(ENAME, CONTENT_TYPE, OPS)
macro to generate typed functions to init/access data fields.
Definition nm_data.h:222
static nm_len_t nm_data_size(const struct nm_data_s *p_data)
returns the amount of data contained in the descriptor
Definition nm_data.h:665
void nm_data_copy(struct nm_data_s *p_dest, struct nm_data_s *p_from)
copy from nm_data to another nm_data
void nm_data_copy_to(const struct nm_data_s *p_data, nm_len_t offset, nm_len_t len, const void *srcbuf)
copy chunk of data from contiguous buffer to user layout
void nm_data_copy_from(const struct nm_data_s *p_data, nm_len_t offset, nm_len_t len, void *destbuf)
copy chunk of data from user layout to contiguous buffer
nm_status_t nm_cond_status_t
status with synchronization (wait/signal)
standard MPI public header
void(* nm_coll_req_notifier_t)(void *ref)
notification function for collective reqs
Definition nm_coll.h:96
static nm_gate_t nm_comm_get_gate(nm_comm_t p_comm, int rank)
static nm_session_t nm_comm_get_session(nm_comm_t p_comm)
static int nm_comm_get_dest(nm_comm_t p_comm, nm_gate_t p_gate)
static void nm_refcount_init(struct nm_refcount_s *p_refcount, char *p_object_id, const void *p_init_holder)
initialize a new refcount object; get the object ID to make debugging easier; we take ownership of ob...
nm_tag_t tag
the user-supplied tag
assert(p_data->ops.p_traversal !=NULL)
nm_data_propertie_gpu_preinit & p_data
Definition nm_data.h:530
static nm_gate_t p_gate
int nm_group_size(nm_group_t group)
nm_gate_t nm_group_get_gate(nm_group_t p_group, int rank)
uint64_t req
a type of debug request; unused for now
Definition nm_headers.h:1
uint16_t len
chunk len
Definition nm_headers.h:0
nm_seq_t seq
sequence number
Definition nm_headers.h:2
void MPI_User_function(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
User combination function for reduction.
void MPI_User_function_c(void *invec, void *inoutvec, MPI_Count *len, MPI_Datatype *datatype)
void() MPI_File_errhandler_function(MPI_File *, int *,...)
Definition nm_mpi_io.h:39
static nm_tag_t nm_mpi_rma_seq_to_tag(uint16_t seq)
Encode a sequence number inside the tag to handle THREAD_MULTIPLE.
int nm_mpi_irecv_init(nm_mpi_request_t *p_req, int source, nm_mpi_communicator_t *p_comm)
Initialises a receiving request.
void nm_mpi_info_lazy_init(void)
nm_mpi_request_t * nm_mpi_coll_irecv(void *buffer, nm_mpi_count_t count, nm_mpi_datatype_t *p_datatype, int source, nm_tag_t tag, nm_mpi_communicator_t *p_comm)
Receive data sent over the communicator via nm_mpi_coll_isend.
static int nm_mpi_win_valid_assert(int assert)
Check whether or not an assert if only a combination of defined symbols.
static int nm_mpi_communicator_get_dest(nm_mpi_communicator_t *p_comm, nm_gate_t p_gate)
Gets the node associated to the given gate.
int8_t nm_mpi_status_t
nm_mpi_group_t * nm_mpi_group_alloc(void)
Allocate a new internal representation of a group.
int nm_mpi_attr_delete(struct nm_mpi_attrs_s *p_attrs, struct nm_mpi_keyval_s *p_keyval)
void nm_mpi_attrs_lazy_exit(void)
void nm_mpi_datatype_hashtable_insert(nm_mpi_datatype_t *p_datatype)
void * extra_state
struct nm_mpi_win_locklist_s nm_mpi_win_locklist_t
static void nm_mpi_array_count_free(nm_mpi_count_t *array_count)
void nm_mpi_comm_lazy_init(void)
init communicator sub-system
void nm_mpi_cleanup_unregister(void(*p_func)(void *), void *p_arg)
void nm_mpi_datatype_exchange_init(void)
struct nm_mpi_group_s nm_mpi_group_t
Internal group.
__PUK_SYM_INTERNAL const struct nm_data_ops_s nm_mpi_datatype_ops
void nm_mpi_datatype_deserialize(nm_mpi_datatype_ser_t *p_datatype, MPI_Datatype *p_newtype)
Deserialize a new datatype from the informations given in p_datatype.
nm_mpi_request_t * nm_mpi_coll_isend(const void *buffer, nm_mpi_count_t count, nm_mpi_datatype_t *p_datatype, int dest, nm_tag_t tag, nm_mpi_communicator_t *p_comm)
Collective send over the communicator.
struct nm_coll_req_s * nm_mpi_coll_ialltoall(nm_mpi_communicator_t *p_comm, const void *sendbuf, nm_mpi_count_t sendcount, nm_mpi_datatype_t *p_send_datatype, void *recvbuf, nm_mpi_count_t recvcount, nm_mpi_datatype_t *p_recv_datatype)
int nm_mpi_irecv_start(nm_mpi_request_t *p_req)
Starts a receiving request.
int nm_mpi_win_addr_is_valid(void *base, nm_mpi_aint_t extent, nm_mpi_window_t *p_win)
Check whether base is part of a memory segment attached to p_win, and if the data fit,...
nm_mpi_request_t * nm_mpi_request_alloc_send(nm_mpi_request_type_t type, nm_mpi_count_t count, const void *sbuf, struct nm_mpi_datatype_s *p_datatype, int tag, struct nm_mpi_communicator_s *p_comm)
void nm_mpi_info_update(struct nm_mpi_info_s *p_info_up, struct nm_mpi_info_s *p_info_origin)
Update or add new entry in p_info_origin based on the entry from p_info_up.
#define _NM_MPI_MAX_DATATYPE_SIZE
uint32_t nm_mpi_datatype_hash_t
a hash to identify a datatype across nodes
struct nm_mpi_info_s * nm_mpi_info_alloc(void)
Allocates a new instance of the internal representation of an info.
static int nm_mpi_win_completed_epoch(nm_mpi_win_epoch_t *p_epoch)
Returns whether the epoch requests are all completed.
void nm_mpi_coll_wait(nm_mpi_request_t *p_req)
Wait for the end of the p2p communication over communicator via nm_mpi_coll_isend.
nm_mpi_communicator_t * nm_mpi_communicator_alloc(nm_comm_t p_nm_comm, struct nm_mpi_errhandler_s *p_errhandler, enum nm_mpi_communicator_kind_e kind)
__PUK_SYM_INTERNAL const struct nm_data_ops_s nm_mpi_datatype_serialize_ops
void nm_mpi_win_init(void)
init window sub-system
void nm_mpi_io_exit(void)
MPI_Request id
identifier of the request
void nm_mpi_datatype_exchange_exit(void)
int nm_mpi_isend_start(nm_mpi_request_t *p_req)
Starts a sending request.
nm_mpi_count_t recvcount
nm_gate_t gate
gate of the destination or the source node
int root
void nm_mpi_attrs_destroy(struct nm_mpi_attrs_s *p_old_attrs)
int nm_mpi_attr_put(struct nm_mpi_attrs_s *p_attrs, struct nm_mpi_keyval_s *p_keyval, void *attr_value)
struct nm_mpi_info_s * nm_mpi_info_dup(struct nm_mpi_info_s *p_info)
Duplicates the internal representation of the given info.
struct nm_mpi_datatype_s * p_datatype2
second datatype for collectives that need different types for send & recv; used only for ref counting
void nm_mpi_info_lazy_exit(void)
const void * sbuf
pointer for sending
void nm_mpi_file_request_status_update(nm_mpi_request_t *p_req, struct nm_mpi_status_s *p_status)
int nm_mpi_coll_reduce(nm_mpi_communicator_t *p_comm, int root, nm_mpi_count_t count, nm_mpi_datatype_t *p_datatype, const void *sendbuf, void *recvbuf, nm_tag_t tag, nm_mpi_operator_t *p_operator)
blocking reduce
void nm_mpi_info_free(struct nm_mpi_info_s *p_info)
Frees the given instance of the internal representation of an info.
static nm_session_t nm_mpi_communicator_get_session(nm_mpi_communicator_t *p_comm)
nm_mpi_request_t * nm_mpi_request_alloc(void)
static nm_mpi_aint_t * nm_mpi_array_aint_copy(nm_mpi_count_t n, const nm_mpi_aint_t *array_aint)
struct nm_coll_req_s * nm_mpi_coll_iallgather(nm_mpi_communicator_t *p_comm, const void *sendbuf, nm_mpi_count_t sendcount, nm_mpi_datatype_t *p_send_datatype, void *recvbuf, nm_mpi_count_t recvcount, nm_mpi_datatype_t *p_recv_datatype)
int nm_mpi_datatype_send(nm_gate_t gate, nm_mpi_datatype_t *p_datatype)
Send a datatype to a distant node identified by its gate.
static void * nm_mpi_datatype_get_ptr(void *buf, nm_mpi_count_t count, const nm_mpi_datatype_t *p_datatype)
get a pointer on the count'th data buffer
int nm_mpi_thread_level_get(int required)
static nm_mpi_count_t * nm_mpi_array_count_copy(nm_mpi_count_t n, const nm_mpi_count_t *array_count)
PUK_LIST_DECLARE_TYPE(nm_mpi_request)
struct nm_mpi_operator_s * p_op
static void nm_mpi_datatype_unpack(const void *inbuf, void *outbuf, nm_mpi_datatype_t *p_datatype, nm_mpi_count_t count)
Unpack data from a contiguous buffers.
void nm_mpi_coll_free(nm_mpi_request_t *p_req)
int nm_mpi_win_create_keyval_fort(nm_mpi_copy_subroutine_t *win_copy_attr_fn, nm_mpi_delete_subroutine_t *win_delete_attr_fn, int *win_keyval, void *extra_state)
static void nm_mpi_array_aint_free(nm_mpi_aint_t *array_aint)
const void * sendbuf
void nm_mpi_op_lazy_init(void)
nm_mpi_request_t * nm_mpi_request_alloc_recv(nm_mpi_count_t count, void *rbuf, struct nm_mpi_datatype_s *p_datatype, int tag, struct nm_mpi_communicator_s *p_comm)
static nm_gate_t nm_mpi_communicator_get_gate(nm_mpi_communicator_t *p_comm, int node)
Gets the in/out gate for the given node.
void nm_mpi_datatype_lazy_exit(void)
struct nm_mpi_keyval_s * nm_mpi_keyval_get(int id)
struct nm_mpi_win_pass_mngmt_s nm_mpi_win_pass_mngmt_t
void nm_mpi_group_lazy_exit(void)
void nm_mpi_info_copy(struct nm_mpi_info_s *p_dest_info, struct nm_mpi_info_s *p_src_info)
Copy content o p_src_info into p_dest_info.
void nm_mpi_win_exit(void)
int nm_mpi_type_create_keyval_fort(nm_mpi_copy_subroutine_t *type_copy_attr_fn, nm_mpi_delete_subroutine_t *type_delete_attr_fn, int *type_keyval, void *extra_state)
struct nm_mpi_datatype_s nm_mpi_datatype_t
Internal datatype.
void nm_mpi_op_lazy_exit(void)
nm_mpi_request_t * nm_mpi_request_get(MPI_Request req_id)
struct nm_mpi_datatype_s * p_datatype
type of the exchanged data
nm_mpi_count_t nm_mpi_datatype_get_elements(nm_mpi_datatype_t *p_datatype, nm_len_t size)
get how many base elements from datatype fit into given size
void nm_mpi_comm_lazy_exit(void)
int nm_mpi_coll_start(nm_mpi_request_t *p_req)
Start a persistent collective.
int nm_mpi_win_send_datatype(nm_mpi_datatype_t *p_datatype, int target_rank, nm_mpi_window_t *p_win)
Looks up in the hashtable if the datatype is already exchanged with the target node.
void nm_mpi_info_define(struct nm_mpi_info_s *p_info, const char *p_key, const char *p_value)
Define a value in the given infoset.
void nm_mpi_coll_ireduce_start(struct nm_coll_req_s *p_coll_req)
start an already initialized ireduce
__PUK_SYM_INTERNAL const struct nm_data_ops_s nm_mpi_datatype_wrapper_ops
nm_mpi_communicator_t * p_comm
communicator used for communication
int nm_mpi_request_test(nm_mpi_request_t *p_req)
int() nm_mpi_attr_delete_fn_t(int object_id, int keyval_id, void *attribute_val, void *extra_state)
#define nm_mpi_datatype_ref_inc(P_DATATYPE, P_HOLDER)
increment refcount on given datatype
void nm_mpi_attrs_create(struct nm_mpi_attrs_s *p_attrs, int id)
void * rbuf
pointer used for receiving
nm_mpi_window_t * p_win
corresponding rma window
struct nm_coll_req_s * nm_mpi_coll_ireduce_init(nm_mpi_communicator_t *p_comm, int root, nm_mpi_count_t count, nm_mpi_datatype_t *p_datatype, const void *sendbuf, void *recvbuf, nm_tag_t tag, nm_mpi_operator_t *p_operator, nm_coll_req_notifier_t p_notify, void *ref)
internal implementation of collective Ireduce
void nm_mpi_request_free(nm_mpi_request_t *req)
static nm_mpi_aint_t * nm_mpi_array_aint_from_int(nm_mpi_count_t n, const int *array_int)
convert an array of int to an array of aint
void nm_mpi_session_lazy_exit(void)
static int nm_mpi_win_is_ready(nm_mpi_win_epoch_t *p_epoch)
Check whether the epoch (exposure or acces, passive or active) is opened.
void() nm_mpi_delete_subroutine_t(int *id, int *keyval, void *attribute_val, void *extra_state, int *ierr)
int user_tag
tag given by the user
void nm_mpi_attr_destructor(struct nm_mpi_keyval_s *p_keyval, void *p_value)
nm_mpi_datatype_t * nm_mpi_datatype_hashtable_get(nm_mpi_datatype_hash_t datatype_hash)
Gets the internal representation of the given datatype from its hash.
void * recvbuf
nm_mpi_window_t * nm_mpi_window_get(MPI_Win win)
Gets the internal representation of the given window.
int nm_mpi_comm_create_keyval_fort(nm_mpi_copy_subroutine_t *comm_copy_attr_fn, nm_mpi_delete_subroutine_t *comm_delete_attr_fn, int *comm_keyval, void *extra_state)
struct nm_mpi_keyval_s * nm_mpi_keyval_new(void)
static void nm_mpi_datatype_copy(const void *src_buf, nm_mpi_datatype_t *p_src_type, nm_mpi_count_t src_count, void *dest_buf, nm_mpi_datatype_t *p_dest_type, nm_mpi_count_t dest_count)
Copy data using datatype layout.
void(* nm_mpi_datatype_apply_t)(void *ptr, nm_len_t len, void *_ref)
function apply to each datatype or sub-datatype upon traversal
static nm_tag_t nm_mpi_rma_create_usertag(uint16_t seq, int user_tag)
Create the tag for private rma operations, without the window encoded id.
void nm_mpi_io_init(void)
init MPI I/O sub-system
void nm_mpi_attrs_lazy_init(void)
int nm_mpi_datatype_ref_dec(nm_mpi_datatype_t *p_datatype, const void *p_holder)
decrements refcount on given datatype, free datatype if refcount reaches 0.
static nm_tag_t nm_mpi_rma_mpi_op_to_tag(MPI_Op op)
Encode an operation id inside the tag for MPI_Accumulate and MPI_Get_accumulate functions.
struct nm_mpi_errhandler_s * nm_mpi_errhandler_alloc(enum nm_mpi_errhandler_kind_e kind, MPI_Handler_function *func)
Allocate a new internal representation of a errhandler.
struct nm_coll_req_s * nm_mpi_coll_ialltoallv(nm_mpi_communicator_t *p_comm, const void *sendbuf, const nm_mpi_count_t *sendcounts, const nm_mpi_aint_t *sdispls, nm_mpi_datatype_t *p_send_datatype, void *recvbuf, const nm_mpi_count_t *recvcounts, const nm_mpi_aint_t *rdispls, nm_mpi_datatype_t *p_recv_datatype)
static int nm_mpi_rma_tag_to_win(nm_tag_t tag)
Decode the win_id from the tag.
void nm_mpi_err_lazy_exit(void)
decrement refcount to 'err' submodule
static uint16_t nm_mpi_win_get_next_seq(nm_mpi_window_t *p_win)
Returns the next sequence number for the given window, and increments it, lock free.
int nm_mpi_request_wait(nm_mpi_request_t *p_req)
int nm_mpi_irecv(nm_mpi_request_t *p_req, int source, nm_mpi_communicator_t *p_comm)
Receives data.
static MPI_Op nm_mpi_rma_tag_to_mpi_op(nm_tag_t tag)
Decode the operation id from the tag.
nm_mpi_request_t * nm_mpi_request_alloc_icol(nm_mpi_request_type_t type, nm_mpi_count_t count, struct nm_mpi_datatype_s *p_datatype, struct nm_mpi_communicator_s *p_comm)
void nm_mpi_datatype_properties_compute(nm_mpi_datatype_t *p_datatype)
Computes properties for datatype (LB, UB, extent, contig, etc.) Called automatically upon commit or d...
int nm_mpi_file_request_wait(nm_mpi_request_t *p_req)
static nm_mpi_datatype_hash_t nm_mpi_datatype_hash_common(const nm_mpi_datatype_t *p_datatype)
static void nm_mpi_request_add_datatype2(nm_mpi_request_t *p_req, struct nm_mpi_datatype_s *p_datatype2)
attach a second datatype to this request
#define NM_MPI_WIN_UNUSED
int nm_mpi_err_lastused(void)
get the last used error class
nm_mpi_count_t sendcount
static void nm_mpi_data_build(struct nm_data_s *p_data, void *ptr, struct nm_mpi_datatype_s *p_datatype, nm_mpi_count_t count)
build a data descriptor for mpi data
nm_mpi_operator_t * nm_mpi_operator_get(MPI_Op op)
Gets the function associated to the given operator.
struct nm_coll_req_s * p_coll_req
non-blocking nmad native collective
struct nm_coll_req_s * nm_mpi_coll_iallreduce(nm_mpi_communicator_t *p_comm, nm_mpi_count_t count, nm_mpi_datatype_t *p_datatype, const void *sendbuf, void *recvbuf, nm_tag_t tag, nm_mpi_operator_t *p_operator)
static void nm_mpi_request_set_datatype(nm_mpi_request_t *p_req, struct nm_mpi_datatype_s *p_datatype)
attach data to a request
void nm_mpi_rma_init(void)
init rma sub-system
void nm_mpi_request_complete(nm_mpi_request_t *p_req, MPI_Request *request)
void() nm_mpi_copy_subroutine_t(int *id, int *keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag, int *ierr)
subroutine types for FORTRAN attributes binding
int nm_mpi_attrs_copy(struct nm_mpi_attrs_s *p_old_attrs, struct nm_mpi_attrs_s *p_new_attrs)
void nm_mpi_errhandler_exec_internal(struct nm_mpi_errhandler_s *p_errhandler, enum nm_mpi_errhandler_kind_e kind, int handle, int err, const char *func, const char *file, const int line)
void nm_mpi_rma_exit(void)
void nm_mpi_cleanup_register(void(*p_func)(void *), void *p_arg)
void nm_mpi_err_lazy_init(void)
increment refcount to 'err' submodule
nm_mpi_communicator_t * nm_mpi_communicator_get(MPI_Comm comm)
Gets the internal representation of the given communicator.
struct nm_mpi_datatype_ser_s nm_mpi_datatype_ser_t
Serialized version of the internal datatype.
nm_mpi_count_t count
number of elements to be exchanged
static nm_mpi_count_t * nm_mpi_array_count_from_int(nm_mpi_count_t n, const int *array_int)
convert an array of int to an array of counts
void nm_mpi_datatype_lazy_init(void)
init datatype subsystem
static uint16_t nm_mpi_rma_tag_to_seq(nm_tag_t tag)
Decode the sequence number from the tag.
static void nm_mpi_datatype_pack(void *outbuf, const void *inbuf, nm_mpi_datatype_t *p_datatype, nm_mpi_count_t count)
Pack data into a contiguous buffers.
struct nm_mpi_communicator_s nm_mpi_communicator_t
Internal communicator.
void nm_mpi_datatype_traversal_apply(const void *_content, struct nm_data_op_s *p_op)
void nm_mpi_request_lazy_exit(void)
struct nm_mpi_errhandler_s * nm_mpi_errhandler_get(int errhandler, enum nm_mpi_errhandler_kind_e kind)
Gets the internal representation of the given errhandler.
struct nm_mpi_operator_s nm_mpi_operator_t
Internal reduce operators.
PUK_LIST_CREATE_FUNCS(nm_mpi_request)
void nm_mpi_communicator_ref_dec(nm_mpi_communicator_t *p_comm, const void *p_holder)
void nm_mpi_session_lazy_init(void)
void nm_mpi_group_lazy_init(void)
increment refcount for 'group' sub-system
int nm_mpi_isend_init(nm_mpi_request_t *p_req, int dest, nm_mpi_communicator_t *p_comm)
Initialises a sending request.
int nm_mpi_file_request_test(nm_mpi_request_t *p_req)
nm_mpi_win_epoch_t * p_epoch
corresponding epoch management structure for rma operations
size_t nm_mpi_datatype_size(nm_mpi_datatype_t *p_datatype)
Gets the size of the given datatype.
void nm_mpi_keyval_delete(struct nm_mpi_keyval_s *p_keyval)
struct nm_mpi_info_s * nm_mpi_info_get(MPI_Info info)
Gets the internal representation of the given info.
static nm_tag_t nm_mpi_rma_win_to_tag(int win_id)
Encode a window id inside the tag to handle the multiple windows.
void nm_mpi_operator_apply(void *invec, void *outvec, nm_mpi_count_t count, nm_mpi_datatype_t *p_datatype, nm_mpi_operator_t *p_operator)
Apply the operator to every chunk of data described by p_datatype and pointed by outvec,...
void nm_mpi_request_lazy_init(void)
init request sub-system
int32_t nm_mpi_request_type_t
Type of a communication request.
static nm_tag_t nm_mpi_rma_create_tag(int win_id, uint16_t seq_num, int user_tag)
Create the tag for private rma operations, with the first 32 bits used for window id.
nm_mpi_group_t * nm_mpi_group_get(MPI_Group group)
Gets the internal representation of the given group.
int() nm_mpi_attr_copy_fn_t(int object_id, int keyval_id, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag)
generic C type for comm/win/types attributes
nm_mpi_datatype_t * nm_mpi_datatype_get(MPI_Datatype datatype)
Gets the internal representation of the given datatype.
void nm_mpi_attr_get(struct nm_mpi_attrs_s *p_attrs, struct nm_mpi_keyval_s *p_keyval, void **p_attr_value, int *flag)
int nm_mpi_isend(nm_mpi_request_t *p_req, int dest, nm_mpi_communicator_t *p_comm)
Sends data.
static nm_mpi_count_t * nm_mpi_array_count_from_aint(nm_mpi_count_t n, const nm_mpi_aint_t *array_aint)
convert an array of MPI_Aint to an array of counts
#define MPI_MODE_NOPUT
int MPI_Op
Operator handle.
int MPI_Grequest_free_function(void *extra_state)
int MPI_Request
Request handle.
int MPI_Grequest_cancel_function(void *extra_state, int complete)
void() MPI_Comm_errhandler_function(MPI_Comm *, int *,...)
int MPI_Group
Group handle.
#define MPI_GRAPH
graph topology
nm_mpi_type_combiner_t
Types of datatypes.
nm_mpi_aint_t MPI_Aint
type that holds an address
int MPI_Comm
Communicator handle.
void() MPI_Win_errhandler_function(MPI_Win *, int *,...)
int MPI_Win
Window handle.
intptr_t nm_mpi_aint_t
internal type for address
void MPI_Session_errhandler_function(MPI_Session *, int *error_code,...)
#define MPI_MODE_NOCHECK
int MPI_Grequest_query_function(void *extra_state, MPI_Status *status)
int64_t nm_mpi_count_t
internal type for counts
int MPI_Info
An info opaque object.
#define MPI_MODE_NOPRECEDE
void() MPI_Handler_function(MPI_Comm *, int *,...)
#define MPI_MODE_NOSUCCEED
#define MPI_MODE_NOSTORE
nm_mpi_count_t MPI_Count
public type for counts
#define MPI_CART
cartesian topology
#define MPI_UNDEFINED
int MPI_Datatype
Datatype handle.
nm_len_t size
size of the onsided data (not incuding target-side completion)
main header for private nmad definitions.
This is the common public header for NewMad.
uint64_t nm_tag_t
user tags, 64 bits, contained in indirect hashtable
Definition nm_types.h:56
uint64_t nm_len_t
data length used by nmad
Definition nm_types.h:68
nm_coll_req_notifier_t p_notify
notification function for op termination
nm_coll_req_kind_t kind
nm_mpi_datatype_hash_t datatype_hash
datatype-to-be-send hash
nm_mpi_count_t count
number of elements
nm_mpi_aint_t offset
data offset
content for datatype traversal
void * ptr
pointer to base data
struct nm_mpi_datatype_s * p_datatype
datatype describing data layout
nm_mpi_count_t count
number of elements
content for datatype traversal and sending
struct nm_data_mpi_datatype_header_s header
header for datatype
struct nm_data_mpi_datatype_s data
datatype describing data layout
set of operations available on data type.
Definition nm_data.h:188
block of static properties for a given data descriptor
Definition nm_data.h:93
a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers
Definition nm_data.h:199
Connection to another process.
Definition nm_gate.h:104
an attribute table
int id
ID of the object this table is attached to (comm, datatype, win, ...)
struct nm_mpi_attr_hashtable_s table
int * dims
number of procs in each dim.
int size
pre-computed size of cartesian topology
int remote_offset
offset of remote group in global nm_comm
int rank
rank of self in local group
Internal communicator.
struct nm_mpi_attrs_s attrs
communicator attributes, hashed by keyval descriptor
struct nm_mpi_communicator_s::nm_mpi_cart_topology_s cart_topology
struct nm_refcount_s refcount
number of references pointing to this type (active communications, handle)
struct nm_mpi_info_s * p_info
info hints
enum nm_mpi_communicator_s::nm_mpi_topology_kind_e topo
nm_comm_t p_nm_comm
underlying nmad intra-communicator (or overlay for inter-communicator)
enum nm_mpi_communicator_s::nm_mpi_communicator_kind_e kind
struct nm_mpi_communicator_s::nm_mpi_intercomm_s intercomm
int id
id of the communicator
char * name
communicator name
nm_mpi_errhandler_t * p_errhandler
error handler attached to communicator
Internal datatype.
struct nm_mpi_datatype_s::@67::@75 HINDEXED
struct nm_mpi_datatype_s::@67::@77 HINDEXED_BLOCK
int is_contig
whether entirely contiguous
size_t ser_size
size of the datatype once serialized
struct nm_mpi_datatype_s::@67::@74 INDEXED
nm_mpi_count_t blocklength
struct nm_mpi_datatype_s::@67::@79 STRUCT
struct nm_mpi_datatype_s::@67::@73 HVECTOR
nm_mpi_datatype_ser_t * p_serialized
serialized version of the type.
struct nm_mpi_datatype_s::@67::@71 CONTIGUOUS
nm_mpi_count_t lb
lower bound of type
nm_mpi_count_t elements
number of base elements in the datatype
struct nm_mpi_attrs_s attrs
datatype attributes, hashed by keyval descriptor
struct nm_mpi_datatype_s::@67::@74::nm_mpi_type_indexed_map_s * p_map
nm_mpi_aint_t * array_of_displacements
nm_mpi_aint_t hstride
stride in bytes
struct nm_refcount_s refcount
number of references pointing to this type (active communications, handle)
int is_compact
whether contiguous && lb == 0 && extent == size
struct nm_data_properties_s props
pre-computed data properties
nm_mpi_count_t * array_of_displacements
struct nm_mpi_datatype_s::@67::@70 RESIZED
struct nm_mpi_datatype_s::@67::@78::nm_mpi_type_subarray_dim_s * p_dims
struct nm_mpi_datatype_s::@67::@76 INDEXED_BLOCK
struct nm_mpi_datatype_s::@67::@72 VECTOR
struct nm_mpi_datatype_s * p_old_type
nm_mpi_aint_t displacement
displacement in multiple of oldtype extent
struct nm_mpi_datatype_s::@67::@78 SUBARRAY
size_t size
size of type
nm_mpi_aint_t stride
stride in multiple of datatype extent
nm_mpi_count_t true_extent
nm_mpi_count_t count
number of blocks in type map
nm_mpi_datatype_hash_t hash
(probably unique) datatype hash
nm_mpi_count_t extent
extent of type; upper bound is lb + extent
struct nm_mpi_datatype_s::@67::@69 DUP
int committed
whether committed or not
nm_mpi_count_t true_lb
nm_mpi_type_combiner_t combiner
combiner of datatype elements
void * DATA
The following array inlined in the structure : MPI_Aint*displacements; < displacement in bytes.
void * DATA
The two following arrays inlined in the structure : int*blocklengths; MPI_Aint*displacements; < displ...
void * DATA
The following array inlined in the structure : int*displacements;.
void * DATA
The two following arrays inlined in the structure : int*blocklengths; int*displacements; < displaceme...
void * DATA
The three following arrays inlined in the structure : nm_mpi_datatype_hash_t*old_types; int*blockleng...
void * DATA
The three following arrays inlined in the structure : int*sizes; int*subsizes; int*starts;.
Serialized version of the internal datatype.
size_t ser_size
size of the datatype once serialized
nm_mpi_type_combiner_t combiner
combiner of datatype elements
nm_mpi_datatype_hash_t hash
(probably unique) datatype hash
nm_mpi_count_t count
number of blocks in type map
union nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u p
MPI_Comm_errhandler_function * comm_func
union nm_mpi_errhandler_s::@34 function
enum nm_mpi_errhandler_s::nm_mpi_errhandler_kind_e kind
MPI_Handler_function * legacy
MPI_Win_errhandler_function * win_func
MPI_File_errhandler_function * file_func
MPI_Session_errhandler_function * session_func
Internal group.
nm_group_t p_nm_group
underlying nmad group
int id
ID of the group (handle)
content for MPI_Info
int id
object ID
struct nm_mpi_info_hashtable_s content
hashtable of <keys, values>
a keyval used to index comm/types/win attributes
nm_mpi_attr_delete_fn_t * delete_fn
delete callback function for C binding
struct nm_refcount_s refcount
number of attributes indexed by this keyval
nm_mpi_delete_subroutine_t * delete_subroutine
delete callback function for Fortran binding
nm_mpi_copy_subroutine_t * copy_subroutine
copy callback function for Fortran binding
void * extra_state
user-supplied pointer given to callbacks
int id
ID of this keyval.
nm_mpi_attr_copy_fn_t * copy_fn
copy callback function for C binding
Internal reduce operators.
MPI_User_function_c * function_c
MPI_User_function * function
Internal communication request.
MPI_Request id
identifier of the request
struct nm_mpi_datatype_s * p_datatype
type of the exchanged data
MPI_Grequest_cancel_function * cancel_fn
struct nm_mpi_request_s::@37::@39::@42::@45 reduce
struct nm_mpi_request_s::@37::@40 partitioned
nm_mpi_count_t * p_recvcounts
nm_mpi_window_t * p_win
corresponding rma window
nm_mpi_aint_t * p_sdispls
int user_tag
tag given by the user
const void * sendbuf
nm_mpi_status_t status
status of request
nm_mpi_request_type_t request_type
type of the request
nm_mpi_win_epoch_t * p_epoch
corresponding epoch management structure for rma operations
char static_buf[64]
static buffer of max predefined datatype size
struct nm_mpi_request_s::@37::@41 rma
fields for send/recv requests created by the RMA operations
struct nm_mpi_request_s::@37::nm_mpi_grequest_s grequest
struct nm_mpi_file_op_s * p_file_op
MPI-IO operation.
nm_gate_t gate
gate of the destination or the source node
struct nm_mpi_datatype_s * p_sendtype
struct nm_mpi_request_s::@37::@39::@42::@47 gather
struct nm_mpi_request_s::@37::@39::@42::@46 allreduce
struct nm_mpi_request_s::@37::@39::@42::@48 allgather
nm_mpi_count_t * p_sendcounts
nm_mpi_count_t sendcount
struct nm_mpi_request_s::@37::@39::@42::@44 bcast
int request_source
rank of the source node (used for incoming request)
struct nm_mpi_request_s::@37::@39::@42::@49 alltoall
nm_mpi_aint_t * p_rdispls
struct nm_mpi_datatype_s * p_recvtype
const void * sbuf
pointer for sending
struct nm_mpi_grequest_s * p_grequest
generalized request
PUK_LIST_LINK(nm_mpi_request)
Link for nm_mpi_reqlist_t lists.
nm_mpi_count_t count
number of elements to be exchanged
MPI_Grequest_query_function * query_fn
MPI_Grequest_free_function * free_fn
struct nm_mpi_request_s::@37::@39 collective
nm_mpi_count_t recvcount
nm_sr_request_t request_nmad
nmad request for sendrecv interface
int partitions
number of partitions
struct nm_mpi_operator_s * p_op
struct nm_coll_req_s * p_coll_req
non-blocking nmad native collective
struct nm_data_s * p_recv_data
nm_cond_status_t completed
set to NM_STATUS_FINALIZED when user signals completion
struct nm_data_s send_data
void * rbuf
pointer used for receiving
struct nm_mpi_request_s::@37::@39::@42::@50 alltoallv
nm_mpi_communicator_t * p_comm
communicator used for communication
struct nm_mpi_datatype_s * p_datatype2
second datatype for collectives that need different types for send & recv; used only for ref counting
int request_error
error status of the request, using MPI error codes
struct nm_mpi_info_s * p_info
nm_mpi_errhandler_t * p_errhandler
error handler attached to session
Status handle.
volatile int mode
window mode for the given pair
uint64_t completed
counter of completed requests
uint64_t nmsg
number of messages exchanges during this epoch
struct nm_mpi_request_list_s pending
pending requests
nm_spinlock_t lock
lock for pending requests access
nm_mpi_win_locklist_t q
lock protected pending lock request list
uint16_t lock_type
current lock type.
uint64_t excl_pending
whether there is an exclusive lock request pending
uint64_t naccess
number of procs that are currently accessing this window
Content for MPI_Win.
int id
identifier of the window
nm_mpi_win_epoch_t * exposure
nm_mpi_win_epoch_t * access
epoch management
uint16_t next_seq
SEQUENCE/EPOCH NUMBER MANAGEMENT
struct nm_sr_monitor_s monitor
window core monitor for asynchronous call
void * p_base
data base address of the window
nm_spinlock_t lock
memory access protecting lock
int mem_model
window memory model
int myrank
window's rank into the communicator
nm_mpi_win_pass_mngmt_t waiting_queue
management queue for passive target
int * win_ids
Distant windows id.
struct nm_mpi_attrs_s attrs
window attributes, hashed by keyval descriptor
struct nm_mpi_info_s * p_info
WINDOW ATTRIBUTES
int * disp_unit
displacement unit
nm_mpi_errhandler_t * p_errhandler
error handler attached to window
nm_mpi_communicator_t * p_comm
window communicator
char shared_file_name[32]
shared memory file name
nm_mpi_aint_t * size
window's memory size
nm_mpi_request_t ** end_reqs
pending closing exposing epoch requests
struct nm_sr_monitor_s monitor_sync
window core monitor for asynchronous lock
int flavor
bit-vector window's flavor (the function used to allocate the window
uint64_t * msg_count
counter to receive the amount of messages to be expected from a given distant window
int mode
bit-vector OR of MPI_MODE_* constants (used in assert)
nm_mpi_win_locklist_t * pending_ops
pending passive RMA operation
char * name
window name
nm_group_t p_group
group of processor that interact with this window
a reference-counter that keeps trace of who increments/decrements in debug: full reference tracking i...
a global monitor to listen to events on the full session
internal defintion of the sendrecv request
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_struct_s STRUCT
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_subarray_s SUBARRAY
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_contiguous_s CONTIGUOUS
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_hindexed_s HINDEXED
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_dup_s DUP
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_hindexed_block_s HINDEXED_BLOCK
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_indexed_block_s INDEXED_BLOCK
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_resized_s RESIZED
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_indexed_s INDEXED
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_hvector_s HVECTOR
struct nm_mpi_datatype_ser_s::nm_mpi_datatype_ser_param_u::nm_mpi_datatype_ser_param_vector_s VECTOR