X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7c047878cb2905079a6a0544f1a15134ae3ab3a6..90a471de6cd70b41223dd16a09fafe6ac3e18269:/src/surf/surf_interface.cpp diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index b3de241734..8a7caad677 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -27,7 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (ke /* model_list_invoke contains only surf_host and surf_vm. * The callback functions of cpu_model and network_model will be called from those of these host models. */ -xbt_dynar_t all_existing_models = nullptr; /* to destroy models correctly */ +std::vector * all_existing_models = nullptr; /* to destroy models correctly */ xbt_dynar_t model_list_invoke = nullptr; /* to invoke callbacks */ simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr; @@ -110,7 +110,7 @@ static xbt_parmap_t surf_parmap = nullptr; /* parallel map on models */ double NOW = 0; -double surf_get_clock(void) +double surf_get_clock() { return NOW; } @@ -161,7 +161,7 @@ static const char *disk_drives_letter_table[MAX_DRIVE] = { * directory on Unix/Linux platforms. */ -const char *__surf_get_initial_path(void) +const char *__surf_get_initial_path() { #ifdef _WIN32 @@ -246,16 +246,25 @@ void sg_version_check(int lib_version_major,int lib_version_minor,int lib_versio fprintf(stderr, "FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, " "and then linked against SimGrid %d.%d.%d. Please fix this.\n", - SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH, - lib_version_major,lib_version_minor,lib_version_patch); + lib_version_major,lib_version_minor,lib_version_patch, + SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH); abort(); } if (lib_version_patch != SIMGRID_VERSION_PATCH) { + if(SIMGRID_VERSION_PATCH >= 90 || lib_version_patch >=90){ + fprintf(stderr, + "FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, " + "and then linked against SimGrid %d.%d.%d. \n" + "One of them is a development version, and should not be mixed with the stable release. Please fix this.\n", + lib_version_major,lib_version_minor,lib_version_patch, + SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH); + abort(); + } fprintf(stderr, "Warning: Your program was compiled with SimGrid version %d.%d.%d, " "and then linked against SimGrid %d.%d.%d. Proceeding anyway.\n", - SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH, - lib_version_major,lib_version_minor,lib_version_patch); + lib_version_major,lib_version_minor,lib_version_patch, + SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH); } } @@ -287,7 +296,7 @@ void surf_init(int *argc, char **argv) XBT_DEBUG("Add routing levels"); ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, nullptr); ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) { - delete static_cast(p); + delete static_cast(p); }); XBT_DEBUG("Add SURF levels"); @@ -296,7 +305,7 @@ void surf_init(int *argc, char **argv) xbt_init(argc, argv); if (!all_existing_models) - all_existing_models = xbt_dynar_new(sizeof(simgrid::surf::Model*), nullptr); + all_existing_models = new std::vector(); if (!model_list_invoke) model_list_invoke = xbt_dynar_new(sizeof(simgrid::surf::Model*), nullptr); if (!future_evt_set) @@ -311,13 +320,9 @@ void surf_init(int *argc, char **argv) MC_memory_init(); } -void surf_exit(void) +void surf_exit() { - unsigned int iter; - simgrid::surf::Model *model = nullptr; - - TRACE_end(); /* Just in case it was not called by the upper - * layer (or there is no upper layer) */ + TRACE_end(); /* Just in case it was not called by the upper layer (or there is no upper layer) */ sg_config_finalize(); @@ -332,9 +337,9 @@ void surf_exit(void) xbt_lib_free(&file_lib); xbt_dict_free(&watched_hosts_lib); - xbt_dynar_foreach(all_existing_models, iter, model) + for (auto model : *all_existing_models) delete model; - xbt_dynar_free(&all_existing_models); + delete all_existing_models; xbt_dynar_free(&model_list_invoke); routing_exit(); @@ -474,6 +479,7 @@ double Model::next_occuring_event_lazy(double now) double Model::next_occuring_event_full(double /*now*/) { THROW_UNIMPLEMENTED; + return 0.0; } double Model::shareResourcesMaxMin(ActionList *running_actions,