X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ad5734ab76c2c430832004e0e3af55a0378e1c5d..11d202c1bbc1dcbd64bddfc1a1c46110c9ba36cc:/src/smpi/smpi_global.c diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index a4278264ff..1baf3ea86b 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -35,6 +35,10 @@ static int process_count = 0; MPI_Comm MPI_COMM_WORLD = MPI_COMM_NULL; +MPI_Errhandler* MPI_ERRORS_RETURN = NULL; +MPI_Errhandler* MPI_ERRORS_ARE_FATAL = NULL; +MPI_Errhandler* MPI_ERRHANDLER_NULL = NULL; + #define MAILBOX_NAME_MAXLEN (5 + sizeof(int) * 2 + 1) static char* get_mailbox_name(char* str, int index) { @@ -89,6 +93,7 @@ void smpi_process_finalize(void) } } +#ifdef SMPI_F2C int smpi_process_argc(void) { smpi_process_data_t data = smpi_process_data(); @@ -123,6 +128,7 @@ int smpi_global_size(void) { } return atoi(value); } +#endif smpi_process_data_t smpi_process_data(void) { @@ -213,13 +219,15 @@ void print_request(const char *message, MPI_Request request) { request->src, request->dst, request->tag, request->flags); } -void SMPI_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_size) +static void SMPI_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_size) { XBT_DEBUG("Copy the data over"); memcpy(comm->comm.dst_buff, buff, buff_size); if (comm->comm.detached) { // if this is a detached send, the source buffer was duplicated by SMPI sender to make the original buffer available to the application ASAP xbt_free(buff); - xbt_free(comm->comm.src_data);// inside SMPI the request is keep + //It seems that the request is used after the call there this should + //be free somewhereelse but where??? + //xbt_free(comm->comm.src_data);// inside SMPI the request is keep //inside the user data and should be free comm->comm.src_buff = NULL; } @@ -259,6 +267,7 @@ void smpi_global_destroy(void) int i; smpi_bench_destroy(); + smpi_group_destroy(smpi_comm_group(MPI_COMM_WORLD)); smpi_comm_destroy(MPI_COMM_WORLD); MPI_COMM_WORLD = MPI_COMM_NULL; for (i = 0; i < count; i++) { @@ -277,16 +286,24 @@ void smpi_global_destroy(void) /* Fortran specific stuff */ /* With smpicc, the following weak symbols are used */ /* With smpiff, the following weak symbols are replaced by those in libf2c */ + int __attribute__((weak)) xargc; char** __attribute__((weak)) xargv; +int __attribute__((weak)) smpi_simulated_main(int argc, char** argv) { + xbt_die("Should not be in this smpi_simulated_main"); + return 1; +} + int __attribute__((weak)) main(int argc, char** argv) { - xargc = argc; - xargv = argv; - return MAIN__(); + return smpi_main(smpi_simulated_main,argc,argv); } -int MAIN__(void) +int __attribute__((weak)) MAIN__(){ + return smpi_main(smpi_simulated_main,xargc, xargv); +}; + +int smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[]) { srand(SMPI_RAND_SEED); @@ -307,22 +324,23 @@ int MAIN__(void) XBT_LOG_CONNECT(smpi_mpi); XBT_LOG_CONNECT(smpi_mpi_dt); XBT_LOG_CONNECT(smpi_pmpi); + XBT_LOG_CONNECT(smpi_replay); #ifdef HAVE_TRACING - TRACE_global_init(&xargc, xargv); + TRACE_global_init(&argc, argv); #endif - SIMIX_global_init(&xargc, xargv); + SIMIX_global_init(&argc, argv); #ifdef HAVE_TRACING TRACE_start(); #endif // parse the platform file: get the host list - SIMIX_create_environment(xargv[1]); + SIMIX_create_environment(argv[1]); - SIMIX_function_register_default(smpi_simulated_main); - SIMIX_launch_application(xargv[2]); + SIMIX_function_register_default(realmain); + SIMIX_launch_application(argv[2]); smpi_global_init(); @@ -330,12 +348,12 @@ int MAIN__(void) fflush(stdout); fflush(stderr); - if (MC_IS_ENABLED) + if (MC_is_active()) MC_modelcheck(); else SIMIX_run(); - if (xbt_cfg_get_int(_surf_cfg_set, "smpi/display_timing")) + if (surf_cfg_get_int("smpi/display_timing")) XBT_INFO("Simulation time: %g seconds.", SIMIX_get_clock()); smpi_global_destroy();