X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/09fe3bc07ad8fa514b0d38bcfcf5527ba4d7cae6..c751cd28aa259c0de238a785fcdde9b099625d0b:/src/smpi/smpi_global.cpp diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 1e6fd35f05..9ca25bed45 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -14,7 +14,7 @@ #include "src/msg/msg_private.h" #include "src/simix/smx_private.h" #include "surf/surf.h" -#include "xbt/replay.h" +#include "xbt/replay.hpp" #include /* DBL_MAX */ #include @@ -73,7 +73,6 @@ int process_count = 0; int smpi_universe_size = 0; int* index_to_process_data = nullptr; extern double smpi_total_benched_time; -extern xbt_dict_t smpi_comm_keyvals; xbt_os_timer_t global_timer; MPI_Comm MPI_COMM_WORLD = MPI_COMM_UNINITIALIZED; MPI_Errhandler *MPI_ERRORS_RETURN = nullptr; @@ -212,7 +211,8 @@ bool smpi_process_get_replaying(){ int index = smpi_process_index(); if (index != MPI_UNDEFINED) return process_data[index_to_process_data[index]]->replaying; - else return (_xbt_replay_is_active() != 0); + else + return false; } int smpi_global_size() @@ -634,9 +634,9 @@ void smpi_global_destroy() if (MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED){ MPI_COMM_WORLD->cleanup_smp(); - MPI_COMM_WORLD->cleanup_attributes(); - if(smpi_coll_cleanup_callback!=nullptr) - smpi_coll_cleanup_callback(); + MPI_COMM_WORLD->cleanup_attr(); + if(Colls::smpi_coll_cleanup_callback!=nullptr) + Colls::smpi_coll_cleanup_callback(); delete MPI_COMM_WORLD; } @@ -647,13 +647,13 @@ void smpi_global_destroy() } xbt_free(index_to_process_data); - if(smpi_comm_keyvals!=nullptr) - xbt_dict_free(&smpi_comm_keyvals); if(smpi_privatize_global_variables) smpi_destroy_global_memory_segments(); smpi_free_static(); } +extern "C" { + #ifndef WIN32 void __attribute__ ((weak)) user_main_() @@ -684,7 +684,6 @@ int __attribute__ ((weak)) main(int argc, char **argv) #endif -extern "C" { static void smpi_init_logs(){ /* Connect log categories. See xbt/log.c */ @@ -713,58 +712,9 @@ static void smpi_init_logs(){ } static void smpi_init_options(){ - int gather_id = find_coll_description(mpi_coll_gather_description, xbt_cfg_get_string("smpi/gather"),"gather"); - mpi_coll_gather_fun = reinterpret_cast - (mpi_coll_gather_description[gather_id].coll); - - int allgather_id = find_coll_description(mpi_coll_allgather_description, - xbt_cfg_get_string("smpi/allgather"),"allgather"); - mpi_coll_allgather_fun = reinterpret_cast - (mpi_coll_allgather_description[allgather_id].coll); - - int allgatherv_id = find_coll_description(mpi_coll_allgatherv_description, - xbt_cfg_get_string("smpi/allgatherv"),"allgatherv"); - mpi_coll_allgatherv_fun = reinterpret_cast - (mpi_coll_allgatherv_description[allgatherv_id].coll); - - int allreduce_id = find_coll_description(mpi_coll_allreduce_description, - xbt_cfg_get_string("smpi/allreduce"),"allreduce"); - mpi_coll_allreduce_fun = reinterpret_cast - (mpi_coll_allreduce_description[allreduce_id].coll); - - int alltoall_id = find_coll_description(mpi_coll_alltoall_description, - xbt_cfg_get_string("smpi/alltoall"),"alltoall"); - mpi_coll_alltoall_fun = reinterpret_cast - (mpi_coll_alltoall_description[alltoall_id].coll); - - int alltoallv_id = find_coll_description(mpi_coll_alltoallv_description, - xbt_cfg_get_string("smpi/alltoallv"),"alltoallv"); - mpi_coll_alltoallv_fun = reinterpret_cast - (mpi_coll_alltoallv_description[alltoallv_id].coll); - - int bcast_id = find_coll_description(mpi_coll_bcast_description, xbt_cfg_get_string("smpi/bcast"),"bcast"); - mpi_coll_bcast_fun = reinterpret_cast - (mpi_coll_bcast_description[bcast_id].coll); - - int reduce_id = find_coll_description(mpi_coll_reduce_description, xbt_cfg_get_string("smpi/reduce"),"reduce"); - mpi_coll_reduce_fun = reinterpret_cast - (mpi_coll_reduce_description[reduce_id].coll); - - int reduce_scatter_id = - find_coll_description(mpi_coll_reduce_scatter_description, - xbt_cfg_get_string("smpi/reduce-scatter"),"reduce_scatter"); - mpi_coll_reduce_scatter_fun = reinterpret_cast - (mpi_coll_reduce_scatter_description[reduce_scatter_id].coll); - - int scatter_id = find_coll_description(mpi_coll_scatter_description, xbt_cfg_get_string("smpi/scatter"),"scatter"); - mpi_coll_scatter_fun = reinterpret_cast - (mpi_coll_scatter_description[scatter_id].coll); - - int barrier_id = find_coll_description(mpi_coll_barrier_description, xbt_cfg_get_string("smpi/barrier"),"barrier"); - mpi_coll_barrier_fun = reinterpret_cast - (mpi_coll_barrier_description[barrier_id].coll); - - smpi_coll_cleanup_callback=nullptr; + + Colls::set_collectives(); + Colls::smpi_coll_cleanup_callback=nullptr; smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold"); smpi_host_speed = xbt_cfg_get_double("smpi/host-speed"); smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables");