X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/272ccad1b68b6d9c17069f3c934886925bb15b5d..5a185bb60f4c7b77ebccc4948d17f0dc43a9d6a5:/src/smpi/smpi_global.c diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index f1570122eb..cdbdc96c63 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -12,6 +12,8 @@ #include "smpi_mpi_dt_private.h" #include "mc/mc.h" #include "surf/surf.h" +#include "simix/smx_private.h" + XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories"); @@ -23,6 +25,7 @@ typedef struct s_smpi_process_data { int* argc; char*** argv; smx_rdv_t mailbox; + smx_rdv_t mailbox_small; xbt_os_timer_t timer; double simulated; MPI_Comm comm_self; @@ -40,6 +43,11 @@ static char* get_mailbox_name(char* str, int index) { return str; } +static char* get_mailbox_name_small(char* str, int index) { + snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", (int)(sizeof(int) * 2), index); + return str; +} + void smpi_process_init(int *argc, char ***argv) { int index; @@ -59,6 +67,7 @@ void smpi_process_init(int *argc, char ***argv) (*argc)--; data->argc = argc; data->argv = argv; + data->mailbox_small->permanent_receiver=proc;// set the process attached to the mailbox XBT_DEBUG("<%d> New process in the game: %p", index, proc); } } @@ -77,7 +86,7 @@ void smpi_process_finalize(void) { // wait for all pending asynchronous comms to finish while (SIMIX_process_has_pending_comms(SIMIX_process_self())) { - simcall_process_sleep(1); + simcall_process_sleep(0.01); } } @@ -144,12 +153,25 @@ smx_rdv_t smpi_process_mailbox(void) { return data->mailbox; } +smx_rdv_t smpi_process_mailbox_small(void) { + smpi_process_data_t data = smpi_process_data(); + + return data->mailbox_small; +} + smx_rdv_t smpi_process_remote_mailbox(int index) { smpi_process_data_t data = smpi_process_remote_data(index); return data->mailbox; } + +smx_rdv_t smpi_process_remote_mailbox_small(int index) { + smpi_process_data_t data = smpi_process_remote_data(index); + + return data->mailbox_small; +} + xbt_os_timer_t smpi_process_timer(void) { smpi_process_data_t data = smpi_process_data(); @@ -157,29 +179,25 @@ xbt_os_timer_t smpi_process_timer(void) return data->timer; } -void smpi_process_simulated_start(void) -{ +void smpi_process_simulated_start(void) { smpi_process_data_t data = smpi_process_data(); data->simulated = SIMIX_get_clock(); } -double smpi_process_simulated_elapsed(void) -{ +double smpi_process_simulated_elapsed(void) { smpi_process_data_t data = smpi_process_data(); return SIMIX_get_clock() - data->simulated; } -MPI_Comm smpi_process_comm_self(void) -{ +MPI_Comm smpi_process_comm_self(void) { smpi_process_data_t data = smpi_process_data(); return data->comm_self; } -void print_request(const char *message, MPI_Request request) -{ +void print_request(const char *message, MPI_Request request) { XBT_DEBUG("%s request %p [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]", message, request, request->buf, request->size, request->src, request->dst, request->tag, request->flags); @@ -200,6 +218,7 @@ void smpi_global_init(void) process_data[i]->argc = NULL; process_data[i]->argv = NULL; process_data[i]->mailbox = simcall_rdv_create(get_mailbox_name(name, i)); + process_data[i]->mailbox_small = simcall_rdv_create(get_mailbox_name_small(name, i)); process_data[i]->timer = xbt_os_timer_new(); group = smpi_group_new(1); process_data[i]->comm_self = smpi_comm_new(group); @@ -224,6 +243,7 @@ void smpi_global_destroy(void) smpi_comm_destroy(process_data[i]->comm_self); xbt_os_timer_free(process_data[i]->timer); simcall_rdv_destroy(process_data[i]->mailbox); + simcall_rdv_destroy(process_data[i]->mailbox_small); xbt_free(process_data[i]); } xbt_free(process_data);