#include <simgrid/forward.h>
#include <smpi/forward.hpp>
+#include <smpi/smpi_helpers_internal.h>
#include <xbt/function_types.h>
#include <stddef.h>
type _XBT_CONCAT(P, name) args
#endif
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
#define MPI_THREAD_SINGLE 0
#define MPI_THREAD_FUNNELED 1
#define MPI_THREAD_SERIALIZED 2
XBT_PUBLIC_DATA const MPI_Datatype MPI_COUNT;
//defines for fortran compatibility
-#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__) || defined(__aarch64__)
#define MPI_INTEGER MPI_INT
#define MPI_2INTEGER MPI_2INT
#define MPI_LOGICAL MPI_INT
#define SMPI_ITER_NAME1(line) _XBT_CONCAT(iter_count, line)
#define SMPI_ITER_NAME(line) SMPI_ITER_NAME1(line)
-#define SMPI_SAMPLE_LOOP(loop_init, loop_end, loop_iter, global, iters, thres)\
- int SMPI_ITER_NAME(__LINE__)=0;\
- {loop_init;\
- while(loop_end){\
- SMPI_ITER_NAME(__LINE__)++;\
- loop_iter;\
- }} \
- for(loop_init; \
- loop_end ? (smpi_sample_1(global, __FILE__, __LINE__, iters, thres), (smpi_sample_2(global, __FILE__, __LINE__, SMPI_ITER_NAME(__LINE__)))) :\
- smpi_sample_exit(global, __FILE__, __LINE__, SMPI_ITER_NAME(__LINE__));\
- smpi_sample_3(global, __FILE__, __LINE__),loop_iter)
-#define SMPI_SAMPLE_LOCAL(loop_init, loop_end, loop_iter, iters, thres) SMPI_SAMPLE_LOOP(loop_init, loop_end, loop_iter, 0, iters, thres)
-#define SMPI_SAMPLE_GLOBAL(loop_init, loop_end, loop_iter,iters, thres) SMPI_SAMPLE_LOOP(loop_init, loop_end, loop_iter, 1, iters, thres)
+#define SMPI_SAMPLE_LOOP(loop_init, loop_end, loop_iter, global, iters, thres) \
+ int SMPI_ITER_NAME(__LINE__) = 0; \
+ { \
+ loop_init; \
+ while (loop_end) { \
+ SMPI_ITER_NAME(__LINE__)++; \
+ (loop_iter); \
+ } \
+ } \
+ for (loop_init; (loop_end) ? (smpi_sample_1((global), __FILE__, __LINE__, (iters), (thres)), \
+ (smpi_sample_2((global), __FILE__, __LINE__, SMPI_ITER_NAME(__LINE__)))) \
+ : smpi_sample_exit((global), __FILE__, __LINE__, SMPI_ITER_NAME(__LINE__)); \
+ smpi_sample_3((global), __FILE__, __LINE__), (loop_iter))
+#define SMPI_SAMPLE_LOCAL(loop_init, loop_end, loop_iter, iters, thres) \
+ SMPI_SAMPLE_LOOP(loop_init, (loop_end), (loop_iter), 0, (iters), (thres))
+#define SMPI_SAMPLE_GLOBAL(loop_init, loop_end, loop_iter, iters, thres) \
+ SMPI_SAMPLE_LOOP(loop_init, (loop_end), (loop_iter), 1, (iters), (thres))
#define SMPI_SAMPLE_DELAY(duration) for(smpi_execute(duration); 0; )
#define SMPI_SAMPLE_FLOPS(flops) for(smpi_execute_flops(flops); 0; )
-
XBT_PUBLIC void* smpi_shared_malloc(size_t size, const char* file, int line);
-#define SMPI_SHARED_MALLOC(size) smpi_shared_malloc(size, __FILE__, __LINE__)
+#define SMPI_SHARED_MALLOC(size) smpi_shared_malloc((size), __FILE__, __LINE__)
XBT_PUBLIC void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int nb_shared_blocks);
#define SMPI_PARTIAL_SHARED_MALLOC(size, shared_block_offsets, nb_shared_blocks) \
- smpi_shared_malloc_partial(size, shared_block_offsets, nb_shared_blocks)
+ smpi_shared_malloc_partial((size), (shared_block_offsets), (nb_shared_blocks))
+
-XBT_PUBLIC void smpi_shared_free(void* data);
#define SMPI_SHARED_FREE(data) smpi_shared_free(data)
XBT_PUBLIC int smpi_shared_known_call(const char* func, const char* input);
XBT_PUBLIC void* smpi_shared_get_call(const char* func, const char* input);
XBT_PUBLIC void* smpi_shared_set_call(const char* func, const char* input, void* data);
#define SMPI_SHARED_CALL(func, input, ...) \
- (smpi_shared_known_call(_XBT_STRINGIFY(func), input) \
- ? smpi_shared_get_call(_XBT_STRINGIFY(func), input) \
- : smpi_shared_set_call(_XBT_STRINGIFY(func), input, (func(__VA_ARGS__))))
+ (smpi_shared_known_call(_XBT_STRINGIFY(func), (input)) \
+ ? smpi_shared_get_call(_XBT_STRINGIFY(func), (input)) \
+ : smpi_shared_set_call(_XBT_STRINGIFY(func), (input), ((func)(__VA_ARGS__))))
/* Fortran specific stuff */
XBT_PUBLIC void SMPI_init();
XBT_PUBLIC void SMPI_finalize();
-SG_END_DECL()
+SG_END_DECL
/* C++ declarations for shared_malloc */
#ifdef __cplusplus
-XBT_PUBLIC int smpi_is_shared(void* ptr, std::vector<std::pair<size_t, size_t>>& private_blocks, size_t* offset);
+XBT_PUBLIC int smpi_is_shared(const void* ptr, std::vector<std::pair<size_t, size_t>>& private_blocks, size_t* offset);
std::vector<std::pair<size_t, size_t>> shift_and_frame_private_blocks(const std::vector<std::pair<size_t, size_t>>& vec,
size_t offset, size_t buff_size);