From: Martin Quinson Date: Sat, 6 Feb 2016 00:02:36 +0000 (+0100) Subject: Merge pull request #59 from fabienchaix/master X-Git-Tag: v3_13~969 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d3951d2a98b47949c8d6bde9832fd615360bbd4c?hp=8d000a773b5ebcd411b28c31de68eeddf804e66b Merge pull request #59 from fabienchaix/master Splitting the LMM constraint element_set into enabled_element_set and disabled_element_set --- diff --git a/.gitignore b/.gitignore index 7227b38c03..f2c89f31c8 100644 --- a/.gitignore +++ b/.gitignore @@ -275,6 +275,7 @@ src/replay/replay src/testall teshsuite/bug-17132/bug-17132 teshsuite/datadesc_usage.out +teshsuite/java/semaphore/java_semaphore_gc_compiled teshsuite/java/sleep_host_off/java_sleep_host_off_compiled teshsuite/mc/dwarf/dwarf teshsuite/mc/dwarf_expression/dwarf-expression diff --git a/CMakeLists.txt b/CMakeLists.txt index 3747faf7a7..be8918f9f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64") if (MSVC) message(STATUS "Disable fast raw contextes on Microsoft Visual.") else() - set(HAVE_RAWCTX 1) + set(HAVE_RAW_CONTEXTS 1) endif() ENDIF() @@ -267,15 +267,15 @@ if(Boost_FOUND AND Boost_CONTEXT_FOUND) # We should use feature detection for this instead: if (Boost_VERSION LESS 105600) message("Found Boost.Context API v1") - set(HAVE_BOOST_CONTEXT 1) + set(HAVE_BOOST_CONTEXTS 1) else() message("Found Boost.Context API v2") - set(HAVE_BOOST_CONTEXT 2) + set(HAVE_BOOST_CONTEXTS 2) endif() else() message (" boost : found.") message (" boost-context: missing. Install libboost-context-dev for this optional feature.") - set(HAVE_BOOST_CONTEXT 0) + set(HAVE_BOOST_CONTEXTS 0) endif() # Checks for header libraries functions. @@ -383,8 +383,8 @@ if(WIN32) # Those files are not detected despite being present set(HAVE_MAKECONTEXT 1) endif() -set(CONTEXT_UCONTEXT 0) -set(CONTEXT_THREADS 0) +set(HAVE_UCONTEXT_CONTEXTS 0) +set(HAVE_THREAD_CONTEXTS 0) if(enable_jedule) set(HAVE_JEDULE 1) @@ -626,12 +626,12 @@ endif() #If can have both context if(HAVE_UCONTEXT) - set(CONTEXT_UCONTEXT 1) + set(HAVE_UCONTEXT_CONTEXTS 1) message("-- Support for ucontext factory") endif() if(HAVE_PTHREAD) - set(CONTEXT_THREADS 1) + set(HAVE_THREAD_CONTEXTS 1) message("-- Support for thread context factory") endif() diff --git a/ChangeLog b/ChangeLog index b1d47060a1..679c59047b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,19 @@ SimGrid (3.13) UNRELEASED; urgency=low The Easter Trim Release. + + Backwards Compatibility breaks + - The option "model-check/sparse-checkpoint" was renamed to + "model-check/sparse_checkpoint" as we attempt to unify our naming + schemes. + - The option smpi/async_small_thres was renamed to smpi/async_small_thresh + as we attempt to unify our naming schemes. + - The option smpi/send_is_detached_thres was renamed to + smpi/send_is_detached_thresh as we attempt to unify our naming schemes. + + - We removed support for writing your simulation in Lua; you can use + the Java bindings. + S4U * s4u::Host is now the prefered public interface to the Host features. @@ -16,19 +29,10 @@ SimGrid (3.13) UNRELEASED; urgency=low the lambda or closure passed as a parameter will run in kernel mode. Every callbacks should be rewritten to that interface at some point. - MC - * BC breaks: - - The option "model-check/sparse-checkpoint" was renamed to - "model-check/sparse_checkpoint" as we attempt to unify our naming - schemes. - Surf * Reorganizing and cleaning the internals all around the place. SMPI - * BC breaks: - - The option smpi/async_small_thres was renamed to smpi/async_small_thresh - as we attempt to unify our naming schemes -> smpi/send_is_detached_thresh * Remove old default barrier/bcast buggy algorithms (see #18407) * Various bugfixes to handle more codes diff --git a/doc/doxygen/tracing.doc b/doc/doxygen/tracing.doc index b4b203eeeb..7c11bda843 100644 --- a/doc/doxygen/tracing.doc +++ b/doc/doxygen/tracing.doc @@ -143,17 +143,6 @@ tracing/filename \endverbatim If you do not provide this parameter, the trace file will be named simgrid.trace. -\li \c -tracing/onelink_only -: - By default, the tracing system uses all routes in the platform file - to re-create a "graph" of the platform and register it in the trace file. - This option let the user tell the tracing system to use only the routes - that are composed with just one link. -\verbatim ---cfg=tracing/onelink_only:yes -\endverbatim - \li \c tracing/smpi : @@ -201,6 +190,38 @@ exchanged in the trace, both in the links and on the states. For collective, siz --cfg=tracing/smpi/display_sizes:yes \endverbatim +\li \c +tracing/smpi/sleeping +: +TODO +\verbatim +TODO +\endverbatim + +\li \c +tracing/smpi/format +: +TODO +\verbatim +TODO +\endverbatim + +\li \c +tracing/smpi/format/ti_one_file +: +TODO +\verbatim +TODO +\endverbatim + +\li \c +tracing/msg/vm +: +TODO +\verbatim +TODO +\endverbatim + \li \c tracing/msg/process : @@ -237,6 +258,22 @@ traced as usual. --cfg=tracing/onelink_only:yes \endverbatim +\li \c +tracing/disable_link +: +TODO +\verbatim +TODO +\endverbatim + +\li \c +tracing/disable_power +: +TODO +\verbatim +TODO +\endverbatim + \li \c tracing/disable_destroy : @@ -274,6 +311,30 @@ Use this to add the contents of a file to the top of the trace file as comment. --cfg=tracing/comment_file:textual_file.txt \endverbatim +\li \c +tracing/precision +: +TODO +\verbatim +TODO +\endverbatim + +\li \c +tracing/platform +: +TODO +\verbatim +TODO +\endverbatim + +\li \c +tracing/platform/topology +: +TODO +\verbatim +TODO +\endverbatim + \li \c viva/categorized : diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index bd5a62aa27..e43c1d45f5 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -230,8 +230,8 @@ static void action_barrier(const char *const *action) processes_arrived_sofar--; if (!processes_arrived_sofar) { - simcall_cond_destroy(cond); - simcall_mutex_destroy(mutex); + SIMIX_cond_destroy(cond); + SIMIX_mutex_destroy(mutex); mutex = NULL; } } diff --git a/examples/msg/bittorrent/CMakeLists.txt b/examples/msg/bittorrent/CMakeLists.txt index f4c0b9c334..fdba1af671 100644 --- a/examples/msg/bittorrent/CMakeLists.txt +++ b/examples/msg/bittorrent/CMakeLists.txt @@ -2,12 +2,9 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") add_executable(bittorrent "bittorrent.c" "messages.c" "peer.c" "tracker.c" "connection.c") -add_executable(bittorrent_platfgen - "bittorrent_platfgen.c" "messages.c" "peer.c" "tracker.c" "connection.c") ### Add definitions for compile target_link_libraries(bittorrent simgrid ) -target_link_libraries(bittorrent_platfgen simgrid ) set(tesh_files ${tesh_files} @@ -22,7 +19,6 @@ set(xml_files set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/bittorrent.c - ${CMAKE_CURRENT_SOURCE_DIR}/bittorrent_platfgen.c ${CMAKE_CURRENT_SOURCE_DIR}/bittorrent.h ${CMAKE_CURRENT_SOURCE_DIR}/connection.c ${CMAKE_CURRENT_SOURCE_DIR}/connection.h diff --git a/examples/msg/bittorrent/bittorrent_platfgen.c b/examples/msg/bittorrent/bittorrent_platfgen.c deleted file mode 100644 index 16c0e65569..0000000000 --- a/examples/msg/bittorrent/bittorrent_platfgen.c +++ /dev/null @@ -1,154 +0,0 @@ -/* Copyright (c) 2012-2015. The SimGrid Team. - * All rights reserved. */ - -/* 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 "bittorrent.h" -#include "peer.h" -#include "tracker.h" -#include -#include -/** - * Bittorrent example launcher, using a generated platform - */ - -static RngStream rng_stream; - -void promoter(context_node_t node); -void labeler(context_edge_t edge); -void create_environment(int node_count); -void dispatch_jobs(double tracker_deadline, double peer_deadline, - double seed_percentage); - -void promoter(context_node_t node) -{ - s_sg_platf_host_cbarg_t host_parameters; - - if (node->degree == 1) { - //We promote only the leaf; as we use a star topology, all the nodes - //will be promoted except the first one, which will be a router with - //every hosts connected on. - host_parameters.id = NULL; - - //Power from 3,000,000 to 10,000,000 - host_parameters.speed_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(host_parameters.speed_peak, double, - 7000000 * RngStream_RandU01(rng_stream) + 3000000.0); - host_parameters.core_amount = 1; - host_parameters.speed_scale = 1; - host_parameters.speed_trace = NULL; - host_parameters.initiallyOn = 1; - host_parameters.state_trace = NULL; - host_parameters.coord = NULL; - host_parameters.properties = NULL; - - platf_graph_promote_to_host(node, &host_parameters); - } -} - -void labeler(context_edge_t edge) -{ - - s_sg_platf_link_cbarg_t link_parameters; - link_parameters.id = NULL; - - //bandwidth from 3,000,000 to 10,000,000 - link_parameters.bandwidth = 7000000 * RngStream_RandU01(rng_stream) + 3000000; - link_parameters.bandwidth_trace = NULL; - - //Latency from 0ms to 100ms - link_parameters.latency = RngStream_RandU01(rng_stream) / 10.0; - link_parameters.latency_trace = NULL; - link_parameters.initiallyOn = 1; - link_parameters.state_trace = NULL; - link_parameters.policy = SURF_LINK_SHARED; - link_parameters.properties = NULL; - - platf_graph_link_label(edge, &link_parameters); -} - -void create_environment(int node_count) -{ - - platf_graph_uniform(node_count); - - //every nodes are connected to the first one - platf_graph_interconnect_star(); - //No need to check if the graph is connected, the star topology implies it. - - //register promoter and labeler - platf_graph_promoter(promoter); - platf_graph_labeler(labeler); - - //promoting and labeling - platf_do_promote(); - platf_do_label(); - - //Put the platform into the simulator - platf_generate(); -} - -void dispatch_jobs(double tracker_deadline, double peer_deadline, - double seed_percentage) -{ - - xbt_dynar_t available_nodes = MSG_hosts_as_dynar(); - msg_host_t host; - unsigned int i; - - char **arguments_tracker; - char **arguments_peer; - - unsigned int seed_count = - (seed_percentage / 100.0) * xbt_dynar_length(available_nodes); - - xbt_dynar_foreach(available_nodes, i, host) { - if (i == 0) { - //The fisrt node is the tracker - arguments_tracker = xbt_malloc0(sizeof(char *) * 2); - arguments_tracker[0] = xbt_strdup("tracker"); - arguments_tracker[1] = bprintf("%f", tracker_deadline); - MSG_process_create_with_arguments("tracker", tracker, NULL, host, 2, - arguments_tracker); - } else { - //Other nodes are peers - int argument_size; - arguments_peer = xbt_malloc0(sizeof(char *) * 4); - arguments_peer[0] = xbt_strdup("peer"); - arguments_peer[1] = bprintf("%d", i); - arguments_peer[2] = bprintf("%f", peer_deadline); - - //The first peers will be seeders - if (seed_count > 0) { - seed_count--; - arguments_peer[3] = xbt_strdup("1"); - argument_size = 4; - } else { - //Other ars leechers - arguments_peer[3] = NULL; - argument_size = 3; - } - MSG_process_create_with_arguments("peer", peer, NULL, host, - argument_size, arguments_peer); - } - } -} - -int main(int argc, char *argv[]) -{ - MSG_init(&argc, argv); - - rng_stream = RngStream_CreateStream(NULL); - - //Maybe these parameters should be set from the command line... - //create_environment() - create_environment(20); - - //dispatch_jobs(, , ) - dispatch_jobs(2000, 2000, 10); - - MSG_main(); - - return 0; -} diff --git a/examples/platforms/conf/gridpp_grid_2004.xml b/examples/platforms/conf/gridpp_grid_2004.xml deleted file mode 100644 index af2d582016..0000000000 --- a/examples/platforms/conf/gridpp_grid_2004.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/platforms/conf/lcg_sept2004_grid.xml b/examples/platforms/conf/lcg_sept2004_grid.xml deleted file mode 100644 index fced84a585..0000000000 --- a/examples/platforms/conf/lcg_sept2004_grid.xml +++ /dev/null @@ -1,618 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/platforms/conf/transform_optorsim_platform.pl b/examples/platforms/conf/transform_optorsim_platform.pl index d2db4d946e..7f9e93fa98 100644 --- a/examples/platforms/conf/transform_optorsim_platform.pl +++ b/examples/platforms/conf/transform_optorsim_platform.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# Copyright (c) 2011, 2014. The SimGrid Team. +# Copyright (c) 2011, 2014, 2016. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it @@ -17,10 +17,21 @@ my($conf_file)=$ARGV[0]; open FILE, $conf_file or die "Unable to open $conf_file"; +print "\n\n"; + print "\n"; print "\n"; print "\n"; -print "\n"; +print "\n"; my $line; my @tokens; @@ -39,134 +50,130 @@ my @routes = (); my @routes_router = (); my @routes_cluster = (); my $nb_host; -while(defined($line=)) -{ - -if($line =~ /^#(.*)\)(.*)$/) -{ +while(defined($line=)){ + if($line =~ /^#(.*)\)(.*)$/) + { print "\n"; push @list_of_name, $2; -} -elsif($line =~ /^([0-9]*) ([0-9]*) ([0-9]*) (.*)$/) -{ + } + elsif($line =~ /^([0-9]*) ([0-9]*) ([0-9]*) (.*)$/) + { if($1 == "0"){ - push @is_router, 1; - if(@list_of_name){ - push @routers, "\t\t\n"; - } - else{ - push @routers, "\t\t\n"; - } + push @is_router, 1; + if(@list_of_name){ + push @routers, " \n"; + } + else{ + push @routers, " \n"; + } } else{ - push @is_router, 0; - $nb_host = $1; - if(@list_of_name){ - push @hosts, "\t\n"; - } - else{ - push @hosts, "\t\n"; - } + push @is_router, 0; + $nb_host = $1; + if(@list_of_name){ + push @hosts, " \n"; + } + else{ + push @hosts, " \n"; + } } my $table = $4; @tokens = split(/ /,$table); foreach $token (@tokens) { - if($src >= $dst){ - if($token != "0") #if there is a link between src and dst - { - #Create a link - if($1 == "0"){ - push @links_router, "\t\t\n"; - } - else{ - push @links, "\t\n"; - } - - #Create the route between router and router - if($is_router[$src] && $is_router[$dst]) - { - if(@list_of_name){ - push @routes_router, "\t\t\n"; - } - else{ - push @routes_router, "\t\t\n"; - } - push @routes_router, "\t\t\t\n"; - push @routes_router, "\t\t\n"; - } - - #Create the route between cluster and cluster - elsif(!$is_router[$src] && !$is_router[$dst]) - { - if(@list_of_name){ - push @routes_cluster, "\t\t\n"; - } - else{ - push @routes_cluster, "\t\t\n"; - } - push @routes_cluster, "\t\t\t\n"; - push @routes_cluster, "\t\t\n"; - } - else - { - push @routes, "\t\n";} - else #cluster - {push @routes, "\t\tdst=\"$list_of_name[$dst]\" gw_dst=\"$list_of_name[$dst]-router\">\n";} - } - else{ - if($is_router[$src]) #router - {push @routes, "src=\"AS_intern\" gw_src=\"router$src\"\n";} - else #cluster - {push @routes, "src=\"cluster$src\" gw_src=\"cluster$src-router\"\n";} - - - if($is_router[$dst]) #router - {push @routes, "\t\tdst=\"AS_intern\" gw_dst=\"router$dst\">\n";} - else #cluster - {push @routes, "\t\tdst=\"cluster$dst\" gw_dst=\"cluster$dst-router\">\n";} - } - push @routes, "\t\t\n"; - push @routes, "\t\n"; - - } - - $num_link++; + if($src >= $dst){ + if($token != "0") #if there is a link between src and dst + { + #Create a link + if($1 == "0"){ + push @links_router, " \n"; + } + else{ + push @links, " \n"; + } + + #Create the route between router and router + if($is_router[$src] && $is_router[$dst]) + { + if(@list_of_name){ + push @routes_router, " "; + } + else{ + push @routes_router, " "; + } + push @routes_router, " "; + push @routes_router, " \n"; + } + + #Create the route between cluster and cluster + elsif(!$is_router[$src] && !$is_router[$dst]) + { + if(@list_of_name){ + push @routes_cluster, " \n"; + } + else{ + push @routes_cluster, " \n"; + } + push @routes_cluster, " \n"; + push @routes_cluster, " \n"; + } + else + { + push @routes, " \n";} + else #cluster + {push @routes, "dst=\"$list_of_name[$dst]\" gw_dst=\"$list_of_name[$dst]-router\">\n";} } + else{ + if($is_router[$src]) #router + {push @routes, "src=\"AS_intern\" gw_src=\"router$src\" ";} + else #cluster + {push @routes, "src=\"cluster$src\" gw_src=\"cluster$src-router\" ";} + + + if($is_router[$dst]) #router + {push @routes, "dst=\"AS_intern\" gw_dst=\"router$dst\">\n";} + else #cluster + {push @routes, "dst=\"cluster$dst\" gw_dst=\"cluster$dst-router\">\n";} + } + push @routes, " \n"; + push @routes, " \n"; + + } + + $num_link++; } - $dst++; + } + $dst++; } $src++; $dst = 0; -} -else -{ -die; -} - - + } + else + { + die; + } } close(FILE); -print "\t\n"; +print " \n"; print @routers; print @links_router; print @routes_router; -print "\t\n"; +print " \n"; print "\n"; print @hosts; print @routes_cluster; @@ -175,9 +182,6 @@ print "\n"; print @links; print "\n"; print @routes; -print "\n"; - print "\n"; print ""; - print " \n"; diff --git a/examples/platforms/generation_scripts/generate_g5k_platform.pl b/examples/platforms/generation_scripts/generate_g5k_platform.pl deleted file mode 100755 index 048143fb8a..0000000000 --- a/examples/platforms/generation_scripts/generate_g5k_platform.pl +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env perl - -# Copyright (c) 2011, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -use strict; -use warnings; -use Switch; -my $toversion=3; - -if($#ARGV!=1) { - die "Usage: ./generate_g5k_platform.pl g5k_username g5k_password\n"; -} - -print "\n"; -print "\n"; -print "\n"; -print "\t\n"; - -`rm -rf temp_g5k`; -`mkdir -p temp_g5k`; -chdir("./temp_g5k"); -`wget https://api.grid5000.fr/2.0/grid5000/sites --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`; - -open SITES_LIGNE, 'sites' or die "Unable to open sites $!\n"; -my $line = ""; -my $site = ""; -my $cluster = ""; -my $nodes = ""; -my @AS_route = (); - -print "\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -#printf "\t\t\t\n"; -print "\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -#printf "\t\t\n"; -print "\n"; - -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -#print "\t\t\n"; -print "\t\t\n"; - -while(defined($line=)) -{ - if($line =~ /"uid": "(.*)",/){ - $site = $1; - print "\t\t\n"; - `wget https://api.grid5000.fr/2.0/grid5000/sites/$site/clusters --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`; - open CLUSTERS_LIGNE, 'clusters' or die "Unable to open clusters $!\n"; - while(defined($line=)) - { - if($line =~ /"uid": "(.*)",/){ - $cluster = $1; - print "\t\t\t)) - { - if($line =~ /"total": (.*),/){ - print "\t\t\t\tradical=\"1-$1\" power=\""; - &get_gflops($cluster); - print "\" bw=\"1.25E8\" lat=\"1.0E-4\""."\n"; - print "\t\t\t\tbb_bw=\"1.25E9\" bb_lat=\"1.0E-4\">\n"; - } - } - print "\t\t\t\n\n"; - close NODES_LIGNE; - `rm nodes`; - } - } - close CLUSTERS_LIGNE; - `rm clusters`; - - print "\t\t\t\n"; - print "\t\t\t\t\n"; - print "\t\t\t\n"; - print "\t\t\t\n"; - print "\n"; - - print "\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\n\n"; - - print "\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\n\n"; - - print "\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\n\n"; - - print "\t\t\n"; - - push @AS_route, $site; - } -} - -while(@AS_route) -{ - $site = pop @AS_route; - print "\t\t\n"; - print "\t\t\t\n"; - print "\t\t\n"; - -# print "\t\t\n"; -# print "\t\t\t\n"; -# print "\t\t\n"; -} - -print "\t\n"; -print "\n"; -`rm sites`; -close SITES_LIGNE; - - -sub get_gflops { - switch ($_[0]) { - #Bordeaux - case "bordeplage" { print "5.2297E9" } - case "bordereau" { print "8.8925E9" } - case "borderline" { print "13.357E9" } - #Lille - case "chicon" { print "8.9618E9" } - case "chimint" { print "23.531E9" } - case "chinqchint" { print "22.270E9" } - case "chirloute" { print "24.473E9" } - #Grenoble - case "adonis" { print "23.681E9" } - case "edel" { print "23.492E9" } - case "genepi" { print "21.175E9" } - #Lyon - case "capricorne" { print "4.7233E9" } - case "sagittaire" { print "5.6693E9" } - #Nancy - case "graphene" { print "16.673E9" } - case "griffon" { print "20.678E9" } - #Orsay - case "gdx" { print "4.7153E9" } - case "netgdx" { print "4.7144E9" } - #Rennes - case "paradent" { print "21.496E9" } - case "paramount" { print "12.910E9" } - case "parapide" { print "30.130E9" } - case "parapluie" { print "27.391E9" } - #Sophia - case "helios" { print "7.7318E9" } - case "sol" { print "8.9388E9" } - case "suno" { print "23.530E9" } - #Toulouse - case "pastel" { print "9.5674E9" } - case "violette" { print "5.1143E9" } - #Reims - case "stremi" { print "TODO" } - #Luxembourg - case "granduc" { print "TODO" } - - default: { print "TODO" } - } -} diff --git a/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl b/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl deleted file mode 100755 index 9f3818e845..0000000000 --- a/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl +++ /dev/null @@ -1,351 +0,0 @@ -#!/usr/bin/env perl - -# Copyright (c) 2011, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -use strict; -use warnings; -use Switch; - -my $site=""; -my $cluster=""; -my $toversion=3; -my $line; -my $uid=""; -my $i=0; -my @AS_route = (); - -if($#ARGV!=1) { - die "Usage: ./generate_g5k_platform.pl g5k_username g5k_password\n"; -} - -print "\n"; -print "\n"; -print "\n"; -print "\t\n"; - -print "\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -#printf "\t\t\t\n"; -print "\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -printf "\t\t\t\n"; -#printf "\t\t\n"; -print "\n"; - -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -print "\t\t\n"; -#print "\t\t\n"; -print "\t\t\n"; - -`wget https://api.grid5000.fr/2.0/grid5000/sites --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`; -open SITES_LIGNE, 'sites' or die "Unable to open sites $!\n"; -while(defined($line=)) -{ - if($line =~ /"uid": "(.*)",/){ - $site = $1; - print "\t\t\n"; - - `wget https://api.grid5000.fr/2.0/grid5000/sites/$site/clusters --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`; - open CLUSTERS_LIGNE, 'clusters' or die "Unable to open clusters $!\n"; - while(defined($line=)) - { - if($line =~ /"uid": "(.*)",/){ - $cluster = $1; - &get_switch($site, $cluster); - } - } - - close CLUSTERS_LIGNE; - `rm clusters`; - - print "\t\t\t\n"; - print "\t\t\t\t\n"; - print "\t\t\t\n"; - print "\t\t\t\n"; - print "\n"; - - print "\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\n\n"; - - print "\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\n\n"; - - print "\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\n\n"; - - print "\t\t\n"; - - push @AS_route, $site; - } -} -close SITES_LIGNE; -`rm sites`; - -printf "\n"; - -while(@AS_route) -{ - $site = pop @AS_route; - print "\t\t\n"; - print "\t\t\t\n"; - print "\t\t\n"; -} - -print "\t\n"; -print "\n"; - -sub get_switch { - my $total; - my $switch=""; - my @switch_list=(); - - my @host=(); - my @host_switch=(); - $site="$_[0]"; - $cluster="$_[1]"; - `wget https://api.grid5000.fr/2.0/grid5000/sites/$site/clusters/$cluster/nodes --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`; - open NODES_LIGNE, 'nodes' or die "Unable to open nodes $!\n"; - while(defined($line=)) - { - if($line =~ /"uid": "(.*)",/) - { - $uid = $1; - push(@host, $1); - } - if($line =~ /"total": (.*),/){ - $total = $1; - } - if($line =~ /"switch": "(.*)",/ && !$switch) - { - $switch = "$1"; - push(@host_switch, $1); - } - if( $uid && $switch ) - { - push(@switch_list, $switch); - $uid=""; - $switch=""; - } - } - close NODES_LIGNE; - `rm nodes`; - - my %count; - my @uniq_array = grep { ++$count{$_} < 2 } @switch_list; - @uniq_array = sort (@uniq_array); - if(@switch_list && @uniq_array != 1){ - - if(@switch_list != @host){ - printf "Take care \@host != of \@switch_list\n"; - } - - print "\t\t\t\n"; - - my @num=(); - my $radical; - foreach(@uniq_array){ - $switch = $_; - $i=0; - @num=(); - foreach(@host_switch){ - if($_ =~ $switch){ - if($host[$i] =~ /$cluster-(.*)/){ - push(@num, $1); - } - } - $i++; - } - - my $deb; - my $fin; - @num=sort {$a <=> $b} (@num); - $radical = ""; - - $i=0; - foreach(@num){ - if($i == 0){ - $deb = $num[$i]; - $fin = $num[$i]; - } - else{ - if($num[$i] == ($num[$i-1]+1) ) - { - $fin = $num[$i]; - if(@num == ($i+1)){ - if($deb != $fin) - { - if(!($radical =~ /^$/)) - { - $radical = $radical.";"; - } - $radical = $radical.$deb."-".$fin; - $deb = $num[$i]; - $fin = $num[$i]; - } - else - { - $radical=$radical.";".$num[$i]; - } - } - } - else - { - if($deb != $fin) - { - if(!($radical =~ /^$/)) - { - $radical = $radical.","; - } - $radical = $radical.$deb."-".$fin; - $deb = $num[$i]; - $fin = $num[$i]; - } - else - { - $radical=$radical.",".$num[$i]; - } - - } - } - $i++; - } - print "\t\t\t\t\n"; - } - - print "\n\t\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\t\n"; - - print "\t\t\t\t\n\n"; - - print "\t\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\t\n"; - - print "\t\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\t\n"; - - print "\t\t\t\t\n"; - print "\t\t\t\t\t\n"; - print "\t\t\t\t\n"; - - - print "\t\t\t\n"; - - - } - else{ - print "\t\t\t\n"; - } - print "\t\t\t\n\n"; -} - - -sub get_gflops { - switch ($_[0]) { - #Bordeaux - case "bordeplage" { print "5.2297E9" } - case "bordereau" { print "8.8925E9" } - case "borderline" { print "13.357E9" } - #Lille - case "chicon" { print "8.9618E9" } - case "chimint" { print "23.531E9" } - case "chinqchint" { print "22.270E9" } - case "chirloute" { print "24.473E9" } - #Grenoble - case "adonis" { print "23.681E9" } - case "edel" { print "23.492E9" } - case "genepi" { print "21.175E9" } - #Lyon - case "capricorne" { print "4.7233E9" } - case "sagittaire" { print "5.6693E9" } - #Nancy - case "graphene" { print "16.673E9" } - case "griffon" { print "20.678E9" } - #Orsay - case "gdx" { print "4.7153E9" } - case "netgdx" { print "4.7144E9" } - #Rennes - case "paradent" { print "21.496E9" } - case "paramount" { print "12.910E9" } - case "parapide" { print "30.130E9" } - case "parapluie" { print "27.391E9" } - #Sophia - case "helios" { print "7.7318E9" } - case "sol" { print "8.9388E9" } - case "suno" { print "23.530E9" } - #Toulouse - case "pastel" { print "9.5674E9" } - case "violette" { print "5.1143E9" } - #Reims - case "stremi" { print "TODO" } - #Luxembourg - case "granduc" { print "TODO" } - - default: { print "TODO" } - } -} diff --git a/examples/simdag/dax/CMakeLists.txt b/examples/simdag/dax/CMakeLists.txt index 56c3b75bd9..490a0c9de8 100644 --- a/examples/simdag/dax/CMakeLists.txt +++ b/examples/simdag/dax/CMakeLists.txt @@ -27,12 +27,6 @@ set(examples_src ${CMAKE_CURRENT_SOURCE_DIR}/dax_test.c PARENT_SCOPE ) -set(bin_files - ${bin_files} - ${CMAKE_CURRENT_SOURCE_DIR}/generate_forkjoin.pl - ${CMAKE_CURRENT_SOURCE_DIR}/generate_strassen.pl - PARENT_SCOPE - ) set(txt_files ${txt_files} PARENT_SCOPE diff --git a/examples/simdag/dax/generate_forkjoin.pl b/examples/simdag/dax/generate_forkjoin.pl deleted file mode 100755 index 545ccf9b23..0000000000 --- a/examples/simdag/dax/generate_forkjoin.pl +++ /dev/null @@ -1,36 +0,0 @@ -#! /usr/bin/env perl - -# Copyright (c) 2009, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -use strict; - -my $node_count = int($ARGV[0]) || die "Usage: $0 node_count level_count\n"; -my $level_count = int($ARGV[1]) || die "Usage: $0 node_count level_count\n"; - -print "\n"; -print "\n"; -print "\n"; - -for (my $level=1;$level<=$level_count;$level++) { - for (my $i=1;$i<=$node_count;$i++) { - print "\n"; - print " \n"; - print " \n"; - print "\n"; - } - - if ($level<$level_count) { - print "\n"; - for (my $i=1;$i<=$node_count;$i++) { - print " \n"; - print " \n"; - } - print "\n"; - } -} - -print "\n"; diff --git a/examples/simdag/dax/generate_strassen.pl b/examples/simdag/dax/generate_strassen.pl deleted file mode 100755 index 060f8991f4..0000000000 --- a/examples/simdag/dax/generate_strassen.pl +++ /dev/null @@ -1,219 +0,0 @@ -#! /usr/bin/env perl - -# Copyright (c) 2009, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -use strict; - -sub job { - print "\n"; -} -sub file { - print " \n"; -} -sub strassen { - my $matSize=shift; - my $max_level=shift||1; - my $level=shift||1; - my $A = shift||"A"; - my $B = shift||"B"; - - if ($level<$max_level) { - die "Recursive Strassen don't work yet\n"; - } - - my $sizeAdd=$matSize*$matSize/4; - my $sizeMult=$matSize*$matSize*$matSize/8; - my $sizeBlock=$sizeAdd; - - # T1 = A11 + A22 - job("T1","Strassen","l$level",$sizeAdd); - file("${A}11l$level","input",$sizeBlock); - file("${A}22l$level","input",$sizeBlock); - file("T1l$level","output",$sizeBlock); - print("\n"); - - # T2 = A21 + A22 - job("T2","Strassen","l$level",$sizeAdd); - file("${A}21l$level","input",$sizeBlock); - file("${A}22l$level","input",$sizeBlock); - file("T2l$level","output",$sizeBlock); - print("\n"); - - # T3 = A11 + A12 - job("T3","Strassen","l$level",$sizeAdd); - file("${A}11l$level","input",$sizeBlock); - file("${A}12l$level","input",$sizeBlock); - file("T3l$level","output",$sizeBlock); - print("\n"); - - # T4 = A21 − A11 - job("T4","Strassen","l$level",$sizeAdd); - file("${A}21l$level","input",$sizeBlock); - file("${A}11l$level","input",$sizeBlock); - file("T4l$level","output",$sizeBlock); - print("\n"); - - # T5 = A12 − A22 - job("T5","Strassen","l$level",$sizeAdd); - file("${A}12l$level","input",$sizeBlock); - file("${A}22l$level","input",$sizeBlock); - file("T5l$level","output",$sizeBlock); - print("\n"); - - # T6 = B11 + B22 - job("T6","Strassen","l$level",$sizeAdd); - file("${B}11l$level","input",$sizeBlock); - file("${B}22l$level","input",$sizeBlock); - file("T6l$level","output",$sizeBlock); - print("\n"); - - # T7 = B12 − B22 - job("T7","Strassen","l$level",$sizeAdd); - file("${B}12l$level","input",$sizeBlock); - file("${B}22l$level","input",$sizeBlock); - file("T7l$level","output",$sizeBlock); - print("\n"); - - # T8 = B21 − B11 - job("T8","Strassen","l$level",$sizeAdd); - file("${B}21l$level","input",$sizeBlock); - file("${B}11l$level","input",$sizeBlock); - file("T8l$level","output",$sizeBlock); - print("\n"); - - # T9 = B11 + B12 - job("T9","Strassen","l$level",$sizeAdd); - file("${B}11l$level","input",$sizeBlock); - file("${B}12l$level","input",$sizeBlock); - file("T9l$level","output",$sizeBlock); - print("\n"); - - # T10 = B21 + B22 - job("T10","Strassen","l$level",$sizeAdd); - file("${B}21l$level","input",$sizeBlock); - file("${B}22l$level","input",$sizeBlock); - file("T10l$level","output",$sizeBlock); - print("\n"); - - # Q1 = T1 × T6 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"T1_","T6_"); - } else { - job("Q1","Strassen","l$level",$sizeMult); - file("T1l$level","input",$sizeBlock); - file("T6l$level","input",$sizeBlock); - file("Q1l$level","output",$sizeBlock); - print("\n"); - } - - # Q2 = T2 × B11 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"T2_","B11_"); - } else { - job("Q2","Strassen","l$level",$sizeMult); - file("T2l$level","input",$sizeBlock); - file("${B}11l$level","input",$sizeBlock); - file("Q2l$level","output",$sizeBlock); - print("\n"); - } - - # Q3 = A11 × T7 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"A11_","T7_"); - } else { - job("Q3","Strassen","l$level",$sizeMult); - file("${A}11l$level","input",$sizeBlock); - file("T7l$level","input",$sizeBlock); - file("Q3l$level","output",$sizeBlock); - print("\n"); - } - - # Q4 = A22 × T8 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"A22_","T8_"); - } else { - job("Q4","Strassen","l$level",$sizeMult); - file("${A}22l$level","input",$sizeBlock); - file("T8l$level","input",$sizeBlock); - file("Q4l$level","output",$sizeBlock); - print("\n"); - } - - # Q5 = T3 × B22 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"T3_","B22_"); - } else { - job("Q5","Strassen","l$level",$sizeMult); - file("T3l$level","input",$sizeBlock); - file("${B}22l$level","input",$sizeBlock); - file("Q5l$level","output",$sizeBlock); - print("\n"); - } - - # Q6 = T4 × T9 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"T4_","T9_"); - } else { - job("Q6","Strassen","l$level",$sizeMult); - file("T4l$level","input",$sizeBlock); - file("T9l$level","input",$sizeBlock); - file("Q6l$level","output",$sizeBlock); - print("\n"); - } - - # Q7 = T5 × T10 - if ($level<$max_level) { - strassen($sizeBlock,$max_level,$level+1,"T5_","T10_"); - } else { - job("Q7","Strassen","l$level",$sizeMult); - file("T5l$level","input",$sizeBlock); - file("T10l$level","input",$sizeBlock); - file("Q7l$level","output",$sizeBlock); - print("\n"); - } - - # C11 = Q1 + Q4 − Q5 + Q7 - job("Q11","Strassen","l$level",$sizeAdd*3); - file("Q1l$level","input",$sizeBlock); - file("Q4l$level","input",$sizeBlock); - file("Q5l$level","input",$sizeBlock); - file("Q7l$level","input",$sizeBlock); - file("C11l$level","output",$sizeBlock); - print("\n"); - - # C12 = Q3 + Q5 - job("C12","Strassen","l$level",$sizeAdd); - file("Q3l$level","input",$sizeBlock); - file("Q5l$level","input",$sizeBlock); - file("C12l$level","output",$sizeBlock); - print("\n"); - - # C21 = Q2 + Q4 - job("C21","Strassen","l$level",$sizeAdd); - file("Q2l$level","input",$sizeBlock); - file("Q4l$level","input",$sizeBlock); - file("C21l$level","output",$sizeBlock); - print("\n"); - - # C22 = Q1 − Q2 + Q3 + Q6 - job("C22","Strassen","l$level",$sizeMult); - file("Q1l$level","input",$sizeBlock); - file("Q2l$level","input",$sizeBlock); - file("Q3l$level","input",$sizeBlock); - file("Q6l$level","input",$sizeBlock); - file("C22l$level","output",$sizeBlock); - print("\n"); -} - -print "\n"; -print "\n"; -print "\n"; - -strassen(2000); - -print "\n"; - diff --git a/examples/simdag/dot/dot_test.c b/examples/simdag/dot/dot_test.c index d06e646cc3..37f46846af 100644 --- a/examples/simdag/dot/dot_test.c +++ b/examples/simdag/dot/dot_test.c @@ -14,8 +14,7 @@ #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(test, - "Logging specific to this SimDag example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example"); int main(int argc, char **argv) { @@ -27,11 +26,8 @@ int main(int argc, char **argv) SD_init(&argc, argv); /* Check our arguments */ - if (argc < 3) { - XBT_INFO("Usage: %s platform_file dot_file [trace_file]", argv[0]); - XBT_INFO("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]); - exit(1); - } + xbt_assert(argc > 2, "Usage: %s platform_file dot_file [trace_file]" + "example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0], argv[0]); /* creation of the environment */ SD_create_environment(argv[1]); @@ -45,20 +41,13 @@ int main(int argc, char **argv) } char *tracefilename; - if (argc == 3) { - char *last = strrchr(argv[2], '.'); - - tracefilename = - bprintf("%.*s.trace", - (int) (last == NULL ? strlen(argv[2]) : last - argv[2]), - argv[2]); - } else { + char *last = strrchr(argv[2], '.'); + tracefilename = bprintf("%.*s.trace", (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),argv[2]); + if (argc == 4) tracefilename = xbt_strdup(argv[3]); - } /* Display all the tasks */ - XBT_INFO - ("------------------- Display all tasks of the loaded DAG ---------------------------"); + XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------"); xbt_dynar_foreach(dot, cursor, task) { SD_task_dump(task); } @@ -85,12 +74,10 @@ int main(int argc, char **argv) } } - XBT_INFO - ("------------------- Run the schedule ---------------------------"); + XBT_INFO("------------------- Run the schedule ---------------------------"); SD_simulate(-1); - XBT_INFO - ("------------------- Produce the trace file---------------------------"); + XBT_INFO("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing the trace of the run into %s", basename(tracefilename)); FILE *out = fopen(tracefilename, "w"); xbt_assert(out, "Cannot write to %s", tracefilename); @@ -102,22 +89,16 @@ int main(int argc, char **argv) switch (kind) { case SD_TASK_COMP_SEQ: fprintf(out, "[%f->%f] %s compute %f flops # %s\n", - SD_task_get_start_time(task), - SD_task_get_finish_time(task), - sg_host_get_name(wsl[0]), SD_task_get_amount(task), - SD_task_get_name(task)); + SD_task_get_start_time(task), SD_task_get_finish_time(task), + sg_host_get_name(wsl[0]), SD_task_get_amount(task), SD_task_get_name(task)); break; case SD_TASK_COMM_E2E: fprintf(out, "[%f -> %f] %s -> %s transfer of %.0f bytes # %s\n", - SD_task_get_start_time(task), - SD_task_get_finish_time(task), - sg_host_get_name(wsl[0]), - sg_host_get_name(wsl[1]), SD_task_get_amount(task), - SD_task_get_name(task)); + SD_task_get_start_time(task), SD_task_get_finish_time(task), + sg_host_get_name(wsl[0]), sg_host_get_name(wsl[1]), SD_task_get_amount(task), SD_task_get_name(task)); break; default: - xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), - SD_task_get_kind(task)); + xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), SD_task_get_kind(task)); } SD_task_destroy(task); } diff --git a/examples/simdag/dot/dot_test2.c b/examples/simdag/dot/dot_test2.c index 47f327a8c4..38b70958b8 100644 --- a/examples/simdag/dot/dot_test2.c +++ b/examples/simdag/dot/dot_test2.c @@ -1,6 +1,6 @@ /* simple test trying to load a DOT file. */ -/* Copyright (c) 2010-2015. The SimGrid Team. +/* Copyright (c) 2010-2016. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -13,8 +13,7 @@ #include "xbt/ex.h" #include -XBT_LOG_NEW_DEFAULT_CATEGORY(test, - "Logging specific to this SimDag example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example"); int main(int argc, char **argv) { @@ -26,27 +25,21 @@ int main(int argc, char **argv) SD_init(&argc, argv); /* Check our arguments */ - if (argc < 2) { - XBT_INFO("Usage: %s dot_file", argv[0]); - exit(1); - } + xbt_assert(argc > 1, "Usage: %s dot_file", argv[0]); /* load the DOT file */ dot = SD_dotload(argv[1]); /* Display all the tasks */ - XBT_INFO - ("------------------- Display all tasks of the loaded DAG ---------------------------"); + XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------"); xbt_dynar_foreach(dot, cursor, task) { SD_task_dump(task); } - XBT_INFO - ("--------------------- Transform the dynar into an array ---------------------------"); + XBT_INFO("--------------------- Transform the dynar into an array ---------------------------"); cursor=0; dot_as_array = (SD_task_t*) xbt_dynar_to_array(dot); - XBT_INFO - ("----------------------------- dump tasks again ------------------------------------"); + XBT_INFO("----------------------------- dump tasks again ------------------------------------"); while ((task=dot_as_array[cursor++])){ SD_task_dump(task); } diff --git a/examples/simdag/dot/ptg_test.c b/examples/simdag/dot/ptg_test.c index 19c6de9dc8..a313557ba3 100644 --- a/examples/simdag/dot/ptg_test.c +++ b/examples/simdag/dot/ptg_test.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. +/* Copyright (c) 2013-2016. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -12,8 +12,7 @@ #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(test, - "Logging specific to this SimDag example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example"); /* simple test trying to load a Parallel Task Graph (PTG) as a DOT file. */ int main(int argc, char **argv){ @@ -25,11 +24,7 @@ int main(int argc, char **argv){ SD_init(&argc, argv); /* Check our arguments */ - if (argc < 2) { - XBT_INFO("Usage: %s platform_file dot_file ", argv[0]); - XBT_INFO("example: %s ../2clusters.xml ptg.dot", argv[0]); - exit(1); - } + xbt_assert (argc > 1,"Usage: %s platform_file dot_file example: %s ../2clusters.xml ptg.dot", argv[0], argv[0]); /* creation of the environment */ SD_create_environment(argv[1]); @@ -42,8 +37,7 @@ int main(int argc, char **argv){ } /* Display all the tasks */ - XBT_INFO - ("------------------- Display all tasks of the loaded DAG ---------------------------"); + XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------"); xbt_dynar_foreach(dot, cursor, task) { SD_task_dump(task); } @@ -66,8 +60,7 @@ int main(int argc, char **argv){ } } - XBT_INFO - ("------------------- Run the schedule ---------------------------"); + XBT_INFO("------------------- Run the schedule ---------------------------"); SD_simulate(-1); XBT_INFO("Makespan: %f", SD_get_clock()); xbt_dynar_foreach(dot, cursor, task) { diff --git a/examples/simdag/dot/simulate_dot.c b/examples/simdag/dot/simulate_dot.c index c0fbe0ccf3..efcf24b581 100644 --- a/examples/simdag/dot/simulate_dot.c +++ b/examples/simdag/dot/simulate_dot.c @@ -1,6 +1,6 @@ /* simple test trying to load a DOT file. */ -/* Copyright (c) 2010-2015. The SimGrid Team. +/* Copyright (c) 2010-2016. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -14,8 +14,7 @@ #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(test, - "Logging specific to this SimDag example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example"); int main(int argc, char **argv) { @@ -27,11 +26,8 @@ int main(int argc, char **argv) SD_init(&argc, argv); /* Check our arguments */ - if (argc < 3) { - XBT_INFO("Usage: %s platform_file dot_file [trace_file]", argv[0]); - XBT_INFO("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]); - exit(1); - } + xbt_assert(argc > 2, "Usage: %s platform_file dot_file [trace_file]" + "example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0], argv[0]); /* creation of the environment */ SD_create_environment(argv[1]); @@ -45,20 +41,14 @@ int main(int argc, char **argv) } char *tracefilename; - if (argc == 3) { - char *last = strrchr(argv[2], '.'); - - tracefilename = - bprintf("%.*s.trace", - (int) (last == NULL ? strlen(argv[2]) : last - argv[2]), - argv[2]); - } else { + char *last = strrchr(argv[2], '.'); + tracefilename = bprintf("%.*s.trace", (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),argv[2]); + if (argc == 4) tracefilename = xbt_strdup(argv[3]); - } + /* Display all the tasks */ - XBT_INFO - ("------------------- Display all tasks of the loaded DAG ---------------------------"); + XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------"); xbt_dynar_foreach(dot, cursor, task) { SD_task_dump(task); } @@ -71,12 +61,10 @@ int main(int argc, char **argv) fprintf(dotout, "}\n"); fclose(dotout); - XBT_INFO - ("------------------- Run the schedule ---------------------------"); + XBT_INFO("------------------- Run the schedule ---------------------------"); SD_simulate(-1); - XBT_INFO - ("------------------- Produce the trace file---------------------------"); + XBT_INFO("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing the trace of the run into %s", basename(tracefilename)); FILE *out = fopen(tracefilename, "w"); xbt_assert(out, "Cannot write to %s", tracefilename); @@ -88,22 +76,16 @@ int main(int argc, char **argv) switch (kind) { case SD_TASK_COMP_SEQ: fprintf(out, "[%f->%f] %s compute %f flops # %s\n", - SD_task_get_start_time(task), - SD_task_get_finish_time(task), - sg_host_get_name(wsl[0]), SD_task_get_amount(task), - SD_task_get_name(task)); + SD_task_get_start_time(task), SD_task_get_finish_time(task), + sg_host_get_name(wsl[0]), SD_task_get_amount(task), SD_task_get_name(task)); break; case SD_TASK_COMM_E2E: fprintf(out, "[%f -> %f] %s -> %s transfer of %.0f bytes # %s\n", - SD_task_get_start_time(task), - SD_task_get_finish_time(task), - sg_host_get_name(wsl[0]), - sg_host_get_name(wsl[1]), SD_task_get_amount(task), - SD_task_get_name(task)); + SD_task_get_start_time(task), SD_task_get_finish_time(task), + sg_host_get_name(wsl[0]), sg_host_get_name(wsl[1]), SD_task_get_amount(task), SD_task_get_name(task)); break; default: - xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), - SD_task_get_kind(task)); + xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), SD_task_get_kind(task)); } SD_task_destroy(task); } diff --git a/examples/simdag/dot/test_simdag_dotload.tesh b/examples/simdag/dot/test_simdag_dotload.tesh index b26135f098..6d766977f7 100644 --- a/examples/simdag/dot/test_simdag_dotload.tesh +++ b/examples/simdag/dot/test_simdag_dotload.tesh @@ -463,4 +463,95 @@ $ $SG_TEST_EXENV ./dot_test --log=no_loc ${srcdir:=.}/../2clusters.xml ${srcdir: > [0.000000] [sd_daxparse/WARNING] the task 5 is in a cycle > [0.000000] [sd_daxparse/WARNING] the task 6 is in a cycle > [0.000000] [sd_dotparse/ERROR] The DOT described in dag_with_cycle.dot is not a DAG. It contains a cycle. -> [0.000000] [test/CRITICAL] No dot loaded. Do you have a cycle in your graph? \ No newline at end of file +> [0.000000] [test/CRITICAL] No dot loaded. Do you have a cycle in your graph? + +$ $SG_TEST_EXENV ./ptg_test --log=no_loc ${srcdir:=.}/../2clusters.xml ${srcdir:=.}/ptg.dot +> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks. +> [0.000000] [test/INFO] ------------------- Display all tasks of the loaded DAG --------------------------- +> [0.000000] [sd_task/INFO] Displaying task root +> [0.000000] [sd_task/INFO] - state: schedulable not runnable +> [0.000000] [sd_task/INFO] - kind: parallel computation following Amdahl's law +> [0.000000] [sd_task/INFO] - amount: 0 +> [0.000000] [sd_task/INFO] - alpha: 0.00 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 0 +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] root->c1 +> [0.000000] [sd_task/INFO] root->c2 +> [0.000000] [sd_task/INFO] Displaying task c1 +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: parallel computation following Amdahl's law +> [0.000000] [sd_task/INFO] - amount: 1000000000 +> [0.000000] [sd_task/INFO] - alpha: 0.20 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] root->c1 +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] c1->c3 +> [0.000000] [sd_task/INFO] Displaying task c2 +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: parallel computation following Amdahl's law +> [0.000000] [sd_task/INFO] - amount: 5000000000 +> [0.000000] [sd_task/INFO] - alpha: 0.50 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] root->c2 +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] c3 +> [0.000000] [sd_task/INFO] Displaying task c3 +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: parallel computation following Amdahl's law +> [0.000000] [sd_task/INFO] - amount: 2000000000 +> [0.000000] [sd_task/INFO] - alpha: 0.00 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 2 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] c1->c3 +> [0.000000] [sd_task/INFO] c2 +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] c3->end +> [0.000000] [sd_task/INFO] Displaying task c1->c3 +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: MxN data redistribution assuming 1D block distribution +> [0.000000] [sd_task/INFO] - amount: 500000000 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] c1 +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] c3 +> [0.000000] [sd_task/INFO] Displaying task c3->end +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: MxN data redistribution assuming 1D block distribution +> [0.000000] [sd_task/INFO] - amount: 200000000 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] c3 +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] end +> [0.000000] [sd_task/INFO] Displaying task root->c1 +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: MxN data redistribution assuming 1D block distribution +> [0.000000] [sd_task/INFO] - amount: 200000000 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] root +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] c1 +> [0.000000] [sd_task/INFO] Displaying task root->c2 +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: MxN data redistribution assuming 1D block distribution +> [0.000000] [sd_task/INFO] - amount: 100000000 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] root +> [0.000000] [sd_task/INFO] - post-dependencies: +> [0.000000] [sd_task/INFO] c2 +> [0.000000] [sd_task/INFO] Displaying task end +> [0.000000] [sd_task/INFO] - state: not scheduled not runnable +> [0.000000] [sd_task/INFO] - kind: parallel computation following Amdahl's law +> [0.000000] [sd_task/INFO] - amount: 0 +> [0.000000] [sd_task/INFO] - alpha: 0.00 +> [0.000000] [sd_task/INFO] - Dependencies to satisfy: 1 +> [0.000000] [sd_task/INFO] - pre-dependencies: +> [0.000000] [sd_task/INFO] c3->end +> [0.000000] [test/INFO] ------------------- Schedule tasks --------------------------- +> [0.000000] [test/INFO] ------------------- Run the schedule --------------------------- +> [3.290271] [test/INFO] Makespan: 3.290271 diff --git a/examples/smpi/mc/bugged1_liveness.c b/examples/smpi/mc/bugged1_liveness.c index b0f36ce18f..fb41816e8d 100644 --- a/examples/smpi/mc/bugged1_liveness.c +++ b/examples/smpi/mc/bugged1_liveness.c @@ -11,7 +11,7 @@ /******************************************************************************/ /* Run : - /usr/bin/time -f "clock:%e user:%U sys:%S swapped:%W exitval:%x max:%Mk" "$@" ../../../smpi_script/bin/smpirun -hostfile hostfile_bugged1_liveness -platform ../../platforms/cluster.xml --cfg=contexts/factory:ucontext --cfg=model-check/reduction:none --cfg=model-check/property:promela_bugged1_liveness --cfg=smpi/send_is_detached_thres:0 --cfg=contexts/stack_size:128 --cfg=model-check/visited:100000 --cfg=model-check/max_depth:100000 ./bugged1_liveness */ + /usr/bin/time -f "clock:%e user:%U sys:%S swapped:%W exitval:%x max:%Mk" "$@" ../../../smpi_script/bin/smpirun -hostfile hostfile_bugged1_liveness -platform ../../platforms/cluster.xml --cfg=contexts/factory:ucontext --cfg=model-check/reduction:none --cfg=model-check/property:promela_bugged1_liveness --cfg=smpi/send_is_detached_thresh:0 --cfg=contexts/stack_size:128 --cfg=model-check/visited:100000 --cfg=model-check/max_depth:100000 ./bugged1_liveness */ #include #include diff --git a/examples/smpi/mc/non_deterministic.tesh b/examples/smpi/mc/non_deterministic.tesh index a5d8e62cca..04f1b359d9 100644 --- a/examples/smpi/mc/non_deterministic.tesh +++ b/examples/smpi/mc/non_deterministic.tesh @@ -1,7 +1,7 @@ #! ./tesh ! timeout 60 -$ ../../../smpi_script/bin/smpirun -wrapper ${bindir:=.}/../../../bin/simgrid-mc -hostfile ${srcdir:=.}/hostfile_non_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --log=xbt_cfg.thresh:warning --cfg=model-check/communications_determinism:1 --cfg=smpi/send_is_detached_thres:0 --cfg=smpi/running_power:1e9 ./smpi_non_deterministic +$ ../../../smpi_script/bin/smpirun -wrapper ${bindir:=.}/../../../bin/simgrid-mc -hostfile ${srcdir:=.}/hostfile_non_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --log=xbt_cfg.thresh:warning --cfg=model-check/communications_determinism:1 --cfg=smpi/send_is_detached_thresh:0 --cfg=smpi/running_power:1e9 ./smpi_non_deterministic > [0.000000] [mc_global/INFO] Check communication determinism > [0.000000] [mc_comm_determinism/INFO] The communications pattern of the process 1 is different! (Different communication : 1) > [0.000000] [mc_comm_determinism/INFO] **************************************************** diff --git a/examples/smpi/mc/only_send_deterministic.c b/examples/smpi/mc/only_send_deterministic.c index fa4215f679..a554e56537 100644 --- a/examples/smpi/mc/only_send_deterministic.c +++ b/examples/smpi/mc/only_send_deterministic.c @@ -1,4 +1,4 @@ -/* ../../../smpi_script/bin/smpirun -hostfile hostfile_send_deterministic -platform ../../platforms/cluster.xml -np 3 --cfg=smpi/send_is_detached_thres:0 gdb\ --args\ ./send_deterministic */ +/* ../../../smpi_script/bin/smpirun -hostfile hostfile_send_deterministic -platform ../../platforms/cluster.xml -np 3 --cfg=smpi/send_is_detached_thresh:0 gdb\ --args\ ./send_deterministic */ /* Copyright (c) 2009-2015. The SimGrid Team. * All rights reserved. */ diff --git a/examples/smpi/mc/only_send_deterministic.tesh b/examples/smpi/mc/only_send_deterministic.tesh index daab716eee..c7993f4453 100644 --- a/examples/smpi/mc/only_send_deterministic.tesh +++ b/examples/smpi/mc/only_send_deterministic.tesh @@ -1,7 +1,7 @@ #! ./tesh ! timeout 60 -$ ../../../smpi_script/bin/smpirun -wrapper "${bindir:=.}/../../../bin/simgrid-mc" --log=xbt_cfg.thresh:warning -hostfile ${srcdir:=.}/hostfile_only_send_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check/communications_determinism:1 --cfg=smpi/send_is_detached_thres:0 --cfg=smpi/running_power:1e9 ./smpi_only_send_deterministic +$ ../../../smpi_script/bin/smpirun -wrapper "${bindir:=.}/../../../bin/simgrid-mc" --log=xbt_cfg.thresh:warning -hostfile ${srcdir:=.}/hostfile_only_send_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check/communications_determinism:1 --cfg=smpi/send_is_detached_thresh:0 --cfg=smpi/running_power:1e9 ./smpi_only_send_deterministic > [0.000000] [mc_comm_determinism/INFO] Check communication determinism > [0.000000] [mc_global/INFO] ****************************************************** > [0.000000] [mc_global/INFO] **** Only-send-deterministic communication pattern **** diff --git a/include/simgrid/jedule/jedule_events.h b/include/simgrid/jedule/jedule_events.h index d3132c56b8..1e6a87b539 100644 --- a/include/simgrid/jedule/jedule_events.h +++ b/include/simgrid/jedule/jedule_events.h @@ -17,6 +17,8 @@ #ifdef HAVE_JEDULE +SG_BEGIN_DECL() + struct jed_event { int event_id; char *name; @@ -42,6 +44,8 @@ void jed_event_add_characteristic(jed_event_t event, char *characteristic); void jed_event_add_info(jed_event_t event, char *key, char *value); +SG_END_DECL() + #endif #endif /* JEDULE_EVENTS_H_ */ diff --git a/include/simgrid/jedule/jedule_output.h b/include/simgrid/jedule/jedule_output.h index 60ae564b37..6a4a148d19 100644 --- a/include/simgrid/jedule/jedule_output.h +++ b/include/simgrid/jedule/jedule_output.h @@ -16,6 +16,8 @@ #ifdef HAVE_JEDULE +SG_BEGIN_DECL() + extern xbt_dynar_t jedule_event_list; void jedule_init_output(void); @@ -27,6 +29,8 @@ void jedule_store_event(jed_event_t event); void write_jedule_output(FILE *file, jedule_t jedule, xbt_dynar_t event_list, xbt_dict_t meta_info_dict); +SG_END_DECL() + #endif #endif /* JEDULE_OUTPUT_H_ */ diff --git a/include/simgrid/jedule/jedule_platform.h b/include/simgrid/jedule/jedule_platform.h index aac8597d81..f74ddf6f49 100644 --- a/include/simgrid/jedule/jedule_platform.h +++ b/include/simgrid/jedule/jedule_platform.h @@ -14,6 +14,8 @@ #ifdef HAVE_JEDULE +SG_BEGIN_DECL() + typedef struct jed_simgrid_container s_jed_simgrid_container_t, *jed_simgrid_container_t; @@ -90,6 +92,8 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, */ +SG_END_DECL() + #endif diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 5b57f6b5d0..522a075f44 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -68,7 +68,6 @@ XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_route_cbarg_t bypassroute); XBT_PUBLIC(void) sg_platf_new_bypassASroute (sg_platf_route_cbarg_t bypassASroute); // Add an bypassASroute XBT_PUBLIC(void) sg_platf_new_trace(sg_platf_trace_cbarg_t trace); -XBT_PUBLIC(void) sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect); XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS XBT_PUBLIC(void) sg_platf_new_mstorage(sg_platf_mstorage_cbarg_t mstorage); diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h deleted file mode 100644 index fbe912c3fa..0000000000 --- a/include/simgrid/platf_generator.h +++ /dev/null @@ -1,83 +0,0 @@ - -/* platf_generator.h - Public interface to the SimGrid platforms generator */ - -/* Copyright (c) 2004-2014. The SimGrid Team. - * All rights reserved. */ - -/* 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. */ - -#ifndef SG_PLATF_GEN_H -#define SG_PLATF_GEN_H - -#include "xbt.h" -#include "xbt/graph.h" //Only for platf_graph_get() -#include "platf.h" - -typedef enum { - ROUTER, - HOST, - CLUSTER -} e_platf_node_kind; - -typedef struct s_context_node_t { - unsigned long id; - double x, y; - int degree; - e_platf_node_kind kind; - int connect_checked; - union { - s_sg_platf_host_cbarg_t host_parameters; - s_sg_platf_cluster_cbarg_t cluster_parameters; - char* router_id; - }; -} s_context_node_t, *context_node_t; - -typedef struct s_context_edge_t { - unsigned long id; - double length; - int labeled; - s_sg_platf_link_cbarg_t link_parameters; -} s_context_edge_t, *context_edge_t; - -typedef void (*platf_promoter_cb_t) (context_node_t); -typedef void (*platf_labeler_cb_t) (context_edge_t); - -XBT_PUBLIC(void) platf_random_seed(unsigned long seed[6]); - -XBT_PUBLIC(void) platf_graph_uniform(unsigned long node_count); -XBT_PUBLIC(void) platf_graph_heavytailed(unsigned long node_count); - -XBT_PUBLIC(void) platf_graph_interconnect_star(void); -XBT_PUBLIC(void) platf_graph_interconnect_line(void); -XBT_PUBLIC(void) platf_graph_interconnect_ring(void); -XBT_PUBLIC(void) platf_graph_interconnect_clique(void); -XBT_PUBLIC(void) platf_graph_interconnect_uniform(double alpha); -XBT_PUBLIC(void) platf_graph_interconnect_exponential(double alpha); -XBT_PUBLIC(void) platf_graph_interconnect_zegura(double alpha, double beta, double r); -XBT_PUBLIC(void) platf_graph_interconnect_waxman(double alpha, double beta); -XBT_PUBLIC(void) platf_graph_interconnect_barabasi(void); - -XBT_PUBLIC(int) platf_graph_is_connected(void); - -XBT_PUBLIC(void) platf_graph_clear_links(void); - -XBT_PUBLIC(void) platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters); -XBT_PUBLIC(void) platf_graph_promote_to_cluster(context_node_t node, sg_platf_cluster_cbarg_t parameters); - -XBT_PUBLIC(void) platf_graph_link_label(context_edge_t edge, sg_platf_link_cbarg_t parameters); - -XBT_PUBLIC(void) platf_graph_promoter(platf_promoter_cb_t promoter_callback); -XBT_PUBLIC(void) platf_graph_labeler(platf_labeler_cb_t labeler_callback); - -XBT_PUBLIC(void) platf_do_promote(void); -XBT_PUBLIC(void) platf_do_label(void); - -XBT_PUBLIC(void) platf_generate(void); - -// WARNING : Only for debbugging ; should be removed when platform -// generation works correctly -XBT_PUBLIC(xbt_graph_t) platf_graph_get(void); - -#endif /* SG_PLATF_GEN_H */ - diff --git a/include/simgrid/simdag.h b/include/simgrid/simdag.h index 0fcdfbd337..dffd6f7db1 100644 --- a/include/simgrid/simdag.h +++ b/include/simgrid/simdag.h @@ -106,17 +106,14 @@ XBT_PUBLIC(const char*) SD_storage_get_host(SD_storage_t storage); * * This section describes the functions for managing the tasks. * - * A task is some working amount that can be executed - * in parallel on several workstations. A task may depend on other - * tasks, this means that the task cannot start until the other tasks are done. - * Each task has a \ref e_SD_task_state_t "state" indicating whether - * the task is scheduled, running, done, etc. + * A task is some working amount that can be executed in parallel on several hosts. A task may depend on other + * tasks, this means that the task cannot start until the other tasks are done. Each task has a + * \ref e_SD_task_state_t "state" indicating whether the task is scheduled, running, done, etc. * * @see SD_task_t, SD_task_dependency_management * @{ */ -XBT_PUBLIC(SD_task_t) SD_task_create(const char *name, void *data, - double amount); +XBT_PUBLIC(SD_task_t) SD_task_create(const char *name, void *data, double amount); XBT_PUBLIC(void *) SD_task_get_data(SD_task_t task); XBT_PUBLIC(void) SD_task_set_data(SD_task_t task, void *data); XBT_PUBLIC(e_SD_task_state_t) SD_task_get_state(SD_task_t task); @@ -130,46 +127,29 @@ XBT_PUBLIC(double) SD_task_get_amount(SD_task_t task); XBT_PUBLIC(void) SD_task_set_amount(SD_task_t task, double amount); XBT_PUBLIC(double) SD_task_get_alpha(SD_task_t task); XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task); -XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task, - int workstation_nb, - const sg_host_t * - workstation_list, - const double *flops_amount, - const double *bytes_amount); +XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task, int workstation_nb, const sg_host_t *workstation_list, + const double *flops_amount, const double *bytes_amount); XBT_PUBLIC(e_SD_task_kind_t) SD_task_get_kind(SD_task_t task); -XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int workstation_nb, - const sg_host_t * - workstation_list, - const double *flops_amount, - const double *bytes_amount, - double rate); +XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int workstation_nb, const sg_host_t *workstation_list, + const double *flops_amount, const double *bytes_amount, double rate); XBT_PUBLIC(void) SD_task_unschedule(SD_task_t task); XBT_PUBLIC(double) SD_task_get_start_time(SD_task_t task); XBT_PUBLIC(double) SD_task_get_finish_time(SD_task_t task); XBT_PUBLIC(xbt_dynar_t) SD_task_get_parents(SD_task_t task); XBT_PUBLIC(xbt_dynar_t) SD_task_get_children(SD_task_t task); XBT_PUBLIC(int) SD_task_get_workstation_count(SD_task_t task); -XBT_PUBLIC(sg_host_t *) SD_task_get_workstation_list(SD_task_t - task); +XBT_PUBLIC(sg_host_t *) SD_task_get_workstation_list(SD_task_t task); XBT_PUBLIC(void) SD_task_destroy(SD_task_t task); XBT_PUBLIC(void) SD_task_dump(SD_task_t task); XBT_PUBLIC(void) SD_task_dotty(SD_task_t task, void *out_FILE); -XBT_PUBLIC(SD_task_t) SD_task_create_comp_seq(const char *name, void *data, - double amount); -XBT_PUBLIC(SD_task_t) SD_task_create_comp_par_amdahl(const char *name, - void *data, - double amount, - double alpha); -XBT_PUBLIC(SD_task_t) SD_task_create_comm_e2e(const char *name, void *data, - double amount); -XBT_PUBLIC(SD_task_t) SD_task_create_comm_par_mxn_1d_block(const char *name, - void *data, - double amount); +XBT_PUBLIC(SD_task_t) SD_task_create_comp_seq(const char *name, void *data, double amount); +XBT_PUBLIC(SD_task_t) SD_task_create_comp_par_amdahl(const char *name, void *data, double amount, double alpha); +XBT_PUBLIC(SD_task_t) SD_task_create_comm_e2e(const char *name, void *data, double amount); +XBT_PUBLIC(SD_task_t) SD_task_create_comm_par_mxn_1d_block(const char *name, void *data, double amount); XBT_PUBLIC(void) SD_task_distribute_comp_amdahl(SD_task_t task, int ws_count); -XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count, - const sg_host_t * list); +XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count, const sg_host_t * list); XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...); @@ -177,11 +157,7 @@ XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...); * * For example, create a pure computation task (no comm) like this: * - * SD_task_schedule(task, my_workstation_nb, - * my_workstation_list, - * my_flops_amount, - * SD_TASK_SCHED_NO_COST, - * my_rate); + * SD_task_schedule(task, my_host_count, my_host_list, my_flops_amount, SD_TASK_SCHED_NO_COST, my_rate); */ #define SD_SCHED_NO_COST NULL @@ -196,13 +172,10 @@ XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...); * @see SD_task_management * @{ */ -XBT_PUBLIC(void) SD_task_dependency_add(const char *name, void *data, - SD_task_t src, SD_task_t dst); +XBT_PUBLIC(void) SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst); XBT_PUBLIC(void) SD_task_dependency_remove(SD_task_t src, SD_task_t dst); -XBT_PUBLIC(const char *) SD_task_dependency_get_name(SD_task_t src, - SD_task_t dst); -XBT_PUBLIC(void *) SD_task_dependency_get_data(SD_task_t src, - SD_task_t dst); +XBT_PUBLIC(const char *) SD_task_dependency_get_name(SD_task_t src, SD_task_t dst); +XBT_PUBLIC(void *) SD_task_dependency_get_data(SD_task_t src, SD_task_t dst); XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst); /** @} */ @@ -211,8 +184,7 @@ XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst); /** @defgroup SD_simulation Simulation * @brief Functions for creating the environment and launching the simulation * - * This section describes the functions for initializing SimDag, launching - * the simulation and exiting SimDag. + * This section describes the functions for initializing SimDag, launching the simulation and exiting SimDag. * * @{ */ @@ -230,6 +202,38 @@ XBT_PUBLIC(xbt_dynar_t) SD_dotload_with_sched(const char *filename); /** @} */ +/* Support some backward compatibility */ +#define SD_workstation_t sg_host_t + +#define SD_link_get_name sg_link_name +#define SD_link_get_current_latency sg_link_latency +#define SD_link_get_current_bandwidth sg_link_bandwidth + +#define SD_route_get_current_latency SD_route_get_latency +#define SD_route_get_current_bandwidth SD_route_get_bandwidth + +#define SD_workstation_get_list sg_host_list +#define SD_workstation_get_number sg_host_count + +#define SD_workstation_get_name sg_host_get_name +#define SD_workstation_get_by_name sg_host_by_name +#define SD_workstation_dump sg_host_dump +#define SD_workstation_get_data sg_host_user +#define SD_workstation_set_data sg_host_user_set +#define SD_workstation_get_properties sg_host_get_properties +#define SD_workstation_get_property_value sg_host_get_property_value +#define SD_workstation_get_power sg_host_speed +#define SD_workstation_get_available_power sg_host_get_available_speed + +#define SD_workstation_get_mounted_storage_list sg_host_get_mounted_storage_list +// Lost functions +//SD_workstation_get_access_mode +//SD_workstation_set_access_mode +//SD_workstation_get_current_task +//SD_route_get_communication_time => SG_route_get_latency() + amount / SD_route_get_bandwidth() +//SD_workstation_get_computation_time => amount / sg_host_speed() +//TRACE_sd_set_task_category + SG_END_DECL() #include "simgrid/instr.h" diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index d931d13084..bd12391e93 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -410,13 +410,13 @@ XBT_PUBLIC(void) simcall_set_category(smx_synchro_t synchro, const char *categor /************************** Synchro simcalls **********************************/ XBT_PUBLIC(smx_mutex_t) simcall_mutex_init(void); -XBT_PUBLIC(void) simcall_mutex_destroy(smx_mutex_t mutex); +XBT_PUBLIC(void) SIMIX_mutex_destroy(smx_mutex_t mutex); XBT_PUBLIC(void) simcall_mutex_lock(smx_mutex_t mutex); XBT_PUBLIC(int) simcall_mutex_trylock(smx_mutex_t mutex); XBT_PUBLIC(void) simcall_mutex_unlock(smx_mutex_t mutex); XBT_PUBLIC(smx_cond_t) simcall_cond_init(void); -XBT_PUBLIC(void) simcall_cond_destroy(smx_cond_t cond); +XBT_PUBLIC(void) SIMIX_cond_destroy(smx_cond_t cond); XBT_PUBLIC(void) simcall_cond_signal(smx_cond_t cond); XBT_PUBLIC(void) simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex); XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond, @@ -425,7 +425,7 @@ XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond, XBT_PUBLIC(void) simcall_cond_broadcast(smx_cond_t cond); XBT_PUBLIC(smx_sem_t) simcall_sem_init(int capacity); -XBT_PUBLIC(void) simcall_sem_destroy(smx_sem_t sem); +XBT_PUBLIC(void) SIMIX_sem_destroy(smx_sem_t sem); XBT_PUBLIC(void) simcall_sem_release(smx_sem_t sem); XBT_PUBLIC(int) simcall_sem_would_block(smx_sem_t sem); XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem); diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index 1ee0a15454..279ba4614b 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -76,7 +76,7 @@ #define MALLOCATOR_COMPILED_IN @MALLOCATOR_IS_WANTED@ /* Define if xbt contexts are based on our threads implementation or not */ -#cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@ +#cmakedefine HAVE_THREAD_CONTEXTS @HAVE_THREAD_CONTEXTS@ /* Jedule output */ #cmakedefine HAVE_JEDULE @HAVE_JEDULE@ diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 4e9160e478..180258ab1c 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -898,8 +898,62 @@ XBT_PUBLIC(void) SMPI_app_instance_register(const char *name, xbt_main_func_t co XBT_PUBLIC(void) SMPI_init(void); XBT_PUBLIC(void) SMPI_finalize(void); - - +/* Manual global privatization fallback */ +XBT_PUBLIC(void) smpi_register_static(void* arg, void_f_pvoid_t free_fn); +XBT_PUBLIC(void) smpi_free_static(void); + +#define SMPI_VARINIT_GLOBAL(name,type) \ +type *name = NULL; \ +static void __attribute__((constructor)) __preinit_##name(void) { \ + if(!name) \ + name = (type*)calloc(smpi_global_size(), sizeof(type)); \ +} \ +static void __attribute__((destructor)) __postfini_##name(void) { \ + free(name); \ + name = NULL; \ +} + +#define SMPI_VARINIT_GLOBAL_AND_SET(name,type,expr) \ +type *name = NULL; \ +static void __attribute__((constructor)) __preinit_##name(void) { \ + size_t size = smpi_global_size(); \ + size_t i; \ + type value = expr; \ + if(!name) { \ + name = (type*)malloc(size * sizeof(type)); \ + for(i = 0; i < size; i++) { \ + name[i] = value; \ + } \ + } \ +} \ +static void __attribute__((destructor)) __postfini_##name(void) { \ + free(name); \ + name = NULL; \ +} + +#define SMPI_VARGET_GLOBAL(name) name[smpi_process_index()] + +#define SMPI_VARINIT_STATIC(name,type) \ +static type *name = NULL; \ +if(!name) { \ + name = (type*)calloc(smpi_global_size(), sizeof(type)); \ + smpi_register_static(name, xbt_free_f); \ +} + +#define SMPI_VARINIT_STATIC_AND_SET(name,type,expr) \ +static type *name = NULL; \ +if(!name) { \ + size_t size = smpi_global_size(); \ + size_t i; \ + type value = expr; \ + name = (type*)malloc(size * sizeof(type)); \ + for(i = 0; i < size; i++) { \ + name[i] = value; \ + } \ + smpi_register_static(name, xbt_free_f); \ +} + +#define SMPI_VARGET_STATIC(name) name[smpi_process_index()] SG_END_DECL() #endif diff --git a/include/smpi/smpi_cocci.h b/include/smpi/smpi_cocci.h deleted file mode 100644 index f938a9bdf2..0000000000 --- a/include/smpi/smpi_cocci.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (c) 2011-2014. The SimGrid Team. - * All rights reserved. */ - -/* 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. */ - -#ifndef SMPI_COCCI_H -#define SMPI_COCCI_H - -#include - -/* Macros used by coccinelle-generated code */ - -#define SMPI_VARINIT_GLOBAL(name,type) \ -type *name = NULL; \ -static void __attribute__((constructor)) __preinit_##name(void) { \ - if(!name) \ - name = (type*)calloc(smpi_global_size(), sizeof(type)); \ -} \ -static void __attribute__((destructor)) __postfini_##name(void) { \ - free(name); \ - name = NULL; \ -} - -#define SMPI_VARINIT_GLOBAL_AND_SET(name,type,expr) \ -type *name = NULL; \ -static void __attribute__((constructor)) __preinit_##name(void) { \ - size_t size = smpi_global_size(); \ - size_t i; \ - type value = expr; \ - if(!name) { \ - name = (type*)malloc(size * sizeof(type)); \ - for(i = 0; i < size; i++) { \ - name[i] = value; \ - } \ - } \ -} \ -static void __attribute__((destructor)) __postfini_##name(void) { \ - free(name); \ - name = NULL; \ -} - -#define SMPI_VARGET_GLOBAL(name) name[smpi_process_index()] - -/* The following handle local static variables */ -/** @brief Make sure that the passed pointer is freed on process exit. - * - * This function is rather internal, mainly used for the - * privatization of global variables through coccinelle. - */ -XBT_PUBLIC(void) smpi_register_static(void* arg, void_f_pvoid_t free_fn); - -XBT_PUBLIC(void) smpi_free_static(void); - -#define SMPI_VARINIT_STATIC(name,type) \ -static type *name = NULL; \ -if(!name) { \ - name = (type*)calloc(smpi_global_size(), sizeof(type)); \ - smpi_register_static(name, xbt_free_f); \ -} - -#define SMPI_VARINIT_STATIC_AND_SET(name,type,expr) \ -static type *name = NULL; \ -if(!name) { \ - size_t size = smpi_global_size(); \ - size_t i; \ - type value = expr; \ - name = (type*)malloc(size * sizeof(type)); \ - for(i = 0; i < size; i++) { \ - name[i] = value; \ - } \ - smpi_register_static(name, xbt_free_f); \ -} - -#define SMPI_VARGET_STATIC(name) name[smpi_process_index()] - -#endif diff --git a/src/include/surf/random_mgr.h b/src/include/surf/random_mgr.h deleted file mode 100644 index 19b4a15a58..0000000000 --- a/src/include/surf/random_mgr.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2007-2014. The SimGrid Team. - * All rights reserved. */ - -/* 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. */ - -#ifndef _SURF_RMGR_H -#define _SURF_RMGR_H - -#include "xbt/heap.h" -#include "xbt/dict.h" - -SG_BEGIN_DECL() - -typedef enum { NONE, DRAND48, RAND, RNGSTREAM } e_random_generator_t; - -typedef struct random_data_desc { - long int seed; - double max, min; - double mean, std; /* note: mean and standard deviation are normalized */ - e_random_generator_t generator; -} s_random_data_t, *random_data_t; - -XBT_PUBLIC_DATA(xbt_dict_t) random_data_list; - -XBT_PUBLIC(double) random_generate(random_data_t random); -XBT_PUBLIC(random_data_t) random_new(e_random_generator_t generator, - long int seed, - double min, double max, double mean, - double stdDeviation); - -SG_END_DECL() -#endif /* _SURF_RMGR_H */ diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 82033ace64..73bfa4de94 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -11,33 +11,33 @@ XBT_LOG_NEW_CATEGORY(instr, "Logging the behavior of the tracing system (used for Visualization/Analysis of simulations)"); XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_config, instr, "Configuration"); -#define OPT_TRACING "tracing" -#define OPT_TRACING_PLATFORM "tracing/platform" -#define OPT_TRACING_TOPOLOGY "tracing/platform/topology" -#define OPT_TRACING_SMPI "tracing/smpi" -#define OPT_TRACING_SMPI_GROUP "tracing/smpi/group" -#define OPT_TRACING_SMPI_COMPUTING "tracing/smpi/computing" -#define OPT_TRACING_SMPI_SLEEPING "tracing/smpi/sleeping" -#define OPT_TRACING_SMPI_INTERNALS "tracing/smpi/internals" -#define OPT_TRACING_DISPLAY_SIZES "tracing/smpi/display_sizes" -#define OPT_TRACING_FORMAT "tracing/smpi/format" -#define OPT_TRACING_FORMAT_TI_ONEFILE "tracing/smpi/format/ti_one_file" -#define OPT_TRACING_CATEGORIZED "tracing/categorized" -#define OPT_TRACING_UNCATEGORIZED "tracing/uncategorized" -#define OPT_TRACING_MSG_PROCESS "tracing/msg/process" -#define OPT_TRACING_MSG_VM "tracing/msg/vm" -#define OPT_TRACING_FILENAME "tracing/filename" -#define OPT_TRACING_BUFFER "tracing/buffer" -#define OPT_TRACING_ONELINK_ONLY "tracing/onelink_only" -#define OPT_TRACING_DISABLE_DESTROY "tracing/disable_destroy" -#define OPT_TRACING_BASIC "tracing/basic" -#define OPT_TRACING_COMMENT "tracing/comment" -#define OPT_TRACING_COMMENT_FILE "tracing/comment_file" -#define OPT_VIVA_UNCAT_CONF "viva/uncategorized" -#define OPT_VIVA_CAT_CONF "viva/categorized" -#define OPT_TRACING_DISABLE_LINK "tracing/disable_link" -#define OPT_TRACING_DISABLE_POWER "tracing/disable_power" -#define OPT_TRACING_PRECISION "tracing/precision" +#define OPT_TRACING_BASIC "tracing/basic" +#define OPT_TRACING_BUFFER "tracing/buffer" +#define OPT_TRACING_CATEGORIZED "tracing/categorized" +#define OPT_TRACING_COMMENT_FILE "tracing/comment_file" +#define OPT_TRACING_COMMENT "tracing/comment" +#define OPT_TRACING_DISABLE_DESTROY "tracing/disable_destroy" +#define OPT_TRACING_DISABLE_LINK "tracing/disable_link" +#define OPT_TRACING_DISABLE_POWER "tracing/disable_power" +#define OPT_TRACING_DISPLAY_SIZES "tracing/smpi/display_sizes" +#define OPT_TRACING_FILENAME "tracing/filename" +#define OPT_TRACING_FORMAT_TI_ONEFILE "tracing/smpi/format/ti_one_file" +#define OPT_TRACING_FORMAT "tracing/smpi/format" +#define OPT_TRACING_MSG_PROCESS "tracing/msg/process" +#define OPT_TRACING_MSG_VM "tracing/msg/vm" +#define OPT_TRACING_ONELINK_ONLY "tracing/onelink_only" +#define OPT_TRACING_PLATFORM "tracing/platform" +#define OPT_TRACING_PRECISION "tracing/precision" +#define OPT_TRACING_SMPI_COMPUTING "tracing/smpi/computing" +#define OPT_TRACING_SMPI_GROUP "tracing/smpi/group" +#define OPT_TRACING_SMPI_INTERNALS "tracing/smpi/internals" +#define OPT_TRACING_SMPI_SLEEPING "tracing/smpi/sleeping" +#define OPT_TRACING_SMPI "tracing/smpi" +#define OPT_TRACING_TOPOLOGY "tracing/platform/topology" +#define OPT_TRACING "tracing" +#define OPT_TRACING_UNCATEGORIZED "tracing/uncategorized" +#define OPT_VIVA_CAT_CONF "viva/categorized" +#define OPT_VIVA_UNCAT_CONF "viva/uncategorized" static int trace_enabled = 0; static int trace_platform; diff --git a/src/instr/jedule/jedule_events.c b/src/instr/jedule/jedule_events.cpp similarity index 100% rename from src/instr/jedule/jedule_events.c rename to src/instr/jedule/jedule_events.cpp diff --git a/src/instr/jedule/jedule_output.c b/src/instr/jedule/jedule_output.cpp similarity index 99% rename from src/instr/jedule/jedule_output.c rename to src/instr/jedule/jedule_output.cpp index b8195cd20f..1bac445f37 100644 --- a/src/instr/jedule/jedule_output.c +++ b/src/instr/jedule/jedule_output.cpp @@ -78,7 +78,7 @@ static void get_hierarchy_string(jed_simgrid_container_t container, xbt_dynar_t hier_list; unsigned int iter; int number; - int length; + unsigned int length; outbuf[0] = '\0'; hier_list = xbt_dynar_new(sizeof(int), NULL); @@ -127,7 +127,7 @@ static void print_container(jed_simgrid_container_t container) { } static void print_resources(jed_simgrid_container_t resource_parent) { - int res_nb; + unsigned int res_nb; unsigned int i; char *res_name; char resid[1024]; diff --git a/src/instr/jedule/jedule_platform.c b/src/instr/jedule/jedule_platform.cpp similarity index 93% rename from src/instr/jedule/jedule_platform.c rename to src/instr/jedule/jedule_platform.cpp index 08fd7e73a8..312b06fa1e 100644 --- a/src/instr/jedule/jedule_platform.c +++ b/src/instr/jedule/jedule_platform.cpp @@ -153,8 +153,8 @@ static void add_subsets_to(xbt_dynar_t subset_list, xbt_dynar_t hostgroup, xbt_dynar_foreach(hostgroup, iter, host_name) { jed_simgrid_container_t parent; xbt_assert( host_name != NULL ); - parent = xbt_dict_get(host2_simgrid_parent_container, host_name); - id_str = xbt_dict_get(parent->name2id, host_name); + parent = (jed_simgrid_container_t)xbt_dict_get(host2_simgrid_parent_container, host_name); + id_str = (char*)xbt_dict_get(parent->name2id, host_name); xbt_dynar_push(id_list, &id_str); } @@ -215,15 +215,12 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, // group by parent container xbt_dynar_foreach(host_names, iter, host_name) { - jed_simgrid_container_t parent; - xbt_dynar_t hostgroup; - //printf("checking %s \n", host_name); - parent = xbt_dict_get(host2_simgrid_parent_container, host_name); + jed_simgrid_container_t parent = (jed_simgrid_container_t)xbt_dict_get(host2_simgrid_parent_container, host_name); xbt_assert( parent != NULL ); - hostgroup = xbt_dict_get_or_null (parent2hostgroup, parent->name); + xbt_dynar_t hostgroup = (xbt_dynar_t)xbt_dict_get_or_null (parent2hostgroup, parent->name); if( hostgroup == NULL ) { hostgroup = xbt_dynar_new(sizeof(char*), NULL); xbt_dict_set(parent2hostgroup, parent->name, hostgroup, NULL); @@ -239,7 +236,7 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, jed_simgrid_container_t parent; xbt_dict_foreach(parent2hostgroup,cursor,parent_name,hostgroup) { - parent = xbt_dict_get(container_name2container, parent_name); + parent = (jed_simgrid_container_t)xbt_dict_get(container_name2container, parent_name); // printf("subset parent >>> %s\n", parent->name); add_subsets_to(subset_list, hostgroup, parent); } diff --git a/src/instr/jedule/jedule_sd_binding.c b/src/instr/jedule/jedule_sd_binding.cpp similarity index 100% rename from src/instr/jedule/jedule_sd_binding.c rename to src/instr/jedule/jedule_sd_binding.cpp diff --git a/src/msg/msg_synchro.cpp b/src/msg/msg_synchro.cpp index 70f13837fc..6547de0507 100644 --- a/src/msg/msg_synchro.cpp +++ b/src/msg/msg_synchro.cpp @@ -54,7 +54,7 @@ void MSG_sem_get_capacity(msg_sem_t sem) { } void MSG_sem_destroy(msg_sem_t sem) { - simcall_sem_destroy(sem); + SIMIX_sem_destroy(sem); } /** @brief returns a boolean indicating if this semaphore would block at this very specific time * diff --git a/src/simdag/sd_dotloader.cpp b/src/simdag/sd_dotloader.cpp index 9333294531..352125e392 100644 --- a/src/simdag/sd_dotloader.cpp +++ b/src/simdag/sd_dotloader.cpp @@ -6,11 +6,9 @@ #include "src/simdag/simdag_private.h" #include "simgrid/simdag.h" -#include "xbt/misc.h" #include "xbt/log.h" #include #include -#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_dotparse, sd, "Parsing DOT files"); @@ -21,8 +19,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_dotparse, sd, "Parsing DOT files"); #elif HAVE_AGRAPH_H #include #define agnxtnode(dot, node) agnxtnode(node) -#define agfstin(dot, node) agfstin(node) -#define agnxtin(dot, edge) agnxtin(edge) #define agfstout(dot, node) agfstout(node) #define agnxtout(dot, edge) agnxtout(edge) #endif @@ -32,97 +28,31 @@ typedef enum { parallel } seq_par_t; -xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par); +xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par, bool schedule); -static xbt_dynar_t result; -static xbt_dict_t jobs; -static xbt_dict_t computers; -static Agraph_t *dag_dot; -static bool schedule = true; static void dot_task_p_free(void *task) { - SD_task_t *t = (SD_task_t *)task; - SD_task_destroy(*t); + SD_task_destroy(*(SD_task_t *)task); } /** @brief loads a DOT file describing a DAG * - * See http://www.graphviz.org/doc/info/lang.html - * for more details. - * To obtain information about transfers and tasks, two attributes are - * required : size on task (execution time in Flop) and size on edge - * (the amount of data transfer in bit). - * if they aren't here, there choose to be equal to zero. + * See http://www.graphviz.org/doc/info/lang.html for more details. + * The size attribute of a node describes: + * - for a compute task: the amount of flops to execute + * - for a communication task : the amount of bytes to transfer + * If this attribute is ommited, the default value is zero. */ xbt_dynar_t SD_dotload(const char *filename) { - computers = xbt_dict_new_homogeneous(NULL); - schedule = false; - SD_dotload_generic(filename, sequential); - xbt_dynar_t computer = NULL; - xbt_dict_cursor_t dict_cursor; - char *computer_name; - xbt_dict_foreach(computers,dict_cursor,computer_name,computer){ - xbt_dynar_free(&computer); - } - xbt_dict_free(&computers); - return result; + return SD_dotload_generic(filename, sequential, false); } -xbt_dynar_t SD_dotload_with_sched(const char *filename) { - computers = xbt_dict_new_homogeneous(NULL); - SD_dotload_generic(filename, sequential); - - if(schedule){ - xbt_dynar_t computer = NULL; - xbt_dict_cursor_t dict_cursor; - char *computer_name; - const sg_host_t *workstations = sg_host_list (); - xbt_dict_foreach(computers,dict_cursor,computer_name,computer){ - int count_computer = atoi(computer_name); - unsigned int count=0; - SD_task_t task; - SD_task_t task_previous = NULL; - xbt_dynar_foreach(computer,count,task){ - /* add dependency between the previous and the task to avoid - * parallel execution */ - if(task != NULL ){ - if(task_previous != NULL && - !SD_task_dependency_exists(task_previous, task)) - SD_task_dependency_add(NULL, NULL, task_previous, task); - SD_task_schedulel(task, 1, workstations[count_computer]); - task_previous = task; - } - } - xbt_dynar_free(&computer); - } - xbt_dict_free(&computers); - if(acyclic_graph_detail(result)) - return result; - else - XBT_WARN("There is at least one cycle in the provided task graph"); - }else{ - XBT_WARN("The scheduling is ignored"); - } - xbt_dynar_t computer = NULL; - xbt_dict_cursor_t dict_cursor; - char *computer_name; - xbt_dict_foreach(computers,dict_cursor,computer_name,computer){ - xbt_dynar_free(&computer); - } - xbt_dict_free(&computers); - xbt_dynar_free(&result); - return NULL; +xbt_dynar_t SD_PTG_dotload(const char * filename) { + return SD_dotload_generic(filename, parallel, false); } -xbt_dynar_t SD_PTG_dotload(const char * filename) { - xbt_dynar_t result = SD_dotload_generic(filename, parallel); - if (!acyclic_graph_detail(result)) { - XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", - basename((char*)filename)); - xbt_dynar_free(&result); - /* (result == NULL) here */ - } - return result; +xbt_dynar_t SD_dotload_with_sched(const char *filename) { + return SD_dotload_generic(filename, sequential, true); } #ifdef HAVE_CGRAPH_H @@ -134,55 +64,51 @@ static int edge_compare(const void *a, const void *b) } #endif -xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ +xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par, bool schedule){ xbt_assert(filename, "Unable to use a null file descriptor\n"); unsigned int i; - result = xbt_dynar_new(sizeof(SD_task_t), dot_task_p_free); - jobs = xbt_dict_new_homogeneous(NULL); + SD_task_t root, end, task; + xbt_dict_t computers; + xbt_dynar_t computer = NULL; + char *computer_name; + xbt_dict_cursor_t dict_cursor; + bool schedule_success = true; + + xbt_dynar_t result = xbt_dynar_new(sizeof(SD_task_t), dot_task_p_free); + xbt_dict_t jobs = xbt_dict_new_homogeneous(NULL); + FILE *in_file = fopen(filename, "r"); if (in_file == NULL) xbt_die("Failed to open file: %s", filename); - dag_dot = agread(in_file, NIL(Agdisc_t *)); - SD_task_t root, end, task; - /* - * Create all the nodes - */ + + Agraph_t * dag_dot = agread(in_file, NIL(Agdisc_t *)); + + if (schedule) + computers = xbt_dict_new_homogeneous(NULL); + + /* Create all the nodes */ Agnode_t *node = NULL; for (node = agfstnode(dag_dot); node; node = agnxtnode(dag_dot, node)) { - char *name = agnameof(node); double amount = atof(agget(node, (char *) "size")); double alpha = 0.0; - if (seq_or_par == sequential){ - XBT_DEBUG("See ", name, amount); - } else { - if (!strcmp(agget(node, (char *) "alpha"), "")){ - alpha = atof(agget(node, (char *) "alpha")); - if (alpha == -1.){ - XBT_DEBUG("negative alpha value provided. Set to 0."); - alpha = 0.0 ; - } - } else { - XBT_DEBUG("no alpha value provided. Set to 0"); - alpha = 0.0 ; - } - - XBT_DEBUG("See ", - name, amount, alpha); - } - if (!(task = (SD_task_t)xbt_dict_get_or_null(jobs, name))) { if (seq_or_par == sequential){ + XBT_DEBUG("See ", name, amount); task = SD_task_create_comp_seq(name, NULL , amount); } else { + alpha = atof(agget(node, (char *) "alpha")); + XBT_DEBUG("See ", name, amount, alpha); task = SD_task_create_comp_par_amdahl(name, NULL , amount, alpha); } + xbt_dict_set(jobs, name, task, NULL); + if (!strcmp(name, "root")){ - /* by design the root task is always SCHEDULABLE */ - SD_task_set_state(task, SD_SCHEDULABLE); - /* Put it at the beginning of the dynar */ + /* by design the root task is always SCHEDULABLE */ + SD_task_set_state(task, SD_SCHEDULABLE); + /* Put it at the beginning of the dynar */ xbt_dynar_insert_at(result, 0, &task); } else { if (!strcmp(name, "end")){ @@ -195,21 +121,17 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ } if((seq_or_par == sequential) && - (schedule || - XBT_LOG_ISENABLED(sd_dotparse, xbt_log_priority_verbose))){ - /* try to take the information to schedule the task only if all is - * right*/ + ((schedule && schedule_success) || XBT_LOG_ISENABLED(sd_dotparse, xbt_log_priority_verbose))){ + /* try to take the information to schedule the task only if all is right*/ int performer, order; char *char_performer = agget(node, (char *) "performer"); char *char_order = agget(node, (char *) "order"); /* performer is the computer which execute the task */ - performer = - ((!char_performer || !strcmp(char_performer,"")) ? -1:atoi(char_performer)); + performer = ((!char_performer || !strcmp(char_performer,"")) ? -1:atoi(char_performer)); /* order is giving the task order on one computer */ order = ((!char_order || !strcmp(char_order, ""))? -1:atoi(char_order)); - XBT_DEBUG ("Task '%s' is scheduled on workstation '%d' in position '%d'", - task->name, performer, order); + XBT_DEBUG ("Task '%s' is scheduled on workstation '%d' in position '%d'", task->name, performer, order); xbt_dynar_t computer = NULL; if(performer != -1 && order != -1){ /* required parameters are given */ @@ -225,10 +147,9 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ task_test = (SD_task_t *)xbt_dynar_get_ptr(computer,order); if(task_test != NULL && *task_test != NULL && *task_test != task){ /* the user gives the same order to several tasks */ - schedule = false; + schedule_success = false; XBT_VERB("The task %s starts on the computer %s at the position : %s like the task %s", - (*task_test)->name, char_performer, char_order, - task->name); + (*task_test)->name, char_performer, char_order, task->name); }else{ /* the parameter seems to be ok */ xbt_dynar_set_as(computer, order, SD_task_t, task); @@ -236,15 +157,14 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ }else{ /* the platform has not enough processors to schedule the DAG like * the user wants*/ - schedule = false; + schedule_success = false; XBT_VERB("The schedule is ignored, there are not enough computers"); } } else { /* one of required parameters is not given */ - schedule = false; - XBT_VERB("The schedule is ignored, the task %s is not correctly scheduled", - task->name); + schedule_success = false; + XBT_VERB("The schedule is ignored, the task %s is not correctly scheduled", task->name); } } } else { @@ -252,10 +172,7 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ } } - /* - * Check if 'root' and 'end' nodes have been explicitly declared. - * If not, create them. - */ + /*Check if 'root' and 'end' nodes have been explicitly declared. If not, create them. */ if (!(root = (SD_task_t)xbt_dict_get_or_null(jobs, "root"))){ if (seq_or_par == sequential) root = SD_task_create_comp_seq("root", NULL, 0); @@ -264,7 +181,7 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ /* by design the root task is always SCHEDULABLE */ SD_task_set_state(root, SD_SCHEDULABLE); /* Put it at the beginning of the dynar */ - xbt_dynar_insert_at(result, 0, &root); + xbt_dynar_insert_at(result, 0, &root); } if (!(end = (SD_task_t)xbt_dict_get_or_null(jobs, "end"))){ @@ -272,12 +189,9 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ end = SD_task_create_comp_seq("end", NULL, 0); else end = SD_task_create_comp_par_amdahl("end", NULL, 0, 0); - /* Should be inserted later in the dynar */ } - /* - * Create edges - */ + /* Create edges */ xbt_dynar_t edges = xbt_dynar_new(sizeof(Agedge_t*), NULL); for (node = agfstnode(dag_dot); node; node = agnxtnode(dag_dot, node)) { unsigned cursor; @@ -286,10 +200,9 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ for (edge = agfstout(dag_dot, node); edge; edge = agnxtout(dag_dot, edge)) xbt_dynar_push_as(edges, Agedge_t *, edge); #ifdef HAVE_CGRAPH_H - /* Hack: circumvent a bug in libcgraph, where the edges are not always given - * back in creation order. We sort them again, according to their sequence - * id. The problem appears to be solved (i.e.: I did not test it) in - * graphviz' mercurial repository by the following changeset: + /* Hack: circumvent a bug in libcgraph, where the edges are not always given back in creation order. We sort them + * again, according to their sequence id. The problem appears to be solved (i.e.: I did not test it) in graphviz' + * mercurial repository by the following changeset: * changeset: 8431:d5f1fb7e8103 * user: Emden Gansner * date: Tue Oct 11 12:38:58 2011 -0400 @@ -331,25 +244,21 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ } xbt_dynar_free(&edges); - /* all compute and transfer tasks have been created, put the "end" node at - * the end of dynar - */ - XBT_DEBUG("All tasks have been created, put %s at the end of the dynar", - end->name); + /* all compute and transfer tasks have been created, put the "end" node at the end of dynar */ + XBT_DEBUG("All tasks have been created, put %s at the end of the dynar", end->name); xbt_dynar_push(result, &end); /* Connect entry tasks to 'root', and exit tasks to 'end'*/ - xbt_dynar_foreach (result, i, task){ if (task == root || task == end) continue; if (xbt_dynar_is_empty(task->tasks_before)) { - XBT_DEBUG("file '%s' has no source. Add dependency from 'root'", - task->name); + XBT_DEBUG("file '%s' has no source. Add dependency from 'root'", task->name); SD_task_dependency_add(NULL, NULL, root, task); - } else if (xbt_dynar_is_empty(task->tasks_after)) { - XBT_DEBUG("file '%s' has no destination. Add dependency to 'end'", - task->name); + } + + if (xbt_dynar_is_empty(task->tasks_after)) { + XBT_DEBUG("file '%s' has no destination. Add dependency to 'end'", task->name); SD_task_dependency_add(NULL, NULL, task, end); } } @@ -358,11 +267,43 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par){ xbt_dict_free(&jobs); fclose(in_file); + if(schedule){ + if (schedule_success) { + const sg_host_t *workstations = sg_host_list (); + xbt_dict_foreach(computers,dict_cursor,computer_name,computer){ + int count_computer = atoi(computer_name); + unsigned int count=0; + SD_task_t task; + SD_task_t task_previous = NULL; + xbt_dynar_foreach(computer,count,task){ + /* add dependency between the previous and the task to avoid parallel execution */ + if(task != NULL ){ + if(task_previous != NULL && !SD_task_dependency_exists(task_previous, task)) + SD_task_dependency_add(NULL, NULL, task_previous, task); + + SD_task_schedulel(task, 1, workstations[count_computer]); + task_previous = task; + } + } + xbt_dynar_free(&computer); + } + xbt_dict_free(&computers); + } else { + XBT_WARN("The scheduling is ignored"); + xbt_dict_foreach(computers,dict_cursor,computer_name,computer){ + xbt_dynar_free(&computer); + } + + xbt_dict_free(&computers); + xbt_dynar_free(&result); + result = NULL; + } + } + if (!acyclic_graph_detail(result)) { - XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", - basename((char*)filename)); + XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", basename((char*)filename)); xbt_dynar_free(&result); - /* (result == NULL) here */ + result = NULL; } return result; } diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 94def06371..031e452ce5 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -61,15 +61,15 @@ sg_host_t sg_host_by_name_or_create(const char *name) xbt_dynar_t sg_hosts_as_dynar(void) { - xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),NULL); + xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),NULL); xbt_dict_cursor_t cursor = nullptr; const char* name = nullptr; simgrid::s4u::Host* host = nullptr; - xbt_dict_foreach(host_list, cursor, name, host) - if(routing_get_network_element_type(name) == SURF_NETWORK_ELEMENT_HOST) - xbt_dynar_push(res, &host); - return res; + xbt_dict_foreach(host_list, cursor, name, host) + if(routing_get_network_element_type(name) == SURF_NETWORK_ELEMENT_HOST) + xbt_dynar_push(res, &host); + return res; } // ========= Layering madness ==============* diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 760acb6994..8adf5cecab 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -711,11 +711,11 @@ void sg_config_init(int *argc, char **argv) sprintf(description, "Context factory to use in SIMIX. Possible values: %s", dflt_ctx_fact); -#ifdef CONTEXT_UCONTEXT +#ifdef HAVE_UCONTEXT_CONTEXTS dflt_ctx_fact = "ucontext"; p += sprintf(p, ", %s", dflt_ctx_fact); #endif -#ifdef HAVE_RAWCTX +#ifdef HAVE_RAW_CONTEXTS dflt_ctx_fact = "raw"; p += sprintf(p, ", %s", dflt_ctx_fact); #endif @@ -836,10 +836,10 @@ void sg_config_init(int *argc, char **argv) xbt_cfgelm_int, 1, 1, NULL, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/async_small_thresh", 0); - xbt_cfg_register(&_sg_cfg_set, "smpi/send_is_detached_thres", + xbt_cfg_register(&_sg_cfg_set, "smpi/send_is_detached_thresh", "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend", xbt_cfgelm_int, 1, 1, NULL, NULL); - xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/send_is_detached_thres", 65536); + xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/send_is_detached_thresh", 65536); xbt_cfg_register(&_sg_cfg_set, "smpi/privatize_global_variables", "Boolean indicating whether we should privatize global variable at runtime.", diff --git a/src/simix/BoostContext.cpp b/src/simix/BoostContext.cpp index debd695383..3b4e63f94b 100644 --- a/src/simix/BoostContext.cpp +++ b/src/simix/BoostContext.cpp @@ -38,7 +38,7 @@ public: void resume(); }; -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS class BoostParallelContext : public BoostContext { public: BoostParallelContext(std::function code, @@ -66,7 +66,7 @@ BoostContextFactory::BoostContextFactory() { BoostContext::parallel_ = SIMIX_context_is_parallel(); if (BoostContext::parallel_) { -#ifndef CONTEXT_THREADS +#ifndef HAVE_THREAD_CONTEXTS xbt_die("No thread support for parallel context execution"); #else int nthreads = SIMIX_context_get_nthreads(); @@ -81,7 +81,7 @@ BoostContextFactory::BoostContextFactory() BoostContextFactory::~BoostContextFactory() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS if (BoostContext::parmap_) { xbt_parmap_destroy(BoostContext::parmap_); BoostContext::parmap_ = nullptr; @@ -95,7 +95,7 @@ smx_context_t BoostContextFactory::create_context(std::function code, { BoostContext* context = nullptr; if (BoostContext::parallel_) -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS context = this->new_context( std::move(code), cleanup_func, process); #else @@ -109,7 +109,7 @@ smx_context_t BoostContextFactory::create_context(std::function code, void BoostContextFactory::run_all() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS if (BoostContext::parallel_) { BoostContext::threads_working_ = 0; xbt_parmap_apply(BoostContext::parmap_, @@ -161,7 +161,7 @@ BoostContext::BoostContext(std::function code, smx_context_usable_stack_size, smx_ctx_boost_wrapper); } else { - #if HAVE_BOOST_CONTEXT == 1 + #if HAVE_BOOST_CONTEXTS == 1 this->fc_ = new boost::context::fcontext_t(); #endif if (BoostContext::maestro_context_ == nullptr) @@ -171,7 +171,7 @@ BoostContext::BoostContext(std::function code, BoostContext::~BoostContext() { -#if HAVE_BOOST_CONTEXT == 1 +#if HAVE_BOOST_CONTEXTS == 1 if (!this->stack_) delete this->fc_; #endif @@ -185,7 +185,7 @@ BoostContext::~BoostContext() void BoostContext::resume() { SIMIX_context_set_current(this); -#if HAVE_BOOST_CONTEXT == 1 +#if HAVE_BOOST_CONTEXTS == 1 boost::context::jump_fcontext( maestro_context_->fc_, this->fc_, (intptr_t) this); @@ -215,7 +215,7 @@ void BoostSerialContext::suspend() maestro_context_); } SIMIX_context_set_current((smx_context_t) next_context); - #if HAVE_BOOST_CONTEXT == 1 + #if HAVE_BOOST_CONTEXTS == 1 boost::context::jump_fcontext( this->fc_, next_context->fc_, (intptr_t) next_context); #else @@ -232,7 +232,7 @@ void BoostSerialContext::stop() // BoostParallelContext -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS void BoostParallelContext::suspend() { @@ -252,7 +252,7 @@ void BoostParallelContext::suspend() } SIMIX_context_set_current((smx_context_t) next_context); -#if HAVE_BOOST_CONTEXT == 1 +#if HAVE_BOOST_CONTEXTS == 1 boost::context::jump_fcontext( this->fc_, next_context->fc_, (intptr_t)next_context); #else @@ -277,7 +277,7 @@ void BoostParallelContext::resume() workers_context_[worker_id] = worker_context; SIMIX_context_set_current(this); -#if HAVE_BOOST_CONTEXT == 1 +#if HAVE_BOOST_CONTEXTS == 1 boost::context::jump_fcontext( worker_context->fc_, this->fc_, (intptr_t) this); #else diff --git a/src/simix/BoostContext.hpp b/src/simix/BoostContext.hpp index c2df0d11d5..62b6066b57 100644 --- a/src/simix/BoostContext.hpp +++ b/src/simix/BoostContext.hpp @@ -36,7 +36,7 @@ protected: // static static unsigned long process_index_; static BoostContext* maestro_context_; protected: -#if HAVE_BOOST_CONTEXT == 1 +#if HAVE_BOOST_CONTEXTS == 1 boost::context::fcontext_t* fc_ = nullptr; #else boost::context::fcontext_t fc_; diff --git a/src/simix/RawContext.cpp b/src/simix/RawContext.cpp index 98c07e84d9..9cbb2df74d 100644 --- a/src/simix/RawContext.cpp +++ b/src/simix/RawContext.cpp @@ -82,7 +82,7 @@ ContextFactory* raw_factory() // ***** Loads of static stuff -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS static xbt_parmap_t raw_parmap; static simgrid::simix::RawContext** raw_workers_context; /* space to save the worker context in each thread */ static unsigned long raw_threads_working; /* number of threads that have started their work */ @@ -128,7 +128,7 @@ __asm__ ( ".text\n" ".globl _raw_makecontext\n" "_raw_makecontext:\n" -#elif defined(_WIN32) +#elif defined(_XBT_WIN32) ".text\n" ".globl raw_makecontext\n" "raw_makecontext:\n" @@ -164,7 +164,7 @@ __asm__ ( ".text\n" ".globl _raw_swapcontext\n" "_raw_swapcontext:\n" -#elif defined(_WIN32) +#elif defined(_XBT_WIN32) ".text\n" ".globl raw_swapcontext\n" "raw_swapcontext:\n" @@ -204,7 +204,7 @@ __asm__ ( ); #elif PROCESSOR_i686 __asm__ ( -#if defined(APPLE) || defined(_WIN32) +#if defined(APPLE) || defined(_XBT_WIN32) ".text\n" ".globl _raw_makecontext\n" "_raw_makecontext:\n" @@ -231,7 +231,7 @@ __asm__ ( ); __asm__ ( -#if defined(APPLE) || defined(_WIN32) +#if defined(APPLE) || defined(_XBT_WIN32) ".text\n" ".globl _raw_swapcontext\n" "_raw_swapcontext:\n" @@ -259,7 +259,7 @@ __asm__ ( /* If you implement raw contexts for other processors, don't forget to - update the definition of HAVE_RAWCTX in tools/cmake/CompleteInFiles.cmake */ + update the definition of HAVE_RAW_CONTEXTS in tools/cmake/CompleteInFiles.cmake */ raw_stack_t raw_makecontext(void* malloced_stack, int stack_size, rawctx_entry_point_t entry_point, void* arg) { @@ -285,7 +285,7 @@ RawContextFactory::RawContextFactory() #endif raw_context_parallel = SIMIX_context_is_parallel(); if (raw_context_parallel) { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS int nthreads = SIMIX_context_get_nthreads(); xbt_os_thread_key_create(&raw_worker_id_key); // TODO, lazily init @@ -304,7 +304,7 @@ RawContextFactory::RawContextFactory() RawContextFactory::~RawContextFactory() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS if (raw_parmap) xbt_parmap_destroy(raw_parmap); xbt_free(raw_workers_context); @@ -379,7 +379,7 @@ void RawContextFactory::run_all_serial() void RawContextFactory::run_all_parallel() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS raw_threads_working = 0; if (raw_parmap == nullptr) raw_parmap = xbt_parmap_new( @@ -427,7 +427,7 @@ void RawContext::suspend_serial() void RawContext::suspend_parallel() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS /* determine the next context */ smx_process_t next_work = (smx_process_t) xbt_parmap_next(raw_parmap); RawContext* next_context = nullptr; @@ -468,7 +468,7 @@ void RawContext::resume_serial() void RawContext::resume_parallel() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS unsigned long worker_id = __sync_fetch_and_add(&raw_threads_working, 1); xbt_os_thread_set_specific(raw_worker_id_key, (void*)(uintptr_t) worker_id); RawContext* worker_context = (RawContext*) SIMIX_context_self(); diff --git a/src/simix/UContext.cpp b/src/simix/UContext.cpp index 5b793c5883..33532bb647 100644 --- a/src/simix/UContext.cpp +++ b/src/simix/UContext.cpp @@ -65,7 +65,7 @@ namespace simix { } } -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS static xbt_parmap_t sysv_parmap; static simgrid::simix::ParallelUContext** sysv_workers_context; /* space to save the worker's context in each thread */ static unsigned long sysv_threads_working; /* number of threads that have started their work */ @@ -137,7 +137,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory") { if (SIMIX_context_is_parallel()) { sysv_parallel = true; -#ifdef CONTEXT_THREADS /* To use parallel ucontexts a thread pool is needed */ +#ifdef HAVE_THREAD_CONTEXTS /* To use parallel ucontexts a thread pool is needed */ int nthreads = SIMIX_context_get_nthreads(); sysv_parmap = nullptr; sysv_workers_context = xbt_new(ParallelUContext*, nthreads); @@ -153,7 +153,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory") UContextFactory::~UContextFactory() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS if (sysv_parmap) xbt_parmap_destroy(sysv_parmap); xbt_free(sysv_workers_context); @@ -167,7 +167,7 @@ UContextFactory::~UContextFactory() void UContextFactory::run_all() { if (sysv_parallel) { - #ifdef CONTEXT_THREADS + #ifdef HAVE_THREAD_CONTEXTS sysv_threads_working = 0; // Parmap_apply ensures that every working thread get an index in the // process_to_run array (through an atomic fetch_and_add), @@ -306,7 +306,7 @@ void ParallelUContext::stop() /** Run one particular simulated process on the current thread. */ void ParallelUContext::resume() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS // What is my containing body? unsigned long worker_id = __sync_fetch_and_add(&sysv_threads_working, 1); // Store the number of my containing body in os-thread-specific area : @@ -347,7 +347,7 @@ void ParallelUContext::resume() */ void ParallelUContext::suspend() { -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS /* determine the next context */ // Get the next soul to embody now: smx_process_t next_work = (smx_process_t) xbt_parmap_next(sysv_parmap); diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index baa00625bf..901f49fff8 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -1031,15 +1031,6 @@ smx_mutex_t simcall_mutex_init(void) return simcall_BODY_mutex_init(); } -/** - * \ingroup simix_synchro_management - * - */ -void simcall_mutex_destroy(smx_mutex_t mutex) -{ - simcall_BODY_mutex_destroy(mutex); -} - /** * \ingroup simix_synchro_management * @@ -1076,15 +1067,6 @@ smx_cond_t simcall_cond_init(void) return simcall_BODY_cond_init(); } -/** - * \ingroup simix_synchro_management - * - */ -void simcall_cond_destroy(smx_cond_t cond) -{ - simcall_BODY_cond_destroy(cond); -} - /** * \ingroup simix_synchro_management * @@ -1133,15 +1115,6 @@ smx_sem_t simcall_sem_init(int capacity) return simcall_BODY_sem_init(capacity); } -/** - * \ingroup simix_synchro_management - * - */ -void simcall_sem_destroy(smx_sem_t sem) -{ - simcall_BODY_sem_destroy(sem); -} - /** * \ingroup simix_synchro_management * diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 981ded3bd8..cdd7775335 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -941,13 +941,6 @@ static inline void simcall_mutex_init__set__result(smx_simcall_t simcall, void* simcall->result.dp = result; } -static inline smx_mutex_t simcall_mutex_destroy__get__mutex(smx_simcall_t simcall) { - return (smx_mutex_t) simcall->args[0].dp; -} -static inline void simcall_mutex_destroy__set__mutex(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} - static inline smx_mutex_t simcall_mutex_lock__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[0].dp; } @@ -982,13 +975,6 @@ static inline void simcall_cond_init__set__result(smx_simcall_t simcall, void* r simcall->result.dp = result; } -static inline smx_cond_t simcall_cond_destroy__get__cond(smx_simcall_t simcall) { - return (smx_cond_t) simcall->args[0].dp; -} -static inline void simcall_cond_destroy__set__cond(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} - static inline smx_cond_t simcall_cond_signal__get__cond(smx_simcall_t simcall) { return (smx_cond_t) simcall->args[0].dp; } @@ -1048,13 +1034,6 @@ static inline void simcall_sem_init__set__result(smx_simcall_t simcall, void* re simcall->result.dp = result; } -static inline smx_sem_t simcall_sem_destroy__get__sem(smx_simcall_t simcall) { - return (smx_sem_t) simcall->args[0].dp; -} -static inline void simcall_sem_destroy__set__sem(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} - static inline smx_sem_t simcall_sem_release__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index b6c206aa53..8f7a88037f 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -1158,27 +1158,6 @@ inline static smx_mutex_t simcall_BODY_mutex_init() { return (smx_mutex_t) self->simcall.result.dp; } -inline static void simcall_BODY_mutex_destroy(smx_mutex_t mutex) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_mutex_destroy(mutex); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_MUTEX_DESTROY; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) mutex; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex) { smx_process_t self = SIMIX_process_self(); @@ -1263,27 +1242,6 @@ inline static smx_cond_t simcall_BODY_cond_init() { return (smx_cond_t) self->simcall.result.dp; } -inline static void simcall_BODY_cond_destroy(smx_cond_t cond) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_cond_destroy(cond); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_COND_DESTROY; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) cond; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - inline static void simcall_BODY_cond_signal(smx_cond_t cond) { smx_process_t self = SIMIX_process_self(); @@ -1392,27 +1350,6 @@ inline static smx_sem_t simcall_BODY_sem_init(unsigned int capacity) { return (smx_sem_t) self->simcall.result.dp; } -inline static void simcall_BODY_sem_destroy(smx_sem_t sem) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_sem_destroy(sem); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_SEM_DESTROY; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) sem; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - inline static void simcall_BODY_sem_release(smx_sem_t sem) { smx_process_t self = SIMIX_process_self(); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 9c0b346bcc..a523f45b11 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -69,18 +69,15 @@ typedef enum { SIMCALL_COMM_GET_SRC_PROC, SIMCALL_COMM_GET_DST_PROC, SIMCALL_MUTEX_INIT, - SIMCALL_MUTEX_DESTROY, SIMCALL_MUTEX_LOCK, SIMCALL_MUTEX_TRYLOCK, SIMCALL_MUTEX_UNLOCK, SIMCALL_COND_INIT, - SIMCALL_COND_DESTROY, SIMCALL_COND_SIGNAL, SIMCALL_COND_WAIT, SIMCALL_COND_WAIT_TIMEOUT, SIMCALL_COND_BROADCAST, SIMCALL_SEM_INIT, - SIMCALL_SEM_DESTROY, SIMCALL_SEM_RELEASE, SIMCALL_SEM_WOULD_BLOCK, SIMCALL_SEM_ACQUIRE, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 9b9b802fd5..418256ce99 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -74,18 +74,15 @@ const char* simcall_names[] = { "SIMCALL_COMM_GET_SRC_PROC", "SIMCALL_COMM_GET_DST_PROC", "SIMCALL_MUTEX_INIT", - "SIMCALL_MUTEX_DESTROY", "SIMCALL_MUTEX_LOCK", "SIMCALL_MUTEX_TRYLOCK", "SIMCALL_MUTEX_UNLOCK", "SIMCALL_COND_INIT", - "SIMCALL_COND_DESTROY", "SIMCALL_COND_SIGNAL", "SIMCALL_COND_WAIT", "SIMCALL_COND_WAIT_TIMEOUT", "SIMCALL_COND_BROADCAST", "SIMCALL_SEM_INIT", - "SIMCALL_SEM_DESTROY", "SIMCALL_SEM_RELEASE", "SIMCALL_SEM_WOULD_BLOCK", "SIMCALL_SEM_ACQUIRE", @@ -375,11 +372,6 @@ case SIMCALL_MUTEX_INIT: SIMIX_simcall_answer(simcall); break; -case SIMCALL_MUTEX_DESTROY: - SIMIX_mutex_destroy((smx_mutex_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_MUTEX_LOCK: simcall_HANDLER_mutex_lock(simcall , (smx_mutex_t) simcall->args[0].dp); break; @@ -399,11 +391,6 @@ case SIMCALL_COND_INIT: SIMIX_simcall_answer(simcall); break; -case SIMCALL_COND_DESTROY: - SIMIX_cond_destroy((smx_cond_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_COND_SIGNAL: SIMIX_cond_signal((smx_cond_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); @@ -427,11 +414,6 @@ case SIMCALL_SEM_INIT: SIMIX_simcall_answer(simcall); break; -case SIMCALL_SEM_DESTROY: - SIMIX_sem_destroy((smx_sem_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_SEM_RELEASE: simcall_HANDLER_sem_release(simcall , (smx_sem_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 60b8c72de7..43299df5f8 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -103,20 +103,17 @@ Func - comm_get_src_proc (void*, smx_process_t) (comm, void*, smx_synchro_t) Func - comm_get_dst_proc (void*, smx_process_t) (comm, void*, smx_synchro_t) Func H mutex_init (void*, smx_mutex_t) -Proc - mutex_destroy (void) (mutex, void*, smx_mutex_t) Blck H mutex_lock (void) (mutex, void*, smx_mutex_t) Func H mutex_trylock (int) (mutex, void*, smx_mutex_t) Proc H mutex_unlock (void) (mutex, void*, smx_mutex_t) Func - cond_init (void*, smx_cond_t) -Proc - cond_destroy (void) (cond, void*, smx_cond_t) Proc - cond_signal (void) (cond, void*, smx_cond_t) Blck H cond_wait (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) Blck H cond_wait_timeout (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) (timeout, double) Proc - cond_broadcast (void) (cond, void*, smx_cond_t) Func - sem_init (void*, smx_sem_t) (capacity, unsigned int) -Proc - sem_destroy (void) (sem, void*, smx_sem_t) Proc H sem_release (void) (sem, void*, smx_sem_t) Func H sem_would_block (int) (sem, void*, smx_sem_t) Blck H sem_acquire (void) (sem, void*, smx_sem_t) diff --git a/src/simix/smx_context.cpp b/src/simix/smx_context.cpp index 4a9c6ae478..a07051b7b9 100644 --- a/src/simix/smx_context.cpp +++ b/src/simix/smx_context.cpp @@ -17,7 +17,7 @@ #include "simgrid/modelchecker.h" -#ifdef _WIN32 +#ifdef _XBT_WIN32 #include #include #else @@ -56,7 +56,7 @@ static e_xbt_parmap_mode_t smx_parallel_synchronization_mode = XBT_PARMAP_DEFAUL */ void SIMIX_context_mod_init(void) { -#if defined(CONTEXT_THREADS) && !defined(HAVE_THREAD_LOCAL_STORAGE) +#if defined(HAVE_THREAD_CONTEXTS) && !defined(HAVE_THREAD_LOCAL_STORAGE) /* the __thread storage class is not available on this platform: * use getspecific/setspecific instead to store the current context in each thread */ xbt_os_thread_key_create(&smx_current_context_key); @@ -66,37 +66,37 @@ void SIMIX_context_mod_init(void) if (simgrid::simix::factory_initializer) simix_global->context_factory = simgrid::simix::factory_initializer(); else { /* use the factory specified by --cfg=contexts/factory:value */ -#if defined(CONTEXT_THREADS) +#if defined(HAVE_THREAD_CONTEXTS) if (!strcmp(smx_context_factory_name, "thread")) simix_global->context_factory = simgrid::simix::thread_factory(); #else if (0); #endif -#ifdef CONTEXT_UCONTEXT +#ifdef HAVE_UCONTEXT_CONTEXTS else if (!strcmp(smx_context_factory_name, "ucontext")) simix_global->context_factory = simgrid::simix::sysv_factory(); #endif -#ifdef HAVE_RAWCTX +#ifdef HAVE_RAW_CONTEXTS else if (!strcmp(smx_context_factory_name, "raw")) simix_global->context_factory = simgrid::simix::raw_factory(); #endif -#ifdef HAVE_BOOST_CONTEXT +#ifdef HAVE_BOOST_CONTEXTS else if (!strcmp(smx_context_factory_name, "boost")) simix_global->context_factory = simgrid::simix::boost_factory(); #endif else { XBT_ERROR("Invalid context factory specified. Valid factories on this machine:"); -#ifdef HAVE_RAWCTX +#ifdef HAVE_RAW_CONTEXTS XBT_ERROR(" raw: high performance context factory implemented specifically for SimGrid"); #else XBT_ERROR(" (raw contexts were disabled at compilation time on this machine -- check configure logs for details)"); #endif -#ifdef CONTEXT_UCONTEXT +#ifdef HAVE_UCONTEXT_CONTEXTS XBT_ERROR(" ucontext: classical system V contexts (implemented with makecontext, swapcontext and friends)"); #else XBT_ERROR(" (ucontext was disabled at compilation time on this machine -- check configure logs for details)"); #endif -#ifdef HAVE_BOOST_CONTEXT +#ifdef HAVE_BOOST_CONTEXTS XBT_ERROR(" boost: this uses the boost libraries context implementation"); #else XBT_ERROR(" (boost was disabled at compilation time on this machine -- check configure logs for details. Did you install the libboost-context-dev package?)"); @@ -238,7 +238,7 @@ void SIMIX_context_set_nthreads(int nb_threads) { } if (nb_threads > 1) { -#ifndef CONTEXT_THREADS +#ifndef HAVE_THREAD_CONTEXTS THROWF(arg_error, 0, "The thread factory cannot be run in parallel"); #endif } diff --git a/src/simix/smx_process.cpp b/src/simix/smx_process.cpp index 6078923989..9ced079ade 100644 --- a/src/simix/smx_process.cpp +++ b/src/simix/smx_process.cpp @@ -155,7 +155,6 @@ void SIMIX_create_maestro_process() maestro->context = SIMIX_context_new(NULL, 0, NULL, NULL, maestro); maestro->simcall.issuer = maestro; simix_global->maestro_process = maestro; - return; } /** * \brief Stops a process. diff --git a/src/simix/smx_synchro_private.h b/src/simix/smx_synchro_private.h index d6da8045f7..9cf259203a 100644 --- a/src/simix/smx_synchro_private.h +++ b/src/simix/smx_synchro_private.h @@ -32,16 +32,13 @@ XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t XBT_PRIVATE void SIMIX_synchro_destroy(smx_synchro_t synchro); XBT_PRIVATE smx_mutex_t SIMIX_mutex_init(void); -XBT_PRIVATE void SIMIX_mutex_destroy(smx_mutex_t mutex); XBT_PRIVATE int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer); XBT_PRIVATE void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer); XBT_PRIVATE smx_cond_t SIMIX_cond_init(void); -XBT_PRIVATE void SIMIX_cond_destroy(smx_cond_t cond); XBT_PRIVATE void SIMIX_cond_broadcast(smx_cond_t cond); XBT_PRIVATE void SIMIX_cond_signal(smx_cond_t cond); -XBT_PRIVATE void SIMIX_sem_destroy(smx_sem_t sem); XBT_PRIVATE XBT_PRIVATE smx_sem_t SIMIX_sem_init(unsigned int value); XBT_PRIVATE void SIMIX_sem_release(smx_sem_t sem); XBT_PRIVATE int SIMIX_sem_would_block(smx_sem_t sem); diff --git a/src/smpi/fixsrc.pl b/src/smpi/fixsrc.pl deleted file mode 100755 index 8844d208c5..0000000000 --- a/src/smpi/fixsrc.pl +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env perl - -# Copyright (c) 2011, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -# Add include for mandatory header file -print "#include \n"; - -# FIXME: here we make the assumption that people don't do things like put -# multiple statements on the same line after a declaration, but separated by -# semicolons. It's a reasonable assumption for the time being, but technically -# it could cause problems for some code. - -OUTER: while ($line = ) { - if ($line =~ /SMPI_VARINIT/) { - do { - chomp $line; # kill carriage return - $line =~ s/\s+/ /g; # remove excessive whitespace added by spatch - while ($line =~ s/(SMPI_VARINIT[A-Z0-9_]*?\(.*?\))//) { - print "$1\n"; - } - - # if varinit continues on to next line - if ($line =~ /SMPI_VARINIT/) { - # should only happen for bad code... - if (!($nextline = )) { - last OUTER; - } - $line .= $nextline; - - } - } while ($line =~ /SMPI_VARINIT/); - } else { - print $line; - } -} diff --git a/src/smpi/myprintloc.cocci b/src/smpi/myprintloc.cocci deleted file mode 100644 index bea1b79f30..0000000000 --- a/src/smpi/myprintloc.cocci +++ /dev/null @@ -1,122 +0,0 @@ - -@r@ -/* Matching a declaration, ie rewriting site candidate - Disqualify the candidate - ----------------- */ -type T; -position p1; -identifier id; -@@ - -T id@p1; - - - - -@funcdecl@ -# Matching a /function/ declaration. -# Disqualify the candidate -#----------------- -type T; -position r.p1; -identifier id; -@@ - T id@p1(...) {...} - - - - -@funcproto@ -# Matching a function prototype w/o body. -# Disqualify the candidate -#----------------- -type T; -position r.p1; -identifier id; -@@ - T id@p1(...); - -@localdeclaration@ -# Matching a declaration at the top level of a function. -# Disqualify the candidate -#----------------- -type T1,T2; -position r.p1; -identifier id1,id2; -@@ - -T1 id1(...) { - ... - T2 id2@p1; - ... -} - -@localinnerdeclaration@ -# The next rule is there to make sure that we are not speaking of a -# local variable declared in an inner block. I don't like it at all: -# It is redundent and gives false negative on the foreach macros that -# get often declared in the code. Example in examples/gras/spawn.c: -# -# int server() { -# ... -# xbt_dynar_foreach(chunk->primes,cursor,data) { -# char number[100]; -# ... -# } -# ... -# } -# -# Do I really need to complicate this rule further to add every macro -# that we use in our C, or can it be merged with the previous one by -# saying something like "in a function, at whatever level of nesting"? - -type T1,T2; -position r.p1; -identifier id1,id2; -expression e1,e2,e3; -@@ - -T1 id1(...) { - ... -( - for (e1;e2;e3) { ... T2 id2@p1; ... } -| - for (;e2;e3) { ... T2 id2@p1; ... } -| - for (e1;;e3) { ... T2 id2@p1; ... } -| - for (e1;e2;) { ... T2 id2@p1; ... } -| - for (e1;;) { ... T2 id2@p1; ... } -| - for (;e2;) { ... T2 id2@p1; ... } -| - for (;;e3) { ... T2 id2@p1; ... } -| - for (;;) { ... T2 id2@p1; ... } -| - while (e1) { ... T2 id2@p1; ... } -| - do { ... T2 id2@p1; ... } while (e1); -) - ... -} - - - -@script:python depends on r - && !funcdecl - && !funcproto - && !localdeclaration - && !localinnerdeclaration@ - -# This rule is only a debugging rule, to print the sites where the -# change must be applied - -p1 << r.p1; -T << r.T; -id << r.id; -@@ - -c1 = cocci.combine(id,p1) -print "1. symbol %s of type \"%s\" at %s:%s" % (id,T,c1.location.line,c1.location.column) diff --git a/src/smpi/patch_source.sh b/src/smpi/patch_source.sh deleted file mode 100755 index 38fd74593f..0000000000 --- a/src/smpi/patch_source.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2011, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -INFILE="$1" -OUTFILE="$2" -SPFILE="replace_globals.cocci" -TMPFILE=`mktemp ${OUTFILE}.XXXX` - -trap "rm -f ${TMPFILE}" EXIT -spatch -sp_file ${SPFILE} ${INFILE} -o ${TMPFILE} >/dev/null 2>/dev/null -./fixsrc.pl < ${TMPFILE} > ${OUTFILE} diff --git a/src/smpi/private.h b/src/smpi/private.h index 6f657207d9..44528e6804 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -15,7 +15,6 @@ #include "simgrid/simix.h" #include "src/include/smpi/smpi_interface.h" #include "smpi/smpi.h" -#include "smpi/smpi_cocci.h" #include "src/instr/instr_private.h" SG_BEGIN_DECL() diff --git a/src/smpi/replace_globals.cocci b/src/smpi/replace_globals.cocci deleted file mode 100644 index 00a6ca5fff..0000000000 --- a/src/smpi/replace_globals.cocci +++ /dev/null @@ -1,134 +0,0 @@ -// FIXME: seems like cocci has problems manipulating the declarations, at least -// when there is more than one on the same line. We already need perl to split -// up the declarations after the fact, is there another tool we can use to patch -// up and match the declarations? In that case we could consider dropping cocci, -// or just using it to alter global variable accesses. -// -// FIXME: problems -// - array declarations not properly matched...can fix, but then can't have -// multiple declarations on one line -// - does not match array initializers -// - probably won't fix structure declarations with initialization either - -// Function prototype looks like variable dec, but has parentheses -@funcproto@ -type T; -identifier func; -position p; -@@ -T@p func(...); - -// define a local variable declaration as one at some level of nesting -@localvardecl@ -type T; -identifier var; -position p; -expression E; -@@ -<... -( // default case -T@p -var -; -| // variable has initializer -T@p -var = E -; -) -...> - -// define a global variable declaration as one that is neither a function -// prototype nor a local variable declaration -@globalvardecl@ -type T; -identifier var; -position p != { funcproto.p, localvardecl.p }; -expression value; -// expression size; -@@ -( // default case -T@p -- var -+ *var = SMPI_VARINIT_GLOBAL(var, T) -; -| // variable has initializer (not a struct or array) -T@p -- var = value -+ *var = SMPI_VARINIT_GLOBAL_AND_SET(var, T, value) -; -//| // array of specified size -//T@p // FIXME: matches, but complains if more than one decl on a line... -//- var[size] -//+ *var[size] = SMPI_VARINIT_GLOBAL_ARRAY(T, size) -//; -//| // array of specified size with initializer -//T@p // FIXME: how to match initializer? -//- var[size] = { ... } -//+ *var[] = SMPI_VARINIT_GLOBAL_ARRAY_AND_SET(T, size, { ... }) -//; -//| // array without specified size, but with initializer -//T@p // FIXME: how to match initializer? how to figure out size? -//- var[] = { ... } -//+ *var[] = SMPI_VARINIT_GLOBAL_ARRAY_AND_SET(T, size, { ... }) // size = ? -//; -//| struct with initializer? -) - -// rewrite access to global variables based on name, but avoid the declaration -// and local variables that might have the same name -@rewriteglobalaccess@ -type T; -local idexpression lvar; -identifier globalvardecl.var; -@@ -<... -( // local variable -lvar -| // rewrite access -+SMPI_VARGET_GLOBAL( -var -+) -) -...> - -// define a local static variable declaration as one at some level of nesting -// starting with the word static (exceptions?) -@staticvardecl@ -type T; -identifier func, var; -expression value; -@@ -func(...) { -... -( // default case -static T -- var -+ *var = SMPI_VARINIT_STATIC(T, var) -; -| // variable has initializer (not a struct or array) -T -- var = value -+ *var = SMPI_VARINIT_STATIC_AND_SET(var, T, value) -; -) -... -} - -// -@rewritestaticaccess@ -type T; -identifier staticvardecl.func, staticvardecl.var; -@@ -func(...) { -<... -( // declaration -T -var -; -| // rewrite access -+SMPI_VARGET_STATIC( -var -+) -) -...> -} diff --git a/src/smpi/replace_static.cocci b/src/smpi/replace_static.cocci deleted file mode 100644 index cda1de2e53..0000000000 --- a/src/smpi/replace_static.cocci +++ /dev/null @@ -1,67 +0,0 @@ -// FIXME: why can't I just define a static local vardecl the same way as a -// normal local vardecl? - -// Function prototype looks like variable dec, but has parentheses -@funcproto@ -type T; -identifier func; -position p; -@@ -T@p func(...); - -// Define a local variable as one whose declaration is encased in brackets -@localvardecl@ -type T; -identifier var; -position p; -expression E; -@@ -{ -<... -( -T@p -var -; -| -T@p -var = E -; -) -...> -} - -// global variable is one whose declaration is neither local nor a function -// prototype -@globalvardecl@ -type T; -identifier var; -position p != { localvardecl.p, funcproto.p }; -expression value; -// expression size; -@@ -( -T@p var; -| -T@p var = value; -) - -// local static decl is a nonglobal static decl... -@localstaticvardecl@ -type T; -identifier var; -position p != globalvardecl.p; -expression value; -@@ -( -static T@p -- var -+ *var = SMPI_VARINIT_STATIC(var, T) -; -| -static T@p -- var = value -+ *var = SMPI_VARINIT_STATIC_AND_SET(var, T, value) -; -) - -// FIXME: add varaccess... diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 21a8356484..568168b97b 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -460,7 +460,7 @@ void smpi_mpi_start(MPI_Request request) } void* buf = request->buf; - if ( (! (request->flags & SSEND)) && (request->size < sg_cfg_get_int("smpi/send_is_detached_thres"))) { + if ( (! (request->flags & SSEND)) && (request->size < sg_cfg_get_int("smpi/send_is_detached_thresh"))) { void *oldbuf = NULL; request->detached = 1; XBT_DEBUG("Send request %p is detached", request); diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 7b47526f7a..692d2eb24d 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -411,7 +411,7 @@ static void smpi_check_options(){ //check correctness of MPI parameters xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <= - sg_cfg_get_int("smpi/send_is_detached_thres")); + sg_cfg_get_int("smpi/send_is_detached_thresh")); if (sg_cfg_is_default_value("smpi/running_power")) { XBT_INFO("You did not set the power of the host running the simulation. " diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 475e236447..a8572984a7 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -185,6 +185,8 @@ Cpu::~Cpu() } if (p_constraintCoreId) xbt_free(p_constraintCoreId); + if (p_speedPeakList) + xbt_dynar_free(&p_speedPeakList); } double Cpu::getCurrentPowerPeak() diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 63701e261a..a59737bbf2 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -36,11 +36,11 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace) double time = 0; int i = 0; p_timePoints = (double*) xbt_malloc0(sizeof(double) * - (xbt_dynar_length(speedTrace->s_list.event_list) + 1)); + (xbt_dynar_length(speedTrace->event_list) + 1)); p_integral = (double*) xbt_malloc0(sizeof(double) * - (xbt_dynar_length(speedTrace->s_list.event_list) + 1)); - m_nbPoints = xbt_dynar_length(speedTrace->s_list.event_list) + 1; - xbt_dynar_foreach(speedTrace->s_list.event_list, cpt, val) { + (xbt_dynar_length(speedTrace->event_list) + 1)); + m_nbPoints = xbt_dynar_length(speedTrace->event_list) + 1; + xbt_dynar_foreach(speedTrace->event_list, cpt, val) { p_timePoints[i] = time; p_integral[i] = integral; integral += val.delta * val.value; @@ -302,7 +302,7 @@ double CpuTiTgmr::getPowerScale(double a) reduced_a = a - floor(a / m_lastTime) * m_lastTime; point = p_trace->binarySearch(p_trace->p_timePoints, reduced_a, 0, p_trace->m_nbPoints - 1); - xbt_dynar_get_cpy(p_speedTrace->s_list.event_list, point, &val); + xbt_dynar_get_cpy(p_speedTrace->event_list, point, &val); return val.value; } @@ -330,8 +330,8 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) } /* only one point available, fixed trace */ - if (xbt_dynar_length(speedTrace->s_list.event_list) == 1) { - xbt_dynar_get_cpy(speedTrace->s_list.event_list, 0, &val); + if (xbt_dynar_length(speedTrace->event_list) == 1) { + xbt_dynar_get_cpy(speedTrace->event_list, 0, &val); m_type = TRACE_FIXED; m_value = val.value; return; @@ -341,7 +341,7 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) p_speedTrace = speedTrace; /* count the total time of trace file */ - xbt_dynar_foreach(speedTrace->s_list.event_list, cpt, val) { + xbt_dynar_foreach(speedTrace->event_list, cpt, val) { total_time += val.delta; } p_trace = new CpuTiTrace(speedTrace); @@ -499,21 +499,7 @@ void CpuTiModel::addTraces() xbt_assert(cpu, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - XBT_DEBUG("Add speed trace: %s to CPU(%s)", trace_name, elm); - if (cpu->p_availTrace) - delete cpu->p_availTrace; - - cpu->p_availTrace = new CpuTiTgmr(trace, cpu->m_speedScale); - - /* add a fake trace event if periodicity == 0 */ - if (trace && xbt_dynar_length(trace->s_list.event_list) > 1) { - s_tmgr_event_t val; - xbt_dynar_get_cpy(trace->s_list.event_list, - xbt_dynar_length(trace->s_list.event_list) - 1, &val); - if (val.delta == 0) { - cpu->set_speed_trace(tmgr_empty_trace_new()); - } - } + cpu->set_speed_trace(trace); } } @@ -539,11 +525,11 @@ CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, if (stateTrace) p_stateEvent = future_evt_set->add_trace(stateTrace, 0.0, this); - if (speedTrace && xbt_dynar_length(speedTrace->s_list.event_list) > 1) { + if (speedTrace && xbt_dynar_length(speedTrace->event_list) > 1) { s_tmgr_event_t val; // add a fake trace event if periodicity == 0 - xbt_dynar_get_cpy(speedTrace->s_list.event_list, - xbt_dynar_length(speedTrace->s_list.event_list) - 1, &val); + xbt_dynar_get_cpy(speedTrace->event_list, + xbt_dynar_length(speedTrace->event_list) - 1, &val); if (val.delta == 0) { p_speedEvent = future_evt_set->add_trace(tmgr_empty_trace_new(), p_availTrace->m_lastTime, this); @@ -557,6 +543,23 @@ CpuTi::~CpuTi() delete p_availTrace; delete p_actionSet; } +void CpuTi::set_speed_trace(tmgr_trace_t trace) +{ + if (p_availTrace) + delete p_availTrace; + + p_availTrace = new CpuTiTgmr(trace, m_speedScale); + + /* add a fake trace event if periodicity == 0 */ + if (trace && xbt_dynar_length(trace->event_list) > 1) { + s_tmgr_event_t val; + xbt_dynar_get_cpy(trace->event_list, + xbt_dynar_length(trace->event_list) - 1, &val); + if (val.delta == 0) { + p_speedEvent = future_evt_set->add_trace(tmgr_empty_trace_new(), 0.0, this); + } + } +} void CpuTi::updateState(tmgr_trace_iterator_t event_type, double value, double date) @@ -576,8 +579,8 @@ void CpuTi::updateState(tmgr_trace_iterator_t event_type, modified(true); speedTrace = p_availTrace->p_speedTrace; - xbt_dynar_get_cpy(speedTrace->s_list.event_list, - xbt_dynar_length(speedTrace->s_list.event_list) - 1, &val); + xbt_dynar_get_cpy(speedTrace->event_list, + xbt_dynar_length(speedTrace->event_list) - 1, &val); /* free old trace */ delete p_availTrace; m_speedScale = val.value; diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 9c46c462a6..a9820c4f16 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -118,6 +118,8 @@ public: int initiallyOn, tmgr_trace_t stateTrace) ; ~CpuTi(); + void set_speed_trace(tmgr_trace_t trace); + void updateState(tmgr_trace_iterator_t event_type, double value, double date) override; void updateActionsFinishTime(double now); bool isUsed() override; diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 9197c4d277..298496af00 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -202,10 +202,9 @@ L07Action::L07Action(Model *model, int host_nb, int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */ double latency = 0.0; - this->p_netcardList->reserve(host_nb); for (int i = 0; ip_netcardList->push_back(host_list[i]->pimpl_netcard); + this->p_netcardList->push_back(host_list[i]->pimpl_netcard); /* Compute the number of affected resources... */ if(bytes_amount != NULL) { @@ -213,20 +212,17 @@ L07Action::L07Action(Model *model, int host_nb, for (int i = 0; i < host_nb; i++) { for (int j = 0; j < host_nb; j++) { - xbt_dynar_t route=NULL; if (bytes_amount[i * host_nb + j] > 0) { double lat=0.0; - unsigned int cpt; - void *_link; - LinkL07 *link; + xbt_dynar_t route=NULL; - routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j], - &route, &lat); + routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], &route, &lat); latency = MAX(latency, lat); + void *_link; xbt_dynar_foreach(route, cpt, _link) { - link = static_cast(_link); + LinkL07 *link = static_cast(_link); xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL); } } @@ -261,15 +257,15 @@ L07Action::L07Action(Model *model, int host_nb, if(bytes_amount != NULL) { for (int i = 0; i < host_nb; i++) { for (int j = 0; j < host_nb; j++) { - void *_link; xbt_dynar_t route=NULL; if (bytes_amount[i * host_nb + j] == 0.0) continue; - routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j], + routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], &route, NULL); + void *_link; xbt_dynar_foreach(route, cpt, _link) { LinkL07 *link = static_cast(_link); lmm_expand_add(model->getMaxminSystem(), link->getConstraint(), @@ -283,6 +279,7 @@ L07Action::L07Action(Model *model, int host_nb, this->setCost(1.0); this->setRemains(0.0); } + xbt_free(host_list); } Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst, @@ -551,6 +548,7 @@ void LinkL07::updateLatency(double value, double date) **********/ L07Action::~L07Action(){ + delete p_netcardList; free(p_communicationAmount); free(p_computationAmount); } @@ -594,7 +592,7 @@ int L07Action::unref() m_refcount--; if (!m_refcount) { if (action_hook.is_linked()) - p_stateSet->erase(p_stateSet->iterator_to(*this)); + p_stateSet->erase(p_stateSet->iterator_to(*this)); if (getVariable()) lmm_variable_free(getModel()->getMaxminSystem(), getVariable()); delete this; diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index fc470a5905..902e48f791 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -1166,7 +1166,7 @@ XBT_INLINE lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t } #ifdef HAVE_LATENCY_BOUND_TRACKING -XBT_INLINE int lmm_is_variable_limited_by_latency(lmm_variable_t var) +XBT_PUBLIC(int) lmm_is_variable_limited_by_latency(lmm_variable_t var) { return (double_equals(var->bound, var->value, var->bound*sg_maxmin_precision)); } diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 876546d1b4..71ceece2f8 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -5,18 +5,11 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "network_constant.hpp" -#include "surf/random_mgr.h" #include "host_interface.hpp" #include "src/surf/platform.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); -static int host_number_int = 0; - -static void netcste_parse_nolink(sg_platf_link_cbarg_t link){ - xbt_die("There is no link in the Constant network model. " - "Please remove any link from your platform (and switch to routing='None')"); -} /********* * Model * @@ -25,16 +18,14 @@ void surf_network_model_init_Constant() { xbt_assert(surf_network_model == NULL); surf_network_model = new simgrid::surf::NetworkConstantModel(); + xbt_dynar_push(all_existing_models, &surf_network_model); routing_model_create(NULL); - simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host&) { - host_number_int++; + simgrid::surf::on_link.connect([](sg_platf_link_cbarg_t link){ + xbt_die("There is no link in the Constant network model. " + "Please remove any link from your platform (and switch to routing='None')"); }); - simgrid::surf::on_link.connect(netcste_parse_nolink); - - simgrid::surf::Model *model = surf_network_model; - xbt_dynar_push(all_existing_models, &model); } namespace simgrid { diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c deleted file mode 100644 index 65c9a3dc81..0000000000 --- a/src/surf/platf_generator.c +++ /dev/null @@ -1,743 +0,0 @@ -/* Copyright (c) 2012, 2014-2015. The SimGrid Team. - * All rights reserved. */ - -/* 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 "simgrid/platf_generator.h" -#include "platf_generator_private.h" -#include "xbt.h" -#include "xbt/RngStream.h" -#include "surf/simgrid_dtd.h" -#include "surf_private.h" -#include - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(platf_generator, surf, "Platform Generator"); - -static xbt_graph_t platform_graph = NULL; -static xbt_dynar_t promoter_dynar = NULL; -static xbt_dynar_t labeler_dynar = NULL; - -static RngStream rng_stream = NULL; - -static unsigned long last_link_id = 0; - -xbt_graph_t platf_graph_get(void) { - // We need some debug, so let's add this function - // WARNING : should be removed when it becomes useless - return platform_graph; -} - -/** - * \brief Set the seed of the platform generator RngStream - * - * This RngStream is used to generate all the random values needed to - * generate the platform - * - * \param seed A array of six integer; if NULL, the default seed will be used. - */ -void platf_random_seed(unsigned long seed[6]) { - - if(rng_stream == NULL) { - //stream not created yet, we do it now - rng_stream = RngStream_CreateStream(NULL); - } - if(seed != NULL) { - RngStream_SetSeed(rng_stream, seed); - } -} - -/** - * \brief Initialize the platform generator - * - * This function create the graph and add node_count nodes to it - * \param node_count The number of nodes of the platform - */ -void platf_graph_init(unsigned long node_count) { - unsigned long i; - platform_graph = xbt_graph_new_graph(FALSE, NULL); - if(rng_stream == NULL) { - rng_stream = RngStream_CreateStream(NULL); - } - - for(i=0 ; iid = i+1; - node_data->x = 0; - node_data->y = 0; - node_data->degree = 0; - node_data->kind = ROUTER; - node_data->connect_checked = FALSE; - xbt_graph_new_node(platform_graph, (void*) node_data); - } - - last_link_id = 0; - -} - -/** - * \brief Connect two nodes - * \param node1 The first node to connect - * \param node2 The second node to connect - */ -void platf_node_connect(xbt_node_t node1, xbt_node_t node2) { - context_node_t node1_data; - context_node_t node2_data; - node1_data = (context_node_t) xbt_graph_node_get_data(node1); - node2_data = (context_node_t) xbt_graph_node_get_data(node2); - node1_data->degree++; - node2_data->degree++; - - context_edge_t edge_data = NULL; - edge_data = xbt_new0(s_context_edge_t, 1); - edge_data->id = ++last_link_id; - edge_data->length = platf_node_distance(node1, node2); - edge_data->labeled = FALSE; - xbt_graph_new_edge(platform_graph, node1, node2, (void*)edge_data); -} - -/** - * \brief Compute the distance between two nodes - * \param node1 The first node - * \param node2 The second node - * \return The distance between node1 and node2 - */ -double platf_node_distance(xbt_node_t node1, xbt_node_t node2) { - context_node_t node1_data; - context_node_t node2_data; - double delta_x; - double delta_y; - double distance; - node1_data = (context_node_t) xbt_graph_node_get_data(node1); - node2_data = (context_node_t) xbt_graph_node_get_data(node2); - delta_x = node1_data->x - node2_data->x; - delta_y = node1_data->y - node2_data->y; - distance = sqrt(delta_x*delta_x + delta_y*delta_y); - return distance; -} - -/** - * \brief Initialize the platform, placing nodes uniformly on the unit square - * \param node_count The number of node - */ -void platf_graph_uniform(unsigned long node_count) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t graph_node = NULL; - context_node_t node_data = NULL; - unsigned int i; - platf_graph_init(node_count); - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - node_data = (context_node_t) xbt_graph_node_get_data(graph_node); - node_data->x = RngStream_RandU01(rng_stream); - node_data->y = RngStream_RandU01(rng_stream); - } -} - -/** - * \brief Initialize the platform, placing nodes in little clusters on the unit square - * \param node_count The number of node - */ -void platf_graph_heavytailed(unsigned long node_count) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t graph_node = NULL; - context_node_t node_data = NULL; - unsigned int i; - platf_graph_init(node_count); - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - node_data = (context_node_t) xbt_graph_node_get_data(graph_node); - node_data->x = random_pareto(0, 1, 1.0/*K*/, 10e9/*P*/, 1.0/*alpha*/); - node_data->y = random_pareto(0, 1, 1.0/*K*/, 10e9/*P*/, 1.0/*alpha*/); - } -} - -/** - * \brief Creates a simple topology where all nodes are connected to the first one in a star fashion - */ -void platf_graph_interconnect_star(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t graph_node = NULL; - xbt_node_t first_node = NULL; - unsigned int i; - - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - if(i==0) { - //Ok, we get the first node, let's keep it somewhere... - first_node = graph_node; - } else { - //All the other nodes are connected to the first one - platf_node_connect(graph_node, first_node); - } - } -} - -/** - * \brief Creates a simple topology where all nodes are connected in line - */ -void platf_graph_interconnect_line(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t graph_node = NULL; - xbt_node_t old_node = NULL; - unsigned int i; - - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - if(old_node != NULL) { - platf_node_connect(graph_node, old_node); - } - old_node = graph_node; - } -} - -/** - * \brief Create a simple topology where all nodes are connected along a ring - */ -void platf_graph_interconnect_ring(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t graph_node = NULL; - xbt_node_t old_node = NULL; - xbt_node_t first_node = NULL; - unsigned int i; - - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - if(i == 0) { - // this is the first node, let's keep it somewhere - first_node = graph_node; - } else { - //connect each node to the previous one - platf_node_connect(graph_node, old_node); - } - old_node = graph_node; - } - //we still have to connect the first and the last node together - platf_node_connect(first_node, graph_node); -} - -/** - * \brief Create a simple topology where all nodes are connected to each other, in a clique manner - */ -void platf_graph_interconnect_clique(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t first_node = NULL; - xbt_node_t second_node = NULL; - unsigned int i,j; - - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, first_node) { - xbt_dynar_foreach(dynar_nodes, j, second_node) { - if(j>=i) - break; - platf_node_connect(first_node, second_node); - } - } -} - -/** - * \brief Creates a topology where the probability to connect two nodes is uniform (unrealistic, but simple) - * \param alpha Probability for two nodes to get connected - */ -void platf_graph_interconnect_uniform(double alpha) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t first_node = NULL; - xbt_node_t second_node = NULL; - unsigned int i,j; - - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, first_node) { - xbt_dynar_foreach(dynar_nodes, j, second_node) { - if(j>=i) - break; - if(RngStream_RandU01(rng_stream) < alpha) { - platf_node_connect(first_node, second_node); - } - } - } -} - -/** - * \brief Create a topology where the probability follows an exponential law - * \param alpha Number of edges increases with alpha - */ -void platf_graph_interconnect_exponential(double alpha) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t first_node = NULL; - xbt_node_t second_node = NULL; - unsigned int i,j; - double L = sqrt(2.0); /* L = c*sqrt(2); c=side of placement square */ - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, first_node) { - xbt_dynar_foreach(dynar_nodes, j, second_node) { - if(j>=i) - break; - double d = platf_node_distance(first_node, second_node); - if(RngStream_RandU01(rng_stream) < alpha*exp(-d/(L-d))) { - platf_node_connect(first_node, second_node); - } - } - } -} - -/** - * \brief Create a topology where the probability follows the model of Waxman - * - * see Waxman, Routing of Multipoint Connections, IEEE J. on Selected Areas in Comm., 1988 - * - * \param alpha Number of edges increases with alpha - * \param beta Edge length heterogeneity increases with beta - */ -void platf_graph_interconnect_waxman(double alpha, double beta) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t first_node = NULL; - xbt_node_t second_node = NULL; - unsigned int i,j; - double L = sqrt(2.0); /* L = c*sqrt(2); c=side of placement square */ - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, first_node) { - xbt_dynar_foreach(dynar_nodes, j, second_node) { - if(j>=i) - break; - double d = platf_node_distance(first_node, second_node); - if(RngStream_RandU01(rng_stream) < alpha*exp(-d/(L*beta))) { - platf_node_connect(first_node, second_node); - } - } - } -} - -/** - * \brief Create a topology where the probability follows the model of Zegura - * see Zegura, Calvert, Donahoo, A quantitative comparison of graph-based models - * for Internet topology, IEEE/ACM Transactions on Networking, 1997. - * - * \param alpha Probability of connexion for short edges - * \param beta Probability of connexion for long edges - * \param r Limit between long and short edges (between 0 and sqrt(2) since nodes are placed on the unit square) - */ -void platf_graph_interconnect_zegura(double alpha, double beta, double r) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t first_node = NULL; - xbt_node_t second_node = NULL; - unsigned int i,j; - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, first_node) { - xbt_dynar_foreach(dynar_nodes, j, second_node) { - if(j>=i) - break; - double d = platf_node_distance(first_node, second_node); - double proba = d < r ? alpha : beta; - if(RngStream_RandU01(rng_stream) < proba) { - platf_node_connect(first_node, second_node); - } - } - } -} - -/** - * \brief Create a topology constructed according to the Barabasi-Albert algorithm (follows power laws) - * see Barabasi and Albert, Emergence of scaling in random networks, Science 1999, num 59, p509­-512. - */ -void platf_graph_interconnect_barabasi(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_node_t first_node = NULL; - xbt_node_t second_node = NULL; - context_node_t node_data = NULL; - unsigned int i,j; - unsigned long sum = 0; - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, first_node) { - xbt_dynar_foreach(dynar_nodes, j, second_node) { - if(j>=i) - break; - node_data = xbt_graph_node_get_data(second_node); - if(sum==0 || RngStream_RandU01(rng_stream) < ((double)(node_data->degree)/ (double)sum)) { - platf_node_connect(first_node, second_node); - sum += 2; - } - } - } -} - -/** - * \brief Check if the produced graph is connected - * - * You should check if the produced graph is connected before doing anything - * on it. You probably don't want any isolated node or group of nodes... - * - * \return TRUE if the graph is connected, FALSE otherwise - */ -int platf_graph_is_connected(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_dynar_t connected_nodes = NULL; - xbt_dynar_t outgoing_edges = NULL; - xbt_node_t graph_node = NULL; - context_node_t node_data = NULL; - xbt_edge_t outedge = NULL; - unsigned long iterator; - unsigned int i; - dynar_nodes = xbt_graph_get_nodes(platform_graph); - connected_nodes = xbt_dynar_new(sizeof(xbt_node_t), NULL); - - //Let's just check if every nodes are connected to something - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - node_data = xbt_graph_node_get_data(graph_node); - if(node_data->degree==0) { - return FALSE; - } - } - - //We still need a real check - //Initialize the connected node array with the first node - xbt_dynar_get_cpy(dynar_nodes, 0, &graph_node); - node_data = xbt_graph_node_get_data(graph_node); - node_data->connect_checked = TRUE; - xbt_dynar_push(connected_nodes, &graph_node); - iterator = 0; - do { - //Get the next node - xbt_dynar_get_cpy(connected_nodes, iterator, &graph_node); - - //add all the linked nodes to the connected node array - outgoing_edges = xbt_graph_node_get_outedges(graph_node); - xbt_dynar_foreach(outgoing_edges, i, outedge) { - xbt_node_t src = xbt_graph_edge_get_source(outedge); - xbt_node_t dst = xbt_graph_edge_get_target(outedge); - node_data = xbt_graph_node_get_data(src); - if(!node_data->connect_checked) { - xbt_dynar_push(connected_nodes, &src); - node_data->connect_checked = TRUE; - } - node_data = xbt_graph_node_get_data(dst); - if(!node_data->connect_checked) { - xbt_dynar_push(connected_nodes, &dst); - node_data->connect_checked = TRUE; - } - } - } while(++iterator < xbt_dynar_length(connected_nodes)); - - // The graph is connected if the connected node array has the same length - // as the graph node array - return xbt_dynar_length(connected_nodes) == xbt_dynar_length(dynar_nodes); -} - - -/** - * \brief Remove the links in the created topology - * - * This is useful when the created topology is not connected, and you want - * to generate a new one. - */ -void platf_graph_clear_links(void) { - xbt_dynar_t dynar_nodes = NULL; - xbt_dynar_t dynar_edges = NULL; - xbt_dynar_t dynar_edges_cpy = NULL; - xbt_node_t graph_node = NULL; - xbt_edge_t graph_edge = NULL; - context_node_t node_data = NULL; - unsigned int i; - - //The graph edge dynar will be modified directly, so we work on a copy of it - dynar_edges = xbt_graph_get_edges(platform_graph); - dynar_edges_cpy = xbt_dynar_new(sizeof(xbt_edge_t), NULL); - xbt_dynar_foreach(dynar_edges, i, graph_edge) { - xbt_dynar_push_as(dynar_edges_cpy, xbt_edge_t, graph_edge); - } - //Delete edges from the graph - xbt_dynar_foreach(dynar_edges_cpy, i, graph_edge) { - xbt_graph_free_edge(platform_graph, graph_edge, xbt_free_f); - } - //remove the dynar copy - xbt_dynar_free(&dynar_edges_cpy); - - //All the nodes will be of degree 0, unchecked from connectedness - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - node_data = xbt_graph_node_get_data(graph_node); - node_data->degree = 0; - node_data->connect_checked = FALSE; - } -} - -/** - * \brief Promote a node to a host - * - * This function should be called in callbacks registered with the - * platf_graph_promoter function. - * - * \param node The node to promote - * \param parameters The parameters needed to build the host - */ -void platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters) { - node->kind = HOST; - memcpy(&(node->host_parameters), parameters, sizeof(s_sg_platf_host_cbarg_t)); -} - -/** - * \brief Promote a node to a cluster - * - * This function should be called in callbacks registered with the - * platf_graph_promoter function. - * - * \param node The node to promote - * \param parameters The parameters needed to build the cluster - */ -void platf_graph_promote_to_cluster(context_node_t node, sg_platf_cluster_cbarg_t parameters) { - node->kind = CLUSTER; - memcpy(&(node->cluster_parameters), parameters, sizeof(s_sg_platf_cluster_cbarg_t)); -} - -/** - * \brief Set the parameters of a network link. - * - * This function should be called in callbacks registered with the - * platf_graph_labeler function. - * - * \param edge The edge to modify - * \param parameters The parameters of the network link - */ -void platf_graph_link_label(context_edge_t edge, sg_platf_link_cbarg_t parameters) { - memcpy(&(edge->link_parameters), parameters, sizeof(s_sg_platf_link_cbarg_t)); - edge->labeled = TRUE; -} - -/** - * \brief Register a callback to promote nodes - * - * The best way to promote nodes into host or cluster is to write a function - * which takes one parameter, a #context_node_t, make every needed test on - * it, and call platf_graph_promote_to_host or platf_graph_promote_to_cluster - * if needed. Then, register the function with this one. - * You can register several callbacks: the first registered function will be - * called first. If the node have not been promoted yet, the second function - * will be called, and so on... - * - * \param promoter_callback The callback function - */ -void platf_graph_promoter(platf_promoter_cb_t promoter_callback) { - if(promoter_dynar == NULL) { - promoter_dynar = xbt_dynar_new(sizeof(platf_promoter_cb_t), NULL); - } - xbt_dynar_push(promoter_dynar, &promoter_callback); -} - -/** - * \brief Register a callback to label links - * - * Like the node promotion, it is better, to set links, to write a function - * which take one parameter, a #context_edge_t, make every needed test on - * it, and call platf_graph_link_label if needed. - * You can register several callbacks: the first registered function will be - * called first. If the link have not been labeled yet, the second function - * will be called, and so on... All the links must have been labeled after - * all the calls. - * - * \param labeler_callback The callback function - */ -void platf_graph_labeler(platf_labeler_cb_t labeler_callback) { - if(labeler_dynar == NULL) { - labeler_dynar = xbt_dynar_new(sizeof(void*), NULL); - } - xbt_dynar_push(labeler_dynar, &labeler_callback); -} - -/** - * \brief Call the registered promoters on all nodes - * - * The promoters are called on all nodes, in the order of their registration - * If some nodes are not promoted, they will be routers - */ -void platf_do_promote(void) { - platf_promoter_cb_t promoter_callback; - xbt_node_t graph_node = NULL; - xbt_dynar_t dynar_nodes = NULL; - context_node_t node = NULL; - unsigned int i, j; - dynar_nodes = xbt_graph_get_nodes(platform_graph); - xbt_dynar_foreach(dynar_nodes, i, graph_node) { - node = (context_node_t) xbt_graph_node_get_data(graph_node); - xbt_dynar_foreach(promoter_dynar, j, promoter_callback) { - if(node->kind != ROUTER) - break; - promoter_callback(node); - } - } -} - -/** - * \brief Call the registered labelers on all links - */ -void platf_do_label(void) { - platf_labeler_cb_t labeler_callback; - xbt_edge_t graph_edge = NULL; - xbt_dynar_t dynar_edges = NULL; - context_edge_t edge = NULL; - unsigned int i, j; - dynar_edges = xbt_graph_get_edges(platform_graph); - xbt_dynar_foreach(dynar_edges, i, graph_edge) { - edge = (context_edge_t) xbt_graph_edge_get_data(graph_edge); - xbt_dynar_foreach(labeler_dynar, j, labeler_callback) { - if(edge->labeled) - break; - labeler_callback(edge); - } - if(!edge->labeled) { - XBT_ERROR("All links of the generated platform are not labeled."); - xbt_die("Please check your generation parameters."); - } - } -} - -/** - * \brief putting into SURF the generated platform - * - * This function should be called when the generation is over and the platform - * is ready to be put in place in SURF. All the init function, like MSG_init, - * must have been called before, or this function will not do anything. - * After that function, it should be possible to list all the available hosts - * with the provided functions. - */ -void platf_generate(void) { - - xbt_dynar_t nodes = NULL; - xbt_node_t graph_node = NULL; - context_node_t node_data = NULL; - xbt_dynar_t edges = NULL; - xbt_edge_t graph_edge = NULL; - context_edge_t edge_data = NULL; - unsigned int i; - - unsigned int last_host = 0; - unsigned int last_router = 0; - unsigned int last_cluster = 0; - - sg_platf_host_cbarg_t host_parameters; - sg_platf_cluster_cbarg_t cluster_parameters; - sg_platf_link_cbarg_t link_parameters; - s_sg_platf_router_cbarg_t router_parameters = SG_PLATF_ROUTER_INITIALIZER; /* This one is not a pointer! */ - s_sg_platf_route_cbarg_t route_parameters = SG_PLATF_ROUTE_INITIALIZER; /* neither this one! */ - - router_parameters.coord = NULL; - route_parameters.symmetrical = FALSE; - route_parameters.src = NULL; - route_parameters.dst = NULL; - route_parameters.gw_dst = NULL; - route_parameters.gw_src = NULL; - route_parameters.link_list = NULL; - - nodes = xbt_graph_get_nodes(platform_graph); - edges = xbt_graph_get_edges(platform_graph); - - sg_platf_begin(); - surf_parse_init_callbacks(); - routing_register_callbacks(); - - s_sg_platf_AS_cbarg_t AS = SG_PLATF_AS_INITIALIZER; - AS.id = "random platform"; - AS.routing = A_surfxml_AS_routing_Floyd; - sg_platf_new_AS_begin(&AS); - - //Generate hosts, clusters and routers - xbt_dynar_foreach(nodes, i, graph_node) { - node_data = xbt_graph_node_get_data(graph_node); - switch(node_data->kind) { - case HOST: - host_parameters = &node_data->host_parameters; - last_host++; - if(host_parameters->id == NULL) { - host_parameters->id = bprintf("host-%d", last_host); - } - sg_platf_new_host(host_parameters); - break; - case CLUSTER: - cluster_parameters = &node_data->cluster_parameters; - last_cluster++; - if(cluster_parameters->prefix == NULL) { - cluster_parameters->prefix = "host-"; - } - if(cluster_parameters->suffix == NULL) { - cluster_parameters->suffix = bprintf(".cluster-%d", last_cluster); - } - if(cluster_parameters->id == NULL) { - cluster_parameters->id = bprintf("cluster-%d", last_cluster); - } - sg_platf_new_cluster(cluster_parameters); - break; - case ROUTER: - node_data->router_id = bprintf("router-%d", ++last_router); - router_parameters.id = node_data->router_id; - sg_platf_new_router(&router_parameters); - break; - } - } - - //Generate links and routes - xbt_dynar_foreach(edges, i, graph_edge) { - xbt_node_t src = xbt_graph_edge_get_source(graph_edge); - xbt_node_t dst = xbt_graph_edge_get_target(graph_edge); - context_node_t src_data = xbt_graph_node_get_data(src); - context_node_t dst_data = xbt_graph_node_get_data(dst); - edge_data = xbt_graph_edge_get_data(graph_edge); - const char* temp = NULL; - - //Add a link to the platform - link_parameters = &edge_data->link_parameters; - if(link_parameters->id == NULL) { - link_parameters->id = bprintf("link-%ld", edge_data->id); - } - sg_platf_new_link(link_parameters); - - //Add a route matching this link - switch(src_data->kind) { - case ROUTER: - route_parameters.src = src_data->router_id; - break; - case CLUSTER: - route_parameters.src = src_data->cluster_parameters.id; - break; - case HOST: - route_parameters.src = src_data->host_parameters.id; - break; - } - switch(dst_data->kind) { - case ROUTER: - route_parameters.dst = dst_data->router_id; - break; - case CLUSTER: - route_parameters.dst = dst_data->cluster_parameters.id; - break; - case HOST: - route_parameters.dst = dst_data->host_parameters.id; - break; - } - sg_platf_route_begin(&route_parameters); - sg_platf_route_add_link(link_parameters->id, &route_parameters); - sg_platf_route_end(&route_parameters); - - //Create the symmertical route - temp = route_parameters.dst; - route_parameters.dst = route_parameters.src; - route_parameters.src = temp; - sg_platf_route_begin(&route_parameters); - sg_platf_route_add_link(link_parameters->id, &route_parameters); - sg_platf_route_end(&route_parameters); - } - - sg_platf_new_AS_end(); - sg_platf_end(); -} - -/* Functions used to generate interesting random values */ - -double random_pareto(double min, double max, double K, double P, double ALPHA) { - double x = RngStream_RandU01(rng_stream); - double den = pow(1.0 - x + x*pow(K/P, ALPHA), 1.0/ALPHA); - double res = (1/den); - res += min - 1; // pareto is on [1, infinity) by default - if (res>max) { - return max; - } - return res; -} diff --git a/src/surf/platf_generator_private.h b/src/surf/platf_generator_private.h deleted file mode 100644 index ea57365992..0000000000 --- a/src/surf/platf_generator_private.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2012, 2014. The SimGrid Team. - * All rights reserved. */ - -/* 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. */ - -#ifndef SG_PLATF_GEN_PRIVATE_H -#define SG_PLATF_GEN_PRIVATE_H - -#include - -#include "xbt/graph.h" -#include "simgrid/platf.h" - -XBT_PRIVATE void platf_graph_init(unsigned long node_count); - -XBT_PRIVATE void platf_node_connect(xbt_node_t node1, xbt_node_t node2); - -XBT_PRIVATE double platf_node_distance(xbt_node_t node1, xbt_node_t node2); - -XBT_PRIVATE double random_pareto(double min, double max, double K, double P, double ALPHA); - -#endif /* SG_PLATF_GEN_PRIVATE_H */ diff --git a/src/surf/random_mgr.c b/src/surf/random_mgr.c deleted file mode 100644 index 39fe6e2499..0000000000 --- a/src/surf/random_mgr.c +++ /dev/null @@ -1,290 +0,0 @@ -/* Copyright (c) 2007-2014. The SimGrid Team. - * All rights reserved. */ - -/* 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 "surf/random_mgr.h" -#include "xbt/sysdep.h" -#include "src/internal_config.h" /*_XBT_WIN32*/ -#include -#include - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(random, surf, "Random part of surf"); - -#ifdef _XBT_WIN32 - -static unsigned int _seed = 2147483647; - -#ifdef __VISUALC__ -typedef unsigned __int64 uint64_t; -typedef unsigned int uint32_t; -#endif - -struct drand48_data { - unsigned short int __x[3]; /* Current state. */ - unsigned short int __old_x[3]; /* Old state. */ - unsigned short int __c; /* Additive const. in congruential formula. */ - unsigned short int __init; /* Flag for initializing. */ - unsigned long long int __a; /* Factor in congruential formula. */ -}; - -static struct drand48_data __libc_drand48_data = { 0 }; - -union ieee754_double { - double d; - - /* This is the IEEE 754 double-precision format. */ - struct { - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; - /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct { - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; - - } ieee_nan; -}; - -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ - -double drand48(void); - -int -_drand48_iterate(unsigned short int xsubi[3], struct drand48_data *buffer); - -int -_erand48_r(unsigned short int xsubi[3], struct drand48_data *buffer, - double *result); - - -int -_erand48_r(unsigned short int xsubi[3], struct drand48_data *buffer, - double *result) -{ - union ieee754_double temp; - - /* Compute next state. */ - if (_drand48_iterate(xsubi, buffer) < 0) - return -1; - - /* Construct a positive double with the 48 random bits distributed over - its fractional part so the resulting FP number is [0.0,1.0). */ - - temp.ieee.negative = 0; - temp.ieee.exponent = IEEE754_DOUBLE_BIAS; - temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12); - temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4); - - /* Please note the lower 4 bits of mantissa1 are always 0. */ - *result = temp.d - 1.0; - - return 0; -} - -int _drand48_iterate(unsigned short int xsubi[3], - struct drand48_data *buffer) -{ - uint64_t X; - uint64_t result; - - /* Initialize buffer, if not yet done. */ - - if (buffer->__init == 0) { - buffer->__a = 0x5deece66dull; - buffer->__c = 0xb; - buffer->__init = 1; - } - - /* Do the real work. We choose a data type which contains at least - 48 bits. Because we compute the modulus it does not care how - many bits really are computed. */ - - X = (uint64_t) xsubi[2] << 32 | (uint32_t) xsubi[1] << 16 | xsubi[0]; - - result = X * buffer->__a + buffer->__c; - - - xsubi[0] = result & 0xffff; - xsubi[1] = (result >> 16) & 0xffff; - xsubi[2] = (result >> 32) & 0xffff; - - return 0; -} - -double _drand48(void); -void _srand(unsigned int seed); -int _rand(void); -int _rand_r(unsigned int *pseed); - -double _drand48(void) -{ - double result; - - (void) _erand48_r(__libc_drand48_data.__x, &__libc_drand48_data, - &result); - - return result; -} - -void _srand(unsigned int seed) -{ - _seed = seed; -} - -int _rand(void) -{ - const long a = 16807; - const long m = 2147483647; - const long q = 127773; /* (m/a) */ - const long r = 2836; /* (m%a) */ - - long lo, k, s; - - s = (long) _seed; - - k = (long) (s / q); - - lo = (s - q * k); - - s = a * lo - r * k; - - if (s <= 0) - s += m; - - _seed = (int) (s & RAND_MAX); - - return _seed; -} - -int _rand_r(unsigned int *pseed) -{ - const long a = 16807; - const long m = 2147483647; - const long q = 127773; /* (m/a) */ - const long r = 2836; /* (m%a) */ - - long lo, k, s; - - s = (long) *pseed; - - k = (long) (s / q); - - lo = (s - q * k); - - s = a * lo - r * k; - - if (s <= 0) - s += m; - - return (int) (s & RAND_MAX); - -} - - -#define rand_r _rand_r -#define drand48 _drand48 - -#endif - -static double custom_random(e_random_generator_t generator, long int *seed) -{ - switch (generator) { - - case DRAND48: - return drand48(); - case RAND: - return (double) rand_r((unsigned int *) seed) / RAND_MAX; - case RNGSTREAM : - XBT_INFO("Seen RNGSTREAM"); - return 0.0; - default: - return drand48(); - } -} - -/* Generate numbers between min and max with a given mean and standard deviation */ -double random_generate(random_data_t random) -{ - double a, b; - double alpha, beta, gamma; - double U1, U2, V, W, X; - - if (random == NULL) - return 0.0f; - - if (random->std == 0) - return random->mean * (random->max - random->min) + random->min; - - a = random->mean * (random->mean * (1 - random->mean) / - (random->std * random->std) - 1); - b = (1 - - random->mean) * (random->mean * (1 - - random->mean) / (random->std * - random->std) - 1); - - alpha = a + b; - if (a <= 1. || b <= 1.) - beta = ((1. / a) > (1. / b)) ? (1. / a) : (1. / b); - else - beta = sqrt((alpha - 2.) / (2. * a * b - alpha)); - gamma = a + 1. / beta; - - do { - /* Random generation for the Beta distribution based on - * R. C. H. Cheng (1978). Generating beta variates with nonintegral shape parameters. _Communications of the ACM_, *21*, 317-322. - * It is good for speed because it does not call math functions many times and respect the 4 given constraints - */ - U1 = custom_random(random->generator, &(random->seed)); - U2 = custom_random(random->generator, &(random->seed)); - - V = beta * log(U1 / (1 - U1)); - W = a * exp(V); - } while (alpha * log(alpha / (b + W)) + gamma * V - log(4) < - log(U1 * U1 * U2)); - - X = W / (b + W); - - return X * (random->max - random->min) + random->min; -} - -random_data_t random_new(e_random_generator_t generator, long int seed, - double min, double max, double mean, double std) -{ - random_data_t random = xbt_new0(s_random_data_t, 1); - - random->generator = generator; - random->seed = seed; - random->min = min; - random->max = max; - - /* Check user stupidities */ - if (max < min) - THROWF(arg_error, 0, "random->max < random->min (%f < %f)", max, min); - if (mean < min) - THROWF(arg_error, 0, "random->mean < random->min (%f < %f)", mean, - min); - if (mean > max) - THROWF(arg_error, 0, "random->mean > random->max (%f > %f)", mean, - max); - - /* normalize the mean and standard deviation before storing */ - random->mean = (mean - min) / (max - min); - random->std = std / (max - min); - - if (random->mean * (1 - random->mean) < random->std * random->std) - THROWF(arg_error, 0, "Invalid mean and standard deviation (%f and %f)", - random->mean, random->std); - - return random; -} diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index c21c67011f..16aa43f53e 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -114,9 +114,9 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id, return storage; } -double StorageN11Model::shareResources(double now) +double StorageN11Model::shareResources(double /*now*/) { - XBT_DEBUG("storage_share_resources %f", now); + XBT_DEBUG("storage_share_resources"); unsigned int i, j; Storage *storage; void *_write_action; diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index a6a183127a..2a86c80bb8 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -130,7 +130,7 @@ s_surf_model_description_t surf_storage_model_description[] = { {NULL, NULL, NULL} /* this array must be NULL terminated */ }; -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */ #endif @@ -373,7 +373,7 @@ void surf_exit(void) future_evt_set = nullptr; } -#ifdef CONTEXT_THREADS +#ifdef HAVE_THREAD_CONTEXTS xbt_parmap_destroy(surf_parmap); #endif diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 85fc8e0f98..e2cfb09c3a 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -73,7 +73,6 @@ enum heap_action_type{ *********/ /* For the trace and trace:connect tag (store their content till the end of the parsing) */ XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list; -XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail; XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_speed; XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail; XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_bw; diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index aaa141e1e1..b1600e508a 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -13,7 +13,6 @@ #include "surf/maxmin.h" #include "xbt/log.h" #include "surf/surfxml_parse.h" -#include "surf/random_mgr.h" #include "src/surf/trace_mgr.hpp" #include "src/instr/instr_private.h" #include "surf/surfxml_parse_values.h" diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 7ce56b2e88..033bcf454e 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -213,44 +213,6 @@ void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) xbt_dict_set(traces_set_list, trace->id, (void *) tmgr_trace, NULL); } -void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect) -{ - xbt_assert(xbt_dict_get_or_null(traces_set_list, trace_connect->trace), - "Cannot connect trace %s to %s: trace unknown", - trace_connect->trace, - trace_connect->element); - - switch (trace_connect->kind) { - case SURF_TRACE_CONNECT_KIND_HOST_AVAIL: - xbt_dict_set(trace_connect_list_host_avail, - trace_connect->trace, - xbt_strdup(trace_connect->element), NULL); - break; - case SURF_TRACE_CONNECT_KIND_POWER: - xbt_dict_set(trace_connect_list_host_speed, trace_connect->trace, - xbt_strdup(trace_connect->element), NULL); - break; - case SURF_TRACE_CONNECT_KIND_LINK_AVAIL: - xbt_dict_set(trace_connect_list_link_avail, - trace_connect->trace, - xbt_strdup(trace_connect->element), NULL); - break; - case SURF_TRACE_CONNECT_KIND_BANDWIDTH: - xbt_dict_set(trace_connect_list_link_bw, - trace_connect->trace, - xbt_strdup(trace_connect->element), NULL); - break; - case SURF_TRACE_CONNECT_KIND_LATENCY: - xbt_dict_set(trace_connect_list_link_lat, trace_connect->trace, - xbt_strdup(trace_connect->element), NULL); - break; - default: - surf_parse_error("Cannot connect trace %s to %s: kind of trace unknown", - trace_connect->trace, trace_connect->element); - break; - } -} - /** * \brief Make a new routing component to the platform * diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 50c47f4f7d..596a5b931a 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -13,10 +13,9 @@ #include "xbt/str.h" #include "xbt/file.h" #include "xbt/dict.h" -#include "surf/surfxml_parse.h" #include "src/surf/surf_private.h" -#include "surf/random_mgr.h" #include "simgrid/sg_config.h" +#include "surfxml_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module"); @@ -1062,32 +1061,10 @@ int_f_void_t surf_parse = _surf_parse; */ double parse_cpu_speed(const char *str_speed) -{ - double speed = 0.0; - const char *p, *q; - char *generator; - random_data_t random = NULL; - /* randomness is inserted like this: power="$rand(my_random)" */ - if (((p = strstr(str_speed, "$rand(")) != NULL) - && ((q = strstr(str_speed, ")")) != NULL)) { - if (p < q) { - generator = xbt_malloc(q - (p + 6) + 1); - memcpy(generator, p + 6, q - (p + 6)); - generator[q - (p + 6)] = '\0'; - random = xbt_dict_get_or_null(random_data_list, generator); - xbt_assert(random, "Random generator %s undefined", generator); - speed = random_generate(random); - } - } else { - speed = surf_parse_get_speed(str_speed); - } - return speed; +{ // FIXME deadcode + return surf_parse_get_speed(str_speed); } -double random_min, random_max, random_mean, random_std_deviation; -e_random_generator_t random_generator; -char *random_id; - xbt_dict_t get_as_router_properties(const char* name) { return xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL); diff --git a/src/surf/surfxml_parseplatf.cpp b/src/surf/surfxml_parseplatf.cpp index 7ab9cb914f..5a9ea0ea3a 100644 --- a/src/surf/surfxml_parseplatf.cpp +++ b/src/surf/surfxml_parseplatf.cpp @@ -9,9 +9,9 @@ #include "xbt/str.h" #include "xbt/dict.h" #include "simgrid/platf.h" -#include "surf/surfxml_parse.h" #include "src/surf/cpu_interface.hpp" #include "src/surf/surf_private.h" +#include "src/surf/surfxml_private.h" #ifdef HAVE_LUA extern "C" { @@ -70,6 +70,45 @@ xbt_dict_t trace_connect_list_link_avail = NULL; xbt_dict_t trace_connect_list_link_bw = NULL; xbt_dict_t trace_connect_list_link_lat = NULL; +void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect) +{ + xbt_assert(xbt_dict_get_or_null(traces_set_list, trace_connect->trace), + "Cannot connect trace %s to %s: trace unknown", + trace_connect->trace, + trace_connect->element); + + switch (trace_connect->kind) { + case SURF_TRACE_CONNECT_KIND_HOST_AVAIL: + xbt_dict_set(trace_connect_list_host_avail, + trace_connect->trace, + xbt_strdup(trace_connect->element), NULL); + break; + case SURF_TRACE_CONNECT_KIND_POWER: + xbt_dict_set(trace_connect_list_host_speed, trace_connect->trace, + xbt_strdup(trace_connect->element), NULL); + break; + case SURF_TRACE_CONNECT_KIND_LINK_AVAIL: + xbt_dict_set(trace_connect_list_link_avail, + trace_connect->trace, + xbt_strdup(trace_connect->element), NULL); + break; + case SURF_TRACE_CONNECT_KIND_BANDWIDTH: + xbt_dict_set(trace_connect_list_link_bw, + trace_connect->trace, + xbt_strdup(trace_connect->element), NULL); + break; + case SURF_TRACE_CONNECT_KIND_LATENCY: + xbt_dict_set(trace_connect_list_link_lat, trace_connect->trace, + xbt_strdup(trace_connect->element), NULL); + break; + default: + surf_parse_error("Cannot connect trace %s to %s: kind of trace unknown", + trace_connect->trace, trace_connect->element); + break; + } +} + + /* ***************************************** */ static int after_config_done; @@ -160,7 +199,6 @@ void parse_platform_file(const char *file) xbt_dict_free(&trace_connect_list_link_bw); xbt_dict_free(&trace_connect_list_link_lat); xbt_dict_free(&traces_set_list); - xbt_dict_free(&random_data_list); xbt_dynar_free(&surfxml_bufferstack_stack); surf_parse_close(); diff --git a/src/surf/surfxml_private.h b/src/surf/surfxml_private.h new file mode 100644 index 0000000000..dc69ca1e12 --- /dev/null +++ b/src/surf/surfxml_private.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2016. The SimGrid Team. All rights reserved. */ + +/* 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. */ + +#ifndef SRC_SURF_SURFXML_PRIVATE_H_ +#define SRC_SURF_SURFXML_PRIVATE_H_ + +#include "surf/surfxml_parse.h" + +SG_BEGIN_DECL() + +void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect); + +SG_END_DECL() + +#endif /* SRC_SURF_SURFXML_PRIVATE_H_ */ diff --git a/src/surf/trace_mgr.cpp b/src/surf/trace_mgr.cpp index 1b7b8fef77..cc0eeddd1e 100644 --- a/src/surf/trace_mgr.cpp +++ b/src/surf/trace_mgr.cpp @@ -25,7 +25,7 @@ simgrid::trace_mgr::future_evt_set::~future_evt_set() xbt_heap_free(p_heap); } - +#if 0 /* probabilistic dead code. Should be reimplemented, not killed (please) */ /** * \brief Create a #tmgr_trace_t from probabilist generators * @@ -239,6 +239,7 @@ double tmgr_event_generator_next_value(probabilist_event_generator_t generator) return generator->next_value; } +#endif /* probabilistic dead code */ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input, double periodicity) @@ -263,8 +264,7 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input, "Invalid periodicity %g (must be positive)", periodicity); trace = xbt_new0(s_tmgr_trace_t, 1); - trace->type = e_trace_list; - trace->s_list.event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL); + trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL); list = xbt_str_split(input, "\n\r"); @@ -292,11 +292,11 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input, s_tmgr_event_t first_event; first_event.delta=event.delta; first_event.value=-1.0; - xbt_dynar_push(trace->s_list.event_list, &first_event); + xbt_dynar_push(trace->event_list, &first_event); } } - xbt_dynar_push(trace->s_list.event_list, &event); - last_event = (tmgr_event_t)xbt_dynar_get_ptr(trace->s_list.event_list, xbt_dynar_length(trace->s_list.event_list) - 1); + xbt_dynar_push(trace->event_list, &event); + last_event = (tmgr_event_t)xbt_dynar_get_ptr(trace->event_list, xbt_dynar_length(trace->event_list) - 1); } if (last_event) last_event->delta = periodicity; @@ -343,12 +343,11 @@ tmgr_trace_t tmgr_empty_trace_new(void) s_tmgr_event_t event; trace = xbt_new0(s_tmgr_trace_t, 1); - trace->type = e_trace_list; - trace->s_list.event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL); + trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL); event.delta = 0.0; event.value = 0.0; - xbt_dynar_push(trace->s_list.event_list, &event); + xbt_dynar_push(trace->event_list, &event); return trace; } @@ -358,14 +357,7 @@ void tmgr_trace_free(tmgr_trace_t trace) if (!trace) return; - switch(trace->type) { - case e_trace_list: - xbt_dynar_free(&(trace->s_list.event_list)); - break; - case e_trace_probabilist: - THROW_UNIMPLEMENTED; - break; - } + xbt_dynar_free(&(trace->event_list)); free(trace); } @@ -380,10 +372,8 @@ tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::add_trace( trace_iterator->idx = 0; trace_iterator->resource = resource; - if(trace->type == e_trace_list) { - xbt_assert((trace_iterator->idx < xbt_dynar_length(trace->s_list.event_list)), - "You're referring to an event that does not exist!"); - } + xbt_assert((trace_iterator->idx < xbt_dynar_length(trace->event_list)), + "Your trace should have at least one event!"); xbt_heap_push(p_heap, trace_iterator, start_time); @@ -414,42 +404,19 @@ tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::pop_leq( tmgr_trace_t trace = trace_iterator->trace; *resource = trace_iterator->resource; - if (trace->type == e_trace_list) { - - tmgr_event_t event = (tmgr_event_t)xbt_dynar_get_ptr(trace->s_list.event_list, trace_iterator->idx); + tmgr_event_t event = (tmgr_event_t)xbt_dynar_get_ptr(trace->event_list, trace_iterator->idx); - *value = event->value; + *value = event->value; - if (trace_iterator->idx < xbt_dynar_length(trace->s_list.event_list) - 1) { - xbt_heap_push(p_heap, trace_iterator, event_date + event->delta); - trace_iterator->idx++; - } else if (event->delta > 0) { /* Last element, checking for periodicity */ - xbt_heap_push(p_heap, trace_iterator, event_date + event->delta); - trace_iterator->idx = 1; /* not 0 as the first event is a placeholder to handle when events really start */ - } else { /* We don't need this trace_event anymore */ - trace_iterator->free_me = 1; - } - - } else if (trace->type == e_trace_probabilist) { //FIXME : not tested yet - double event_delta; - if(trace->s_probabilist.is_state_trace) { - *value = (double) trace->s_probabilist.next_event; - if(trace->s_probabilist.next_event == 0) { - event_delta = tmgr_event_generator_next_value(trace->s_probabilist.event_generator[0]); - trace->s_probabilist.next_event = 1; - } else { - event_delta = tmgr_event_generator_next_value(trace->s_probabilist.event_generator[1]); - trace->s_probabilist.next_event = 0; - } - } else { - event_delta = tmgr_event_generator_next_value(trace->s_probabilist.event_generator[0]); - *value = tmgr_event_generator_next_value(trace->s_probabilist.event_generator[1]); - } - xbt_heap_push(p_heap, trace_iterator, event_date + event_delta); - XBT_DEBUG("Generating a new event at date %f, with value %f", event_date + event_delta, *value); - - } else - THROW_IMPOSSIBLE; + if (trace_iterator->idx < xbt_dynar_length(trace->event_list) - 1) { + xbt_heap_push(p_heap, trace_iterator, event_date + event->delta); + trace_iterator->idx++; + } else if (event->delta > 0) { /* Last element, checking for periodicity */ + xbt_heap_push(p_heap, trace_iterator, event_date + event->delta); + trace_iterator->idx = 1; /* not 0 as the first event is a placeholder to handle when events really start */ + } else { /* We don't need this trace_event anymore */ + trace_iterator->free_me = 1; + } return trace_iterator; } diff --git a/src/surf/trace_mgr.hpp b/src/surf/trace_mgr.hpp index ee06f3b5f0..a53be9e9bd 100644 --- a/src/surf/trace_mgr.hpp +++ b/src/surf/trace_mgr.hpp @@ -54,17 +54,7 @@ typedef struct probabilist_event_generator { } s_probabilist_event_generator_t; typedef struct tmgr_trace { - enum e_trace_type type; - union { - struct { - xbt_dynar_t event_list; - } s_list; - struct { - probabilist_event_generator_t event_generator[2]; - int is_state_trace; - int next_event; - } s_probabilist; - }; + xbt_dynar_t event_list; } s_tmgr_trace_t; /* Iterator within a trace */ @@ -95,9 +85,33 @@ SG_END_DECL() #ifdef __cplusplus namespace simgrid { +/** @brief Modeling of the resource variations, such as those due to an external load + * + * There is 3 main concepts in this module: + * - #trace: a set of dated values, ie a list of pair + * - #trace_iterator: links a given trace to a given simgrid resource. A Cpu for example has 2 iterators: state (ie, is it ON/OFF) and speed, while a link has 3 iterators: state, bandwidth and latency. + * - #future_evt_set: makes it easy to find the next occuring event of all traces + */ namespace trace_mgr { -/* Future Event Set (collection of iterators over the traces) +/** @brief A trace_iterator links a trace to a resource */ +XBT_PUBLIC_CLASS trace_iterator { + +}; + +/** @brief A trace is a set of timed values, encoding the value that a variable takes at what time * + * + * It is useful to model dynamic platforms, where an external load that makes the resource availability change over time. + * To model that, you have to set several traces per resource: one for the on/off state and one for each numerical value (computational speed, bandwidt and latency). + */ +XBT_PUBLIC_CLASS trace { +public: + /** Creates an empty trace */ + trace() {} + virtual ~trace() {} +}; + +/** @brief Future Event Set (collection of iterators over the traces) * That's useful to quickly know which is the next occurring event in a set of traces. */ XBT_PUBLIC_CLASS future_evt_set { public: diff --git a/src/xbt/config.c b/src/xbt/config.c index 0798011d21..642a6a9df0 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -212,8 +212,7 @@ void xbt_cfgelm_free(void *data) * @param cb_rm callback function called when a value is removed */ -void -xbt_cfg_register(xbt_cfg_t * cfg, +void xbt_cfg_register(xbt_cfg_t * cfg, const char *name, const char *desc, e_xbt_cfgelm_type_t type, int min, int max, xbt_cfg_cb_t cb_set, xbt_cfg_cb_t cb_rm) @@ -465,7 +464,8 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, if (!res) { xbt_cfg_help(cfg); THROWF(not_found_error, 0, - "No registered variable '%s' in this config set", name); + "No registered variable '%s' in this config set. It is possible that this "\ + "configuration option has been renamed; please read the file ChangeLog carefully!", name); } xbt_assert(type == xbt_cfgelm_any || res->type == type, diff --git a/src/xbt/log.c b/src/xbt/log.c index 6592d41e0e..d1ff4f4047 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -695,8 +695,6 @@ static void xbt_log_connect_categories(void) /* surf */ XBT_LOG_CONNECT(surf); - XBT_LOG_CONNECT(platf_generator); - XBT_LOG_CONNECT(random); XBT_LOG_CONNECT(surf_config); XBT_LOG_CONNECT(surf_cpu); XBT_LOG_CONNECT(surf_cpu_cas); diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 9c718dfdb8..7c6795f3b7 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -90,7 +90,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, static void xbt_preinit(void) { unsigned int seed = 2147483647; -#ifndef WIN32 +#ifndef _XBT_WIN32 xbt_pagesize = sysconf(_SC_PAGESIZE); #else SYSTEM_INFO si; @@ -115,7 +115,7 @@ static void xbt_preinit(void) { xbt_dict_preinit(); srand(seed); -#ifndef _WIN32 +#ifndef _XBT_WIN32 srand48(seed); #endif atexit(xbt_postexit); diff --git a/src/xbt/xbt_os_synchro.c b/src/xbt/xbt_os_synchro.c index db8e2acbde..fd52a4deae 100644 --- a/src/xbt/xbt_os_synchro.c +++ b/src/xbt/xbt_os_synchro.c @@ -45,7 +45,7 @@ void xbt_mutex_release(xbt_mutex_t mutex) void xbt_mutex_destroy(xbt_mutex_t mutex) { - simcall_mutex_destroy((smx_mutex_t) mutex); + SIMIX_mutex_destroy((smx_mutex_t) mutex); } /***** condition related functions *****/ @@ -80,7 +80,7 @@ void xbt_cond_broadcast(xbt_cond_t cond) void xbt_cond_destroy(xbt_cond_t cond) { - simcall_cond_destroy((smx_cond_t) cond); + SIMIX_cond_destroy((smx_cond_t) cond); } /***** barrier related functions *****/ diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index f7ed95eced..095a28c435 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -1,6 +1,6 @@ /* xbt_os_thread -- portability layer over the pthread API */ /* Used in RL to get win/lin portability, and in SG when CONTEXT_THREAD */ -/* in SG, when using CONTEXT_UCONTEXT, xbt_os_thread_stub is used instead */ +/* in SG, when using HAVE_UCONTEXT_CONTEXTS, xbt_os_thread_stub is used instead */ /* Copyright (c) 2007-2015. The SimGrid Team. * All rights reserved. */ @@ -291,14 +291,10 @@ void xbt_os_thread_exit(int *retval) xbt_os_thread_t xbt_os_thread_self(void) { - xbt_os_thread_t res; - if (!thread_mod_inited) return NULL; - res = pthread_getspecific(xbt_self_thread_key); - - return res; + return pthread_getspecific(xbt_self_thread_key); } void xbt_os_thread_key_create(xbt_os_thread_key_t* key) { @@ -1303,8 +1299,7 @@ void xbt_os_thread_set_extra_data(void *data) void *xbt_os_thread_get_extra_data(void) { - xbt_os_thread_t self = xbt_os_thread_self(); - return self? self->extra_data : NULL; + return xbt_os_thread_self()->extra_data; } xbt_os_rmutex_t xbt_os_rmutex_init(void) diff --git a/src/xbt/xbt_sg_stubs.c b/src/xbt/xbt_sg_stubs.c index 5935010c94..cfb2feac2b 100644 --- a/src/xbt/xbt_sg_stubs.c +++ b/src/xbt/xbt_sg_stubs.c @@ -18,9 +18,9 @@ #include "src/xbt_modinter.h" #include "xbt/sysdep.h" #include "xbt/xbt_os_thread.h" -#include "src/portable.h" /* CONTEXT_THREADS */ +#include "src/portable.h" /* HAVE_THREAD_CONTEXTS */ -#ifndef CONTEXT_THREADS +#ifndef HAVE_THREAD_CONTEXTS #ifndef WIN32 #ifdef HAVE_PTHREAD /* xbt_threads is loaded in libsimgrid when they are used to implement the xbt_context. diff --git a/teshsuite/java/semaphore/CMakeLists.txt b/teshsuite/java/semaphore/CMakeLists.txt new file mode 100644 index 0000000000..e86706b7f8 --- /dev/null +++ b/teshsuite/java/semaphore/CMakeLists.txt @@ -0,0 +1,40 @@ +set(example java_semaphore_gc) +set(sources + ${CMAKE_CURRENT_SOURCE_DIR}/SemaphoreGC.java + ) + +if(enable_java) + add_custom_command( + COMMENT "Building ${example}..." + OUTPUT ${example}_compiled + DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR} + COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} + -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources} + COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled + COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled + ) + add_custom_target(${example} ALL DEPENDS ${example}_compiled) +endif() + +set(tesh_files + ${tesh_files} + ${CMAKE_CURRENT_SOURCE_DIR}/semaphore_gc.tesh + PARENT_SCOPE + ) +set(xml_files + ${xml_files} + PARENT_SCOPE + ) +set(examples_src + ${examples_src} + ${sources} + PARENT_SCOPE + ) +set(bin_files + ${bin_files} + PARENT_SCOPE + ) +set(txt_files + ${txt_files} + PARENT_SCOPE + ) diff --git a/teshsuite/java/semaphore/SemaphoreGC.java b/teshsuite/java/semaphore/SemaphoreGC.java new file mode 100644 index 0000000000..ec1b6aaf6e --- /dev/null +++ b/teshsuite/java/semaphore/SemaphoreGC.java @@ -0,0 +1,56 @@ +/* Copyright (c) 2016. The SimGrid Team. All rights reserved. */ + +/* 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. */ + +/* This test ensures that the used semaphores are not garbage-collected while we still use it. + * This was reported as bug #19893 on gforge. + */ + +package semaphore; + +import org.simgrid.msg.*; +import org.simgrid.msg.Process; +import org.simgrid.trace.Trace; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +class SemCreator extends Process { + Semaphore sem; + + SemCreator(Host h, String n){ + super(h, n); + } + + public void main(String[] args) throws MsgException{ + int j; + Msg.info("Creating 50 new Semaphores, yielding and triggering a GC after each"); + for(j = 1; j <= 50; j++) { + sem = new Semaphore(0); + waitFor(10); + System.gc(); + } + Msg.info("It worked, we survived. The test is passed."); + } +} + + +public class SemaphoreGC { + public static void main(String[] args) throws Exception { + + Msg.init(args); + if (args.length < 1) { + Msg.info("Usage: java -cp simgrid.jar:. semaphore.SemaphoreGC "); + System.exit(1); + } + Msg.createEnvironment(args[0]); + + Host[] hosts = Host.all(); + new SemCreator(hosts[0], "SemCreator").start(); + + Msg.run(); + } + +} diff --git a/teshsuite/java/semaphore/semaphore_gc.tesh b/teshsuite/java/semaphore/semaphore_gc.tesh new file mode 100644 index 0000000000..f55f053ddc --- /dev/null +++ b/teshsuite/java/semaphore/semaphore_gc.tesh @@ -0,0 +1,5 @@ +$ java -classpath ${classpath:=.} semaphore.SemaphoreGC ${srcdir:=.}/../../examples/platforms/small_platform.xml "--log=root.fmt:[%10.4r]%e(%i:%P@%h)%e%m%n" +> [ 0.0000] (0:maestro@) Using regular java threads. +> [ 0.0000] (1:SemCreator@Fafard) Creating 50 new Semaphores, yielding and triggering a GC after each +> [ 1500.0000] (1:SemCreator@Fafard) It worked, we survived. The test is passed. +> [ 1500.0000] (0:maestro@) MSG_main finished; Cleaning up the simulation... diff --git a/teshsuite/java/sleep_host_off/CMakeLists.txt b/teshsuite/java/sleep_host_off/CMakeLists.txt index 18c2174534..90ba170b7e 100644 --- a/teshsuite/java/sleep_host_off/CMakeLists.txt +++ b/teshsuite/java/sleep_host_off/CMakeLists.txt @@ -1,6 +1,5 @@ set(example java_sleep_host_off) set(sources - ${CMAKE_CURRENT_SOURCE_DIR}/Main.java ${CMAKE_CURRENT_SOURCE_DIR}/SleepHostOff.java ) diff --git a/teshsuite/java/sleep_host_off/Main.java b/teshsuite/java/sleep_host_off/Main.java deleted file mode 100644 index 3cc4cea056..0000000000 --- a/teshsuite/java/sleep_host_off/Main.java +++ /dev/null @@ -1,30 +0,0 @@ -package sleep_host_off; - -import org.simgrid.msg.Host; -import org.simgrid.msg.HostNotFoundException; -import org.simgrid.msg.Msg; -import org.simgrid.msg.NativeException; - -public class Main { - - public static void main(String[] args) throws NativeException { - /* Init. internal values */ - Msg.init(args); - - if (args.length < 2) { - Msg.info("Usage : Main platform_file.xml dployment_file.xml"); - System.exit(1); - } - - /* construct the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - - try { - Msg.run(); - } catch (Exception e){ - System.out.println("Bye bye the program crashes !"); - } - - } -} diff --git a/teshsuite/java/sleep_host_off/SleepHostOff.java b/teshsuite/java/sleep_host_off/SleepHostOff.java index 1d60cad739..cebf7afe77 100644 --- a/teshsuite/java/sleep_host_off/SleepHostOff.java +++ b/teshsuite/java/sleep_host_off/SleepHostOff.java @@ -14,42 +14,63 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -public class SleepHostOff extends Process{ - public static Host jupiter = null; - - public SleepHostOff(Host host, String name, String[]args) { - super(host,name,args); - } - - public void main(String[] strings) throws MsgException { - - try { - jupiter = Host.getByName("Jupiter"); - } catch (HostNotFoundException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - - Msg.info("**** **** **** ***** ***** Test Sleep ***** ***** **** **** ****"); - Msg.info("Test sleep: Create a process on Jupiter, the process simply make periodic sleep, turn off Jupiter"); - new Process(jupiter, "sleep", null) { - public void main(String[] args) { - while (true) { - Msg.info("I'm not dead"); - try { - Process.sleep(10); - } catch (HostFailureException e) { - Msg.info("catch HostException: "+e.getLocalizedMessage()); - break; //Break is needed to finalize the endless loop - } - } - } - }.start(); - - Process.sleep(20); - Msg.info("Stop Jupiter"); - jupiter.off(); - Msg.info("Jupiter has been stopped"); - Process.sleep(300); - Msg.info("Test sleep seems ok, cool !(number of Process : " + Process.getCount() + ", it should be 1 (i.e. the Test one))\n"); - } +class Sleeper extends Process { + public Sleeper(Host host, String name, String[] args) { + super(host,name,args); + } + public void main(String[] args) { + while (true) { + Msg.info("I'm not dead"); + try { + Process.sleep(10); + } catch (HostFailureException e) { + Msg.info("catch HostException: "+e.getLocalizedMessage()); + break; //Break is needed to finalize the endless loop + } + } + } +} + +class TestRunner extends Process { + + public TestRunner(Host host, String name, String[] args) { + super(host,name,args); + } + + public void main(String[] strings) throws MsgException { + Host host = Host.all()[1]; + + + Msg.info("**** **** **** ***** ***** Test Sleep ***** ***** **** **** ****"); + Msg.info("Test sleep: Create a process on "+host.getName()+" that simply make periodic sleep, turn off "+host.getName()); + new Sleeper(host, "Sleeper", null).start(); + + waitFor(0.02); + Msg.info("Stop "+host.getName()); + host.off(); + Msg.info(host.getName()+" has been stopped"); + waitFor(0.3); + Msg.info("Test sleep seems ok, cool! (number of Process : " + Process.getCount() + ", it should be 1 (i.e. the Test one))"); + } +} + +public class SleepHostOff { + + public static void main(String[] args) throws Exception { + /* Init. internal values */ + Msg.init(args); + + if (args.length < 1) { + Msg.info("Usage: java -cp simgrid.jar:. sleep_host_off.SleepHostOff "); + System.exit(1); + } + + /* construct the platform and deploy the application */ + Msg.createEnvironment(args[0]); + + Host[] hosts = Host.all(); + new TestRunner(hosts[0], "TestRunner", null).start(); + + Msg.run(); + } } diff --git a/teshsuite/java/sleep_host_off/sleep_host_off.tesh b/teshsuite/java/sleep_host_off/sleep_host_off.tesh index 5e77e1749f..c371d7fb40 100644 --- a/teshsuite/java/sleep_host_off/sleep_host_off.tesh +++ b/teshsuite/java/sleep_host_off/sleep_host_off.tesh @@ -1,13 +1,12 @@ -$ java -classpath ${classpath:=.} sleep_host_off.Main ${srcdir:=.}/../../examples/platforms/small_platform.xml ${srcdir:=.}/sleep_host_off/sleep_host_off_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +$ java -classpath ${classpath:=.} sleep_host_off.SleepHostOff ${srcdir:=.}/../../examples/platforms/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (0:maestro@) Using regular java threads. -> [ 0.000000] (1:sleep_host_off.SleepHostOff@Tremblay) **** **** **** ***** ***** Test Sleep ***** ***** **** **** **** -> [ 0.000000] (1:sleep_host_off.SleepHostOff@Tremblay) Test sleep: Create a process on Jupiter, the process simply make periodic sleep, turn off Jupiter -> [ 0.000000] (2:sleep@Jupiter) I'm not dead -> [ 0.010000] (2:sleep@Jupiter) I'm not dead -> [ 0.020000] (1:sleep_host_off.SleepHostOff@Tremblay) Stop Jupiter -> [ 0.020000] (2:sleep@Jupiter) I'm not dead -> [ 0.020000] (2:sleep@Jupiter) catch HostException: Host Failure (null) -> [ 0.020000] (1:sleep_host_off.SleepHostOff@Tremblay) Jupiter has been stopped -> [ 0.320000] (1:sleep_host_off.SleepHostOff@Tremblay) Test sleep seems ok, cool !(number of Process : 1, it should be 1 (i.e. the Test one)) -> +> [ 0.000000] (1:TestRunner@Fafard) **** **** **** ***** ***** Test Sleep ***** ***** **** **** **** +> [ 0.000000] (1:TestRunner@Fafard) Test sleep: Create a process on Tremblay that simply make periodic sleep, turn off Tremblay +> [ 0.000000] (2:Sleeper@Tremblay) I'm not dead +> [ 0.010000] (2:Sleeper@Tremblay) I'm not dead +> [ 0.020000] (1:TestRunner@Fafard) Stop Tremblay +> [ 0.020000] (2:Sleeper@Tremblay) I'm not dead +> [ 0.020000] (2:Sleeper@Tremblay) catch HostException: Host Failure (null) +> [ 0.020000] (1:TestRunner@Fafard) Tremblay has been stopped +> [ 0.320000] (1:TestRunner@Fafard) Test sleep seems ok, cool! (number of Process : 1, it should be 1 (i.e. the Test one)) > [ 0.320000] (0:maestro@) MSG_main finished; Cleaning up the simulation... diff --git a/teshsuite/smpi/mpich3-test/coll/allgatherv4.c b/teshsuite/smpi/mpich3-test/coll/allgatherv4.c index 2af91af50e..39ad8560ee 100644 --- a/teshsuite/smpi/mpich3-test/coll/allgatherv4.c +++ b/teshsuite/smpi/mpich3-test/coll/allgatherv4.c @@ -4,10 +4,8 @@ * (C) 2003 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ - #include "mpi.h" #include "mpitest.h" -#include "smpi_cocci.h" #include #include #ifdef HAVE_SYS_TIME_H @@ -16,25 +14,17 @@ #include #include #include - /* FIXME: What is this test supposed to accomplish? */ - #define START_BUF (1) #define LARGE_BUF (256 * 1024) - /* FIXME: MAX_BUF is too large */ #define MAX_BUF (32 * 1024 * 1024) #define LOOPS 10 - -SMPI_VARINIT_GLOBAL(sbuf, char*); -SMPI_VARINIT_GLOBAL(rbuf, char*); -SMPI_VARINIT_GLOBAL(recvcounts, int*); -SMPI_VARINIT_GLOBAL(displs, int*); -SMPI_VARINIT_GLOBAL_AND_SET(errs, int, 0); - +char *sbuf, *rbuf; +int *recvcounts, *displs; +int errs = 0; /* #define dprintf printf */ #define dprintf(...) - typedef enum { REGULAR, BCAST, @@ -43,46 +33,43 @@ typedef enum { LINEAR_DECREASE, BELL_CURVE } test_t; - void comm_tests(MPI_Comm comm); -double run_test(long long msg_size, MPI_Comm comm, test_t test_type, double * max_time); - -int main(int argc, char ** argv) +double run_test(long long msg_size, MPI_Comm comm, test_t test_type, double *max_time); +int main(int argc, char **argv) { int comm_size, comm_rank; MPI_Comm comm; - MTest_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &comm_size); MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank); - + if (comm_size < 3) { + fprintf(stderr, "At least 3 processes required\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } if (LARGE_BUF * comm_size > MAX_BUF) goto fn_exit; - - SMPI_VARGET_GLOBAL(sbuf) = (void *) calloc(MAX_BUF, 1); - SMPI_VARGET_GLOBAL(rbuf) = (void *) calloc(MAX_BUF, 1); - + sbuf = (void *) calloc(MAX_BUF, 1); + rbuf = (void *) calloc(MAX_BUF, 1); srand(time(NULL)); - - SMPI_VARGET_GLOBAL(recvcounts) = (void *) malloc(comm_size * sizeof(int)); - SMPI_VARGET_GLOBAL(displs) = (void *) malloc(comm_size * sizeof(int)); - if (!SMPI_VARGET_GLOBAL(recvcounts) || !SMPI_VARGET_GLOBAL(displs) || !SMPI_VARGET_GLOBAL(sbuf) || !SMPI_VARGET_GLOBAL(rbuf)) { + recvcounts = (void *) malloc(comm_size * sizeof(int)); + displs = (void *) malloc(comm_size * sizeof(int)); + if (!recvcounts || !displs || !sbuf || !rbuf) { fprintf(stderr, "Unable to allocate memory:\n"); - if (!SMPI_VARGET_GLOBAL(sbuf)) fprintf(stderr,"\tsbuf of %d bytes\n", MAX_BUF ); - if (!SMPI_VARGET_GLOBAL(rbuf)) fprintf(stderr,"\trbuf of %d bytes\n", MAX_BUF ); - if (!SMPI_VARGET_GLOBAL(recvcounts)) fprintf(stderr,"\trecvcounts of %zd bytes\n", comm_size * sizeof(int) ); - if (!SMPI_VARGET_GLOBAL(displs)) fprintf(stderr,"\tdispls of %zd bytes\n", comm_size * sizeof(int) ); + if (!sbuf) + fprintf(stderr, "\tsbuf of %d bytes\n", MAX_BUF); + if (!rbuf) + fprintf(stderr, "\trbuf of %d bytes\n", MAX_BUF); + if (!recvcounts) + fprintf(stderr, "\trecvcounts of %zd bytes\n", comm_size * sizeof(int)); + if (!displs) + fprintf(stderr, "\tdispls of %zd bytes\n", comm_size * sizeof(int)); fflush(stderr); MPI_Abort(MPI_COMM_WORLD, -1); - exit(-1); } - if (!comm_rank) { dprintf("Message Range: (%d, %d); System size: %d\n", START_BUF, LARGE_BUF, comm_size); fflush(stdout); } - - /* COMM_WORLD tests */ if (!comm_rank) { dprintf("\n\n==========================================================\n"); @@ -90,7 +77,6 @@ int main(int argc, char ** argv) dprintf("==========================================================\n"); } comm_tests(MPI_COMM_WORLD); - /* non-COMM_WORLD tests */ if (!comm_rank) { dprintf("\n\n==========================================================\n"); @@ -101,7 +87,6 @@ int main(int argc, char ** argv) if (comm_rank < comm_size - 1) comm_tests(comm); MPI_Comm_free(&comm); - /* Randomized communicator tests */ if (!comm_rank) { dprintf("\n\n==========================================================\n"); @@ -111,65 +96,53 @@ int main(int argc, char ** argv) MPI_Comm_split(MPI_COMM_WORLD, 0, rand(), &comm); comm_tests(comm); MPI_Comm_free(&comm); - - free(SMPI_VARGET_GLOBAL(sbuf)); - free(SMPI_VARGET_GLOBAL(rbuf)); - free(SMPI_VARGET_GLOBAL(recvcounts)); - free(SMPI_VARGET_GLOBAL(displs)); - -fn_exit: - MTest_Finalize(SMPI_VARGET_GLOBAL(errs)); + free(sbuf); + free(rbuf); + free(recvcounts); + free(displs); + fn_exit: + MTest_Finalize(errs); MPI_Finalize(); - return 0; } - void comm_tests(MPI_Comm comm) { int comm_size, comm_rank; double rtime = rtime; /* stop warning about unused variable */ double max_time; long long msg_size; - MPI_Comm_size(comm, &comm_size); MPI_Comm_rank(comm, &comm_rank); - for (msg_size = START_BUF; msg_size <= LARGE_BUF; msg_size *= 2) { if (!comm_rank) { dprintf("\n====> MSG_SIZE: %d\n", (int) msg_size); fflush(stdout); } - rtime = run_test(msg_size, comm, REGULAR, &max_time); if (!comm_rank) { dprintf("REGULAR:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); fflush(stdout); } - rtime = run_test(msg_size, comm, BCAST, &max_time); if (!comm_rank) { dprintf("BCAST:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); fflush(stdout); } - rtime = run_test(msg_size, comm, SPIKE, &max_time); if (!comm_rank) { dprintf("SPIKE:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); fflush(stdout); } - rtime = run_test(msg_size, comm, HALF_FULL, &max_time); if (!comm_rank) { dprintf("HALF_FULL:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); fflush(stdout); } - rtime = run_test(msg_size, comm, LINEAR_DECREASE, &max_time); if (!comm_rank) { dprintf("LINEAR_DECREASE:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); fflush(stdout); } - rtime = run_test(msg_size, comm, BELL_CURVE, &max_time); if (!comm_rank) { dprintf("BELL_CURVE:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); @@ -177,75 +150,67 @@ void comm_tests(MPI_Comm comm) } } } - -double run_test(long long msg_size, MPI_Comm comm, test_t test_type, - double * max_time) +double run_test(long long msg_size, MPI_Comm comm, test_t test_type, double *max_time) { int i, j; int comm_size, comm_rank; double start, end; double total_time, avg_time; MPI_Aint tmp; - MPI_Comm_size(comm, &comm_size); MPI_Comm_rank(comm, &comm_rank); - - SMPI_VARGET_GLOBAL(displs)[0] = 0; + displs[0] = 0; for (i = 0; i < comm_size; i++) { if (test_type == REGULAR) - SMPI_VARGET_GLOBAL(recvcounts)[i] = msg_size; + recvcounts[i] = msg_size; else if (test_type == BCAST) - SMPI_VARGET_GLOBAL(recvcounts)[i] = (!i) ? msg_size : 0; + recvcounts[i] = (!i) ? msg_size : 0; else if (test_type == SPIKE) - SMPI_VARGET_GLOBAL(recvcounts)[i] = (!i) ? (msg_size / 2) : (msg_size / (2 * (comm_size - 1))); + recvcounts[i] = (!i) ? (msg_size / 2) : (msg_size / (2 * (comm_size - 1))); else if (test_type == HALF_FULL) - SMPI_VARGET_GLOBAL(recvcounts)[i] = (i < (comm_size / 2)) ? (2 * msg_size) : 0; + recvcounts[i] = (i < (comm_size / 2)) ? (2 * msg_size) : 0; else if (test_type == LINEAR_DECREASE) { tmp = 2 * msg_size * (comm_size - 1 - i) / (comm_size - 1); - if (tmp != (int)tmp) { - fprintf( stderr, "Integer overflow in variable tmp\n" ); - MPI_Abort( MPI_COMM_WORLD, 1 ); - exit(1); - } - SMPI_VARGET_GLOBAL(recvcounts)[i] = (int) tmp; - + if (tmp != (int) tmp) { + fprintf(stderr, "Integer overflow in variable tmp\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + recvcounts[i] = (int) tmp; /* If the maximum message size is too large, don't run */ - if (tmp > MAX_BUF) return 0; + if (tmp > MAX_BUF) + return 0; } else if (test_type == BELL_CURVE) { for (j = 0; j < i; j++) { - if (i - 1 + j >= comm_size) continue; + if (i - 1 + j >= comm_size) + continue; tmp = msg_size * comm_size / (log(comm_size) * i); - SMPI_VARGET_GLOBAL(recvcounts)[i - 1 + j] = (int) tmp; - SMPI_VARGET_GLOBAL(displs)[i - 1 + j] = 0; - + recvcounts[i - 1 + j] = (int) tmp; + displs[i - 1 + j] = 0; /* If the maximum message size is too large, don't run */ - if (tmp > MAX_BUF) return 0; + if (tmp > MAX_BUF) + return 0; } } - if (i < comm_size - 1) - SMPI_VARGET_GLOBAL(displs)[i+1] = SMPI_VARGET_GLOBAL(displs)[i] + SMPI_VARGET_GLOBAL(recvcounts)[i]; + displs[i + 1] = displs[i] + recvcounts[i]; } - /* Test that: - 1: sbuf is large enough - 2: rbuf is large enough - 3: There were no failures (e.g., tmp nowhere > rbuf size - */ + * 1: sbuf is large enough + * 2: rbuf is large enough + * 3: There were no failures (e.g., tmp nowhere > rbuf size + */ MPI_Barrier(comm); start = MPI_Wtime(); for (i = 0; i < LOOPS; i++) { - MPI_Allgatherv(SMPI_VARGET_GLOBAL(sbuf), SMPI_VARGET_GLOBAL(recvcounts)[comm_rank], MPI_CHAR, - SMPI_VARGET_GLOBAL(rbuf), SMPI_VARGET_GLOBAL(recvcounts), SMPI_VARGET_GLOBAL(displs), MPI_CHAR, comm); + MPI_Allgatherv(sbuf, recvcounts[comm_rank], MPI_CHAR, + rbuf, recvcounts, displs, MPI_CHAR, comm); } end = MPI_Wtime(); MPI_Barrier(comm); - /* Convert to microseconds (why?) */ total_time = 1.0e6 * (end - start); MPI_Reduce(&total_time, &avg_time, 1, MPI_DOUBLE, MPI_SUM, 0, comm); MPI_Reduce(&total_time, max_time, 1, MPI_DOUBLE, MPI_MAX, 0, comm); - return (avg_time / (LOOPS * comm_size)); } diff --git a/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c b/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c index 60bf0a4ebe..4249a92524 100644 --- a/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c +++ b/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c @@ -7,7 +7,6 @@ #include "mpi.h" #include "mpitest.h" -#include "smpi_cocci.h" #include #include #ifdef HAVE_SYS_TIME_H diff --git a/teshsuite/smpi/mpich3-test/coll/allred.c b/teshsuite/smpi/mpich3-test/coll/allred.c index bf13e8aa55..3caf57ec81 100644 --- a/teshsuite/smpi/mpich3-test/coll/allred.c +++ b/teshsuite/smpi/mpich3-test/coll/allred.c @@ -10,7 +10,6 @@ #include "mpi.h" #include "mpitest.h" -#include "smpi_cocci.h" #include #include #include diff --git a/teshsuite/smpi/mpich3-test/util/mtest_manual.c b/teshsuite/smpi/mpich3-test/util/mtest_manual.c index e922072ddf..e0813e7671 100644 --- a/teshsuite/smpi/mpich3-test/util/mtest_manual.c +++ b/teshsuite/smpi/mpich3-test/util/mtest_manual.c @@ -7,7 +7,6 @@ #include "mpi.h" #include "mpitestconf.h" #include "mpitest.h" -#include "smpi_cocci.h" #if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) #include #endif diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index ee75b3d125..d7e8133d44 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -13,7 +13,6 @@ set(EXTRA_DIST src/include/smpi/smpi_interface.h src/include/surf/datatypes.h src/include/surf/maxmin.h - src/include/surf/random_mgr.h src/include/surf/surf.h src/include/surf/surfxml_parse_values.h src/include/xbt/win32_ucontext.h @@ -61,7 +60,6 @@ set(EXTRA_DIST src/surf/ns3/ns3_interface.h src/surf/ns3/ns3_simulator.h src/surf/ns3/red-queue.h - src/surf/platf_generator_private.h src/surf/platform.hpp src/surf/plugins/energy.hpp src/surf/simgrid.dtd @@ -322,10 +320,8 @@ set(SURF_SRC src/surf/network_interface.cpp src/surf/network_smpi.cpp src/surf/network_ib.cpp - src/surf/platf_generator.c src/surf/plugins/energy.cpp src/surf/PropertyHolder.cpp - src/surf/random_mgr.c src/surf/sg_platf.cpp src/surf/storage_interface.cpp src/surf/storage_n11.cpp @@ -341,6 +337,7 @@ set(SURF_SRC src/surf/surf_routing_generic.cpp src/surf/surf_routing_none.cpp src/surf/surf_routing_vivaldi.cpp + src/surf/surfxml_private.h src/surf/surfxml_parse.c src/surf/surfxml_parseplatf.cpp src/surf/trace_mgr.hpp @@ -386,7 +383,7 @@ else() endif() # Boost context may not be available -if (HAVE_BOOST_CONTEXT) +if (HAVE_BOOST_CONTEXTS) set(SIMIX_SRC ${SIMIX_SRC} src/simix/BoostContext.hpp @@ -551,10 +548,10 @@ set(JEDULE_SRC include/simgrid/jedule/jedule_output.h include/simgrid/jedule/jedule_platform.h include/simgrid/jedule/jedule_sd_binding.h - src/instr/jedule/jedule_events.c - src/instr/jedule/jedule_output.c - src/instr/jedule/jedule_platform.c - src/instr/jedule/jedule_sd_binding.c + src/instr/jedule/jedule_events.cpp + src/instr/jedule/jedule_output.cpp + src/instr/jedule/jedule_platform.cpp + src/instr/jedule/jedule_sd_binding.cpp ) set(MC_SRC_BASE @@ -660,7 +657,6 @@ set(headers_to_install include/simgrid/modelchecker.h include/simgrid/forward.h include/simgrid/platf.h - include/simgrid/platf_generator.h include/simgrid/simix.h include/simgrid/simix.hpp include/simgrid/host.h @@ -678,7 +674,6 @@ set(headers_to_install include/simgrid/plugins/energy.h include/smpi/mpi.h include/smpi/smpi.h - include/smpi/smpi_cocci.h include/smpi/smpi_main.h include/surf/simgrid_dtd.h include/surf/surf_routing.h @@ -729,8 +724,8 @@ set(source_of_generated_headers src/context_sysv_config.h.in) ### depend of some variables setted upper -# -->CONTEXT_THREADS CONTEXT_UCONTEXT -if(${CONTEXT_THREADS}) #pthread +# -->HAVE_THREAD_CONTEXTS HAVE_UCONTEXT_CONTEXTS +if(${HAVE_THREAD_CONTEXTS}) #pthread set(SURF_SRC ${SURF_SRC} src/simix/ThreadContext.cpp @@ -744,7 +739,7 @@ else() # NOT pthread ) endif() -if(${CONTEXT_THREADS}) #pthread +if(${HAVE_THREAD_CONTEXTS}) #pthread set(SURF_SRC ${SURF_SRC} src/xbt/xbt_os_thread.c @@ -756,7 +751,7 @@ else() # NOT pthread ) endif() -if(${CONTEXT_UCONTEXT}) #ucontext +if(${HAVE_UCONTEXT_CONTEXTS}) #ucontext set(SURF_SRC ${SURF_SRC} src/simix/UContext.cpp @@ -1065,6 +1060,7 @@ set(EXAMPLES_CMAKEFILES_TXT set(TESHSUITE_CMAKEFILES_TXT teshsuite/bug-17132/CMakeLists.txt teshsuite/java/CMakeLists.txt + teshsuite/java/semaphore/CMakeLists.txt teshsuite/java/sleep_host_off/CMakeLists.txt teshsuite/lua/lua_platforms.tesh teshsuite/mc/CMakeLists.txt @@ -1239,9 +1235,7 @@ set(PLATFORMS_EXAMPLES examples/platforms/clusters_routing_full.xml examples/platforms/crosstraffic.xml examples/platforms/conf/gridpp_grid_2004.conf - examples/platforms/conf/gridpp_grid_2004.xml examples/platforms/conf/lcg_sept2004_grid.conf - examples/platforms/conf/lcg_sept2004_grid.xml examples/platforms/conf/transform_optorsim_platform.pl examples/platforms/config.xml examples/platforms/config_tracing.xml @@ -1255,8 +1249,6 @@ set(PLATFORMS_EXAMPLES examples/platforms/g5k.xml examples/platforms/generation_scripts/create_hierarchical_clusters.pl examples/platforms/generation_scripts/enhancedDTDwithHierarchicalCluster.pl - examples/platforms/generation_scripts/generate_g5k_platform.pl - examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl examples/platforms/griffon.xml examples/platforms/meta_cluster.xml examples/platforms/multicore_machine.xml diff --git a/tools/cmake/MakeExe.cmake b/tools/cmake/MakeExe.cmake index cd1f8fb9e5..2752d29e8a 100644 --- a/tools/cmake/MakeExe.cmake +++ b/tools/cmake/MakeExe.cmake @@ -82,6 +82,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f90) add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/xbt) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/java) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/java/semaphore) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc) diff --git a/tools/cmake/MakeLib.cmake b/tools/cmake/MakeLib.cmake index b21a0ce23c..74f907e561 100644 --- a/tools/cmake/MakeLib.cmake +++ b/tools/cmake/MakeLib.cmake @@ -25,11 +25,11 @@ endif() # Compute the dependencies of SimGrid ##################################### set(SIMGRID_DEP "-lm") -if (HAVE_BOOST_CONTEXT) +if (HAVE_BOOST_CONTEXTS) set(SIMGRID_DEP "${SIMGRID_DEP} ${Boost_CONTEXT_LIBRARY}") endif() -if(HAVE_PTHREAD AND ${CONTEXT_THREADS} AND NOT APPLE) +if(HAVE_PTHREAD AND ${HAVE_THREAD_CONTEXTS} AND NOT APPLE) # Clang on recent Mac OS X is not happy about -pthread. SET(SIMGRID_DEP "${SIMGRID_DEP} -pthread") endif() diff --git a/tools/cmake/PrintArgs.cmake b/tools/cmake/PrintArgs.cmake index 4acd4e042e..258ac3030b 100644 --- a/tools/cmake/PrintArgs.cmake +++ b/tools/cmake/PrintArgs.cmake @@ -57,8 +57,8 @@ if(enable_print_message) message("HAVE_THREAD_LOCAL_STORAGE ...: ${HAVE_THREAD_LOCAL_STORAGE}") message("HAVE_MMALLOC ................: ${HAVE_MMALLOC}") message("") - message("CONTEXT_THREADS .............: ${CONTEXT_THREADS}") - message("CONTEXT_UCONTEXT ............: ${CONTEXT_UCONTEXT}") + message("HAVE_THREAD_CONTEXTS .............: ${HAVE_THREAD_CONTEXTS}") + message("HAVE_UCONTEXT_CONTEXTS ............: ${HAVE_UCONTEXT_CONTEXTS}") message("______________________________________________________________________") message("______________________________________________________________________ DEBUG END") message("") @@ -119,7 +119,7 @@ message(" Compile Smpi ................: ${HAVE_SMPI}") message(" Compile MPI testsuite .......: ${enable_smpi_MPICH3_testsuite}") message(" Compile Smpi f77 ............: ${SMPI_FORTRAN}") message(" Compile Smpi f90 ............: ${SMPI_FORTRAN}") -message(" Compile Boost.Context support: ${HAVE_BOOST_CONTEXT}") +message(" Compile Boost.Context support: ${HAVE_BOOST_CONTEXTS}") message("") message(" Maintainer mode .............: ${enable_maintainer_mode}") message(" Documentation................: ${enable_documentation}") diff --git a/tools/cmake/Tests.cmake b/tools/cmake/Tests.cmake index 832cad7f13..321105e9f7 100644 --- a/tools/cmake/Tests.cmake +++ b/tools/cmake/Tests.cmake @@ -38,10 +38,10 @@ MACRO(ADD_TESH_FACTORIES NAME FACTORIES) LIST(REMOVE_AT ARGR 0) ENDFOREACH() FOREACH(FACTORY ${FACTORIES}) - if ((${FACTORY} STREQUAL "thread") OR - (${FACTORY} STREQUAL "boost" AND HAVE_BOOST_CONTEXT) OR - (${FACTORY} STREQUAL "raw" AND HAVE_RAWCTX) OR - (${FACTORY} STREQUAL "ucontext" AND CONTEXT_UCONTEXT)) + if ((${FACTORY} STREQUAL "thread" AND HAVE_THREAD_CONTEXTS) OR + (${FACTORY} STREQUAL "boost" AND HAVE_BOOST_CONTEXTS) OR + (${FACTORY} STREQUAL "raw" AND HAVE_RAW_CONTEXTS) OR + (${FACTORY} STREQUAL "ucontext" AND HAVE_UCONTEXT_CONTEXTS)) ADD_TESH("${NAME}-${FACTORY}" "--cfg" "contexts/factory:${FACTORY}" ${ARGR}) ENDIF() ENDFOREACH() @@ -97,7 +97,7 @@ IF(NOT enable_memcheck) ADD_TESH_FACTORIES(mc-bugged1 "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1.tesh) ADD_TESH_FACTORIES(mc-bugged2 "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged2.tesh) - IF(CONTEXT_UCONTEXT AND PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...) + IF(HAVE_UCONTEXT_CONTEXTS AND PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...) ADD_TESH(mc-bugged1-liveness-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness.tesh) ADD_TESH(mc-bugged1-liveness-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_sparse.tesh) ADD_TESH(mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited.tesh) @@ -116,18 +116,20 @@ IF(NOT enable_memcheck) ### SIMIX ### # BEGIN TESH TESTS - IF(HAVE_RAWCTX) + IF(HAVE_RAW_CONTEXTS) ADD_TESH(tesh-simix-factory-default --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/check_defaults --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/check_defaults factory_raw.tesh) - ELSEIF(CONTEXT_UCONTEXT) + ELSEIF(HAVE_UCONTEXT_CONTEXTS) ADD_TESH(tesh-simix-factory-default --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/check_defaults --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/check_defaults factory_ucontext.tesh) ELSE() ADD_TESH(tesh-simix-factory-default --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/check_defaults --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/check_defaults factory_thread.tesh) ENDIF() + IF(HAVE_THREAD_CONTEXTS) ADD_TESH(tesh-simix-factory-thread --cfg contexts/factory:thread --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/check_defaults --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/check_defaults factory_thread.tesh) - IF(HAVE_RAWCTX) + ENDIF() + IF(HAVE_RAW_CONTEXTS) ADD_TESH(tesh-simix-factory-raw --cfg contexts/factory:raw --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/check_defaults --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/check_defaults factory_raw.tesh) ENDIF() - IF(CONTEXT_UCONTEXT) + IF(HAVE_UCONTEXT_CONTEXTS) ADD_TESH(tesh-simix-factory-ucontext --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/check_defaults --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/check_defaults factory_ucontext.tesh) ENDIF() # END TESH TESTS @@ -139,11 +141,13 @@ IF(NOT enable_memcheck) IF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Darwin") # These tests are known to fail on Windows and Mac OS X # (the expected error message is not shown). + IF(HAVE_THREAD_CONTEXTS) SET_TESTS_PROPERTIES(stack-overflow-thread PROPERTIES WILL_FAIL true) - IF(CONTEXT_UCONTEXT) + ENDIF() + IF(HAVE_UCONTEXT_CONTEXTS) SET_TESTS_PROPERTIES(stack-overflow-ucontext PROPERTIES WILL_FAIL true) ENDIF() - IF(HAVE_RAWCTX) + IF(HAVE_RAW_CONTEXTS) SET_TESTS_PROPERTIES(stack-overflow-raw PROPERTIES WILL_FAIL true) ENDIF() ENDIF() @@ -414,13 +418,15 @@ IF(NOT enable_memcheck) ADD_TESH(tesh-smpi-clusters-types --cfg smpi/alltoall:mvapich2 --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/alltoall --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/alltoall clusters.tesh) # END TESH TESTS IF(enable_smpi_MPICH3_testsuite) - ADD_TEST(test-smpi-mpich3-coll-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) - SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-thread PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") - IF(CONTEXT_UCONTEXT) + IF(HAVE_THREAD_CONTEXTS) + ADD_TEST(test-smpi-mpich3-coll-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) + SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-thread PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") + ENDIF() + IF(HAVE_UCONTEXT_CONTEXTS) ADD_TEST(test-smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree) SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-ompi-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") ENDIF() - IF(HAVE_RAWCTX) + IF(HAVE_RAW_CONTEXTS) ADD_TEST(test-smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) ADD_TEST(test-smpi-mpich3-coll-ompi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree) ADD_TEST(test-smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) @@ -428,7 +434,7 @@ IF(NOT enable_memcheck) ADD_TEST(test-smpi-mpich3-coll-impi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:impi -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mpich-raw test-smpi-mpich3-coll-ompi-raw test-smpi-mpich3-coll-mpich-raw test-smpi-mpich3-coll-mvapich2-raw test-smpi-mpich3-coll-impi-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") ENDIF() - IF(HAVE_RAWCTX) + IF(HAVE_RAW_CONTEXTS) ADD_TEST(test-smpi-mpich3-attr-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/attr ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/attr -tests=testlist -execarg=--cfg=contexts/factory:raw) ADD_TEST(test-smpi-mpich3-comm-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/comm ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/comm -tests=testlist -execarg=--cfg=contexts/factory:raw) ADD_TEST(test-smpi-mpich3-init-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/init ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/init -tests=testlist -execarg=--cfg=contexts/factory:raw) @@ -441,7 +447,7 @@ IF(NOT enable_memcheck) ADD_TEST(test-smpi-mpich3-perf-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/running_power:-1) SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw test-smpi-mpich3-rma-raw test-smpi-mpich3-info-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") ENDIF() - IF(SMPI_FORTRAN) + IF(SMPI_FORTRAN AND HAVE_THREAD_CONTEXTS) ADD_TEST(test-smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -execarg=--cfg=contexts/stack_size:8000 -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") ADD_TEST(test-smpi-mpich3-thread-f90 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION}) @@ -512,6 +518,7 @@ IF(NOT enable_memcheck) # teshsuite ones ADD_TESH(tesh-java-sleep-host-off --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/teshsuite/java ${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off/sleep_host_off.tesh) + ADD_TESH(tesh-java-semaphore-gc --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/teshsuite/java ${CMAKE_HOME_DIRECTORY}/teshsuite/java/semaphore/semaphore_gc.tesh) ENDIF() diff --git a/tools/cmake/scripts/generate_memcheck_tests.pl b/tools/cmake/scripts/generate_memcheck_tests.pl index f57f8a274e..130b0c31bb 100755 --- a/tools/cmake/scripts/generate_memcheck_tests.pl +++ b/tools/cmake/scripts/generate_memcheck_tests.pl @@ -140,7 +140,7 @@ while ( defined( $line = ) ) { } if ( $command =~ /^mkfile\s+(\S+)/) { my $file = $1; - # don't ask me to explain why so many backslashes... + # don't ask me why so many backslashes. http://xkcd.com/1638/ $input =~ s/\\/\\\\\\\\/g; $input =~ s/\n/\\\\n/g; $input =~ s/"/\\\\042/g; @@ -152,13 +152,16 @@ while ( defined( $line = ) ) { foreach my $factory (split(';', $factories)) { $close=0; if( $factory =~ /^raw/) { - print "${indent}if(HAVE_RAWCTX)\n"; + print "${indent}if(HAVE_RAW_CONTEXTS)\n"; $close=1; }elsif( $factory =~ /^boost/) { - print "${indent}if(HAVE_BOOST_CONTEXT)\n"; + print "${indent}if(HAVE_BOOST_CONTEXTS)\n"; $close=1; }elsif( $factory =~ /^ucontext/) { - print "${indent}if(CONTEXT_UCONTEXT)\n"; + print "${indent}if(HAVE_UCONTEXT_CONTEXTS)\n"; + $close=1; + }elsif( $factory =~ /^thread/) { + print "${indent}if(HAVE_THREAD_CONTEXTS)\n"; $close=1; } print "${indent}ADD_TEST(NAME memcheck-$name_test-$factory-$count\n"; diff --git a/tools/cmake/src/internal_config.h.in b/tools/cmake/src/internal_config.h.in index 9a41c9e118..18e40fddcb 100644 --- a/tools/cmake/src/internal_config.h.in +++ b/tools/cmake/src/internal_config.h.in @@ -83,13 +83,13 @@ #cmakedefine __VA_COPY_USE_C99(d, s) @__VA_COPY_USE_C99@ /* Define if xbt contexts are based on our threads implementation or not */ -#cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@ +#cmakedefine HAVE_THREAD_CONTEXTS @HAVE_THREAD_CONTEXTS@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@ /* Define if xbt contexts are based on ucontext or not */ -#cmakedefine CONTEXT_UCONTEXT @CONTEXT_UCONTEXT@ +#cmakedefine HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@ /* Predefined possible va_copy() implementation (id: CPP) */ #cmakedefine __VA_COPY_USE_CPP(d, s) @__VA_COPY_USE_CPP@ @@ -110,8 +110,8 @@ #cmakedefine PROCESSOR_i686 @PROCESSOR_i686@ #cmakedefine PROCESSOR_x86_64 @PROCESSOR_x86_64@ #cmakedefine CMAKE_SYSTEM_PROCESSOR @CMAKE_SYSTEM_PROCESSOR@ -#cmakedefine HAVE_RAWCTX @HAVE_RAWCTX@ -#cmakedefine HAVE_BOOST_CONTEXT @HAVE_BOOST_CONTEXT@ +#cmakedefine HAVE_RAW_CONTEXTS @HAVE_RAW_CONTEXTS@ +#cmakedefine HAVE_BOOST_CONTEXTS @HAVE_BOOST_CONTEXTS@ /* Define to 1 if you have the GNU ld library */ #cmakedefine HAVE_GNU_LD @HAVE_GNU_LD@ diff --git a/tools/tesh/CMakeLists.txt b/tools/tesh/CMakeLists.txt index b0a018cde8..ee5d60ac9d 100644 --- a/tools/tesh/CMakeLists.txt +++ b/tools/tesh/CMakeLists.txt @@ -36,7 +36,6 @@ set(xml_files set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/tesh.pl - ${CMAKE_CURRENT_SOURCE_DIR}/colorize.pl ${CMAKE_CURRENT_SOURCE_DIR}/generate_tesh PARENT_SCOPE ) diff --git a/tools/tesh/colorize.pl b/tools/tesh/colorize.pl deleted file mode 100755 index 88b1f55e86..0000000000 --- a/tools/tesh/colorize.pl +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env perl - -# Copyright (c) 2010, 2014. The SimGrid Team. -# All rights reserved. - -# 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. - -use warnings; - -use Term::ANSIColor qw{:constants}; -$Term::ANSIColor::AUTORESET = 1; - -while(<>){ - if($_ =~ m/^(\d+\:\s)?[-]\s.*/){ - print BOLD RED $_; - }elsif ($_ =~ m/^(\d+\:\s)?[+]\s.*/){ - print BOLD GREEN $_; - }else{ - print BOLD $_; - } -} - -