-enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED, FINALIZED };
+enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED /*(=MPI_Init called)*/, FINALIZED };
+/* Bindings for MPI special values */
+extern XBT_PUBLIC int mpi_in_place_;
+extern XBT_PUBLIC int mpi_bottom_;
+extern XBT_PUBLIC int mpi_status_ignore_;
+extern XBT_PUBLIC int mpi_statuses_ignore_;
-
-#define FORT_BOTTOM(addr) ((*(int*)addr) == -200 ? MPI_BOTTOM : (void*)addr)
-#define FORT_IN_PLACE(addr) ((*(int*)addr) == -100 ? MPI_IN_PLACE : (void*)addr)
-#define FORT_STATUS_IGNORE(addr) (static_cast<MPI_Status*>((*(int*)addr) == -300 ? MPI_STATUS_IGNORE : (void*)addr))
-#define FORT_STATUSES_IGNORE(addr) (static_cast<MPI_Status*>((*(int*)addr) == -400 ? MPI_STATUSES_IGNORE : (void*)addr))
+#define FORT_ADDR(addr, val, val2) \
+ (((void *)(addr) == (void*) &(val2)) \
+ ? (val) : (void *)(addr))
+#define FORT_BOTTOM(addr) FORT_ADDR(addr, MPI_BOTTOM, mpi_bottom_)
+#define FORT_IN_PLACE(addr) FORT_ADDR(addr, MPI_IN_PLACE, mpi_in_place_)
+#define FORT_STATUS_IGNORE(addr) static_cast<MPI_Status*>(FORT_ADDR(addr, MPI_STATUS_IGNORE, mpi_status_ignore_))
+#define FORT_STATUSES_IGNORE(addr) static_cast<MPI_Status*>(FORT_ADDR(addr, MPI_STATUSES_IGNORE, mpi_statuses_ignore_))
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process();
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process();
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank,
simgrid::s4u::ActorPtr actor);
XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank,
simgrid::s4u::ActorPtr actor);
XBT_PRIVATE void smpi_deployment_cleanup_instances();
XBT_PRIVATE void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff,
XBT_PRIVATE void smpi_deployment_cleanup_instances();
XBT_PRIVATE void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff,
extern XBT_PRIVATE SharedMallocType smpi_cfg_shared_malloc; // Whether to activate shared malloc
XBT_PRIVATE void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor);
extern XBT_PRIVATE SharedMallocType smpi_cfg_shared_malloc; // Whether to activate shared malloc
XBT_PRIVATE void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor);
XBT_PRIVATE void smpi_prepare_global_memory_segment();
XBT_PRIVATE void smpi_backup_global_memory_segment();
XBT_PRIVATE void smpi_prepare_global_memory_segment();
XBT_PRIVATE void smpi_backup_global_memory_segment();
-XBT_PRIVATE void* smpi_get_tmp_sendbuffer(int size);
-XBT_PRIVATE void* smpi_get_tmp_recvbuffer(int size);
-XBT_PRIVATE void smpi_free_tmp_buffer(void* buf);
+XBT_PRIVATE unsigned char* smpi_get_tmp_sendbuffer(size_t size);
+XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size);
+XBT_PRIVATE void smpi_free_tmp_buffer(const unsigned char* buf);
MPI_Aint* position, int* ierr);
void mpi_unpack_external_(char* datarep, void* inbuf, MPI_Aint* insize, MPI_Aint* position, void* outbuf, int* outcount,
int* datatype, int* ierr);
MPI_Aint* position, int* ierr);
void mpi_unpack_external_(char* datarep, void* inbuf, MPI_Aint* insize, MPI_Aint* position, void* outbuf, int* outcount,
int* datatype, int* ierr);
-void mpi_type_hindexed_(int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr);
+void mpi_type_hindexed_(int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_hindexed_(int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_hindexed_block_(int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype,
int* ierr);
void mpi_type_indexed_(int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_indexed_(int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_indexed_block_(int* count, int* blocklength, int* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_hindexed_(int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_hindexed_block_(int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype,
int* ierr);
void mpi_type_indexed_(int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_indexed_(int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr);
void mpi_type_create_indexed_block_(int* count, int* blocklength, int* indices, int* old_type, int* newtype, int* ierr);
-void mpi_type_struct_(int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr);
+void mpi_type_struct_(int* count, int* blocklens, int* indices, int* old_types, int* newtype, int* ierr);
void mpi_type_create_struct_(int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr);
void mpi_ssend_(void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr);
void mpi_ssend_init_(void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* request, int* ierr);
void mpi_type_create_struct_(int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr);
void mpi_ssend_(void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr);
void mpi_ssend_init_(void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* request, int* ierr);
typedef s_smpi_privatization_region_t* smpi_privatization_region_t;
extern XBT_PRIVATE int smpi_loaded_page;
typedef s_smpi_privatization_region_t* smpi_privatization_region_t;
extern XBT_PRIVATE int smpi_loaded_page;