X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/174dcd35736d025d97d6a82388857696b2b90bdf..c04b15f5346d042218b4fb8357cace04585e067b:/src/smpi/smpi_global.cpp diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 7df8301c58..63f2a6cdbe 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -3,40 +3,27 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include -#include -#include -#include -#include -#include - #include "mc/mc.h" -#include "private.h" -#include "private.hpp" #include "simgrid/s4u/Mailbox.hpp" -#include "smpi/smpi_shared_malloc.hpp" -#include "simgrid/sg_config.h" -#include "src/kernel/activity/SynchroComm.hpp" -#include "src/mc/mc_record.h" -#include "src/mc/mc_replay.h" +#include "simgrid/s4u/Host.hpp" #include "src/msg/msg_private.h" #include "src/simix/smx_private.h" #include "src/surf/surf_interface.hpp" #include "src/smpi/SmpiHost.hpp" -#include "surf/surf.h" -#include "xbt/replay.hpp" -#include +#include "xbt/config.hpp" +#include "src/smpi/private.h" +#include "smpi/smpi_shared_malloc.hpp" +#include "src/smpi/smpi_coll.hpp" +#include "src/smpi/smpi_comm.hpp" +#include "src/smpi/smpi_group.hpp" +#include "src/smpi/smpi_info.hpp" +#include "src/smpi/smpi_process.hpp" +#include +#include +#include #include /* DBL_MAX */ #include -#include -#include -#include -#include -#include -#include -#include -#include #if HAVE_SENDFILE #include @@ -54,9 +41,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (ke #define RTLD_DEEPBIND 0 #endif -/* Mac OSX does not have any header file providing that definition so we have to duplicate it here. Bummers. */ -extern char** environ; /* we use it in posix_spawnp below */ - #if HAVE_PAPI #include "papi.h" const char* papi_default_config_name = "default"; @@ -86,8 +70,6 @@ static simgrid::config::Flag smpi_init_sleep( void (*smpi_comm_copy_data_callback) (smx_activity_t, void*, size_t) = &smpi_comm_copy_buffer_callback; - - int smpi_process_count() { return process_count; @@ -198,7 +180,8 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !"); smpi_switch_data_segment( - (static_cast((static_cast(comm->src_proc->data)->data))->index())); + static_cast((static_cast(comm->src_proc->data)->data)) + ->index()); tmpbuff = static_cast(xbt_malloc(buff_size)); memcpy_private(tmpbuff, buff, private_blocks); } @@ -207,7 +190,8 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b && ((char*)comm->dst_buff < smpi_start_data_exe + smpi_size_data_exe )){ XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment"); smpi_switch_data_segment( - (static_cast((static_cast(comm->dst_proc->data)->data))->index())); + static_cast((static_cast(comm->dst_proc->data)->data)) + ->index()); } XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff); memcpy_private(comm->dst_buff, tmpbuff, private_blocks); @@ -476,6 +460,13 @@ static void smpi_init_options(){ else xbt_die("Invalid value for smpi/privatization: '%s'", smpi_privatize_option); +#if defined(__FreeBSD__) + if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) { + XBT_INFO("Mixing mmap privatization is broken on FreeBSD, switching to dlopen privatization instead."); + smpi_privatize_global_variables = SMPI_PRIVATIZE_DLOPEN; + } +#endif + if (smpi_cpu_threshold < 0) smpi_cpu_threshold = DBL_MAX; @@ -501,7 +492,7 @@ static int smpi_run_entry_point(smpi_entry_point_type entry_point, std::vector argv(new char*[argc + 1]); for (int i = 0; i != argc; ++i) - argv[i] = args[i].empty() ? const_cast(""): &args[i].front(); + argv[i] = args[i].empty() ? '\0' : &args[i].front(); argv[argc] = nullptr; int res = entry_point(argc, argv.get()); @@ -675,8 +666,8 @@ int smpi_main(const char* executable, int argc, char *argv[]) } } int count = smpi_process_count(); - int i, ret=0; - for (i = 0; i < count; i++) { + int ret = 0; + for (int i = 0; i < count; i++) { if(process_data[i]->return_value()!=0){ ret=process_data[i]->return_value();//return first non 0 value break;