X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8cef00b18f68304c259dcae04a052d8414ad101e..9d1a9a4b871895531b7e70f313691ef75dc47a96:/include/smpi/smpi.h diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index d1ac611984..bc9dcb776b 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -29,7 +30,7 @@ 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 @@ -298,7 +299,7 @@ XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER16; 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 @@ -1006,38 +1007,41 @@ XBT_PUBLIC void smpi_trace_set_call_location__(const char* file, int* line); #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 */ @@ -1053,11 +1057,11 @@ XBT_PUBLIC void SMPI_app_instance_register(const char* name, xbt_main_func_t cod 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>& private_blocks, size_t* offset); +XBT_PUBLIC int smpi_is_shared(const void* ptr, std::vector>& private_blocks, size_t* offset); std::vector> shift_and_frame_private_blocks(const std::vector>& vec, size_t offset, size_t buff_size);