X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8bf2cf8030ae6d911565e7726e275a560f201dfb..5a185bb60f4c7b77ebccc4948d17f0dc43a9d6a5:/src/smpi/smpi_global.c diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index ba6abe3b1f..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,10 +243,13 @@ 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); process_data = NULL; + + smpi_free_static(); } /* Fortran specific stuff */ @@ -247,20 +269,21 @@ int MAIN__(void) srand(SMPI_RAND_SEED); if(getenv("SMPI_PRETEND_CC") != NULL) { - /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the configuration tools */ + /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the configuration tools */ return 0; } /* Connect log categories. See xbt/log.c */ - XBT_LOG_CONNECT(smpi_base, smpi); - XBT_LOG_CONNECT(smpi_bench, smpi); - XBT_LOG_CONNECT(smpi_coll, smpi); - XBT_LOG_CONNECT(smpi_comm, smpi); - XBT_LOG_CONNECT(smpi_group, smpi); - XBT_LOG_CONNECT(smpi_kernel, smpi); - XBT_LOG_CONNECT(smpi_mpi, smpi); - XBT_LOG_CONNECT(smpi_mpi_dt, smpi); - XBT_LOG_CONNECT(smpi_pmpi, smpi); + XBT_LOG_CONNECT(smpi); + XBT_LOG_CONNECT(smpi_base); + XBT_LOG_CONNECT(smpi_bench); + XBT_LOG_CONNECT(smpi_coll); + XBT_LOG_CONNECT(smpi_comm); + XBT_LOG_CONNECT(smpi_group); + XBT_LOG_CONNECT(smpi_kernel); + XBT_LOG_CONNECT(smpi_mpi); + XBT_LOG_CONNECT(smpi_mpi_dt); + XBT_LOG_CONNECT(smpi_pmpi); #ifdef HAVE_TRACING TRACE_global_init(&xargc, xargv);