The SMPI process ID is simply the SIMIX PID - 1. The previous solution
(getting the data field of the SIMIX process) was mostly correct but
the 'data' field was not initally set to the SMPI process data
structure (but was NULL).
#include "simgrid/simix.h"
#include "smx_smurf_private.h"
#include "simgrid/simix.h"
#include "smx_smurf_private.h"
typedef struct s_smx_process_exit_fun {
int_f_pvoid_pvoid_t fun;
void *arg;
typedef struct s_smx_process_exit_fun {
int_f_pvoid_pvoid_t fun;
void *arg;
void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process,
int auto_restart);
smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process);
void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process,
int auto_restart);
smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process);
extern void** mappings;
extern int loaded_page;
extern void** mappings;
extern int loaded_page;
-int smpi_process_index_of_smx_process(smx_process_t process);
+int SIMIX_process_get_PID(smx_process_t self);
+
+static inline __attribute__ ((always_inline))
+int smpi_process_index_of_smx_process(smx_process_t process) {
+ return SIMIX_process_get_PID(process) -1;
+}
proc->context->cleanup_func=SIMIX_process_cleanup;
char* instance_id = (*argv)[1];
int rank = atoi((*argv)[2]);
proc->context->cleanup_func=SIMIX_process_cleanup;
char* instance_id = (*argv)[1];
int rank = atoi((*argv)[2]);
- index = SIMIX_process_get_PID(proc) -1;
+ index = smpi_process_index_of_smx_process(proc);
if(!index_to_process_data){
index_to_process_data=(int*)xbt_malloc(SIMIX_process_count()*sizeof(int));
if(!index_to_process_data){
index_to_process_data=(int*)xbt_malloc(SIMIX_process_count()*sizeof(int));
return data ? data->index : MPI_UNDEFINED;
}
return data ? data->index : MPI_UNDEFINED;
}
-int smpi_process_index_of_smx_process(smx_process_t process) {
- smpi_process_data_t data = (smpi_process_data_t) SIMIX_process_get_data(process);
- return data ? data->index : MPI_UNDEFINED;
-}
-
MPI_Comm smpi_process_comm_world(void)
{
smpi_process_data_t data = smpi_process_data();
MPI_Comm smpi_process_comm_world(void)
{
smpi_process_data_t data = smpi_process_data();