Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
revert [a30523e] (remove supernovae) because I need some timings on G5K, and fix...
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 15 Nov 2011 14:43:55 +0000 (15:43 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 15 Nov 2011 14:43:55 +0000 (15:43 +0100)
13 files changed:
.gitignore
buildtools/Cmake/CTestConfig.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/Distrib.cmake
buildtools/Cmake/MakeLib.cmake
buildtools/Cmake/Modules/FindNS3.cmake
buildtools/Cmake/Option.cmake
buildtools/Cmake/PrintArgs.cmake
buildtools/Cmake/Supernovae.cmake [new file with mode: 0644]
src/mk_supernovae.pl [new file with mode: 0644]
src/surf/surf_routing_floyd.c
src/surf/surf_routing_full.c

index be537f8..b5b3b84 100644 (file)
@@ -34,9 +34,10 @@ examples/msg/masterslave/simgrid.so
 examples/simdag/simgrid.so
 
 ################################################
-### Units files
+### Units and supernovae files
 src/simgrid_units_main.c
 src/*_unit.c
+src/supernovae_*.c
 
 ################################################
 ### Generated files
index 35e004b..6e833ce 100644 (file)
@@ -18,6 +18,10 @@ if(enable_compile_warnings AND enable_compile_optimizations)
        SET(BUILDNAME "FULL_FLAGS" CACHE TYPE INTERNAL FORCE)
 endif(enable_compile_warnings AND enable_compile_optimizations)
 
+if(enable_supernovae)
+       SET(BUILDNAME "SUPERNOVAE" CACHE TYPE INTERNAL FORCE)
+endif(enable_supernovae)
+
 if(HAVE_GTNETS)
        SET(BUILDNAME "GTNETS" CACHE TYPE INTERNAL FORCE)
 endif(HAVE_GTNETS)
index 36c3303..1f422e1 100644 (file)
@@ -808,6 +808,9 @@ ${CMAKE_BINARY_DIR}/bin/smpirun
 ${CMAKE_BINARY_DIR}/bin/colorize
 ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
 ${CMAKE_BINARY_DIR}/examples/smpi/smpi_traced.trace
+${CMAKE_BINARY_DIR}/src/supernovae_sg.c
+${CMAKE_BINARY_DIR}/src/supernovae_gras.c
+${CMAKE_BINARY_DIR}/src/supernovae_smpi.c
 )
 
 if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
index 941782b..8a97107 100644 (file)
@@ -88,6 +88,7 @@ set(EXTRA_DIST
        src/smpi/private.h
        src/smpi/smpi_mpi_dt_private.h
        src/smpi/README
+       src/mk_supernovae.pl
        
        examples/gras/ping/ping.h
        examples/gras/console/ping.h
index 207fd63..9aea98e 100644 (file)
@@ -308,6 +308,13 @@ COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
 )
 
+add_custom_target(supernovae-clean
+COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
+WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
+)
+
 #############################################
 ### Fill in the "make sync-gforge" target ###
 #############################################
index 04d3dfc..9bc0d11 100644 (file)
@@ -3,6 +3,9 @@
 ###############################
 # Declare the library content #
 ###############################
+# If we want supernovae, rewrite the libs' content to use it
+include(${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
+
 # Actually declare our libraries
 
 add_library(simgrid SHARED ${simgrid_sources})
@@ -26,6 +29,22 @@ endif(enable_smpi)
 add_dependencies(gras maintainer_files)
 add_dependencies(simgrid maintainer_files)                             
 
+# if supernovaeing, we need some depends to make sure that the source gets generated
+if (enable_supernovae)
+       add_dependencies(simgrid ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
+       if(enable_lib_static)
+               add_dependencies(simgrid_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
+       endif(enable_lib_static)
+       add_dependencies(gras ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c)
+
+       if(enable_smpi)
+               add_dependencies(smpi ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
+               if(enable_lib_static)
+                       add_dependencies(smpi_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
+               endif(enable_lib_static)
+       endif(enable_smpi)
+endif(enable_supernovae)       
+
 # Compute the dependencies of GRAS
 ##################################
 set(GRAS_DEP "-lm -pthread")
index 3bbf48e..c8e34bb 100644 (file)
@@ -103,4 +103,8 @@ if(HAVE_NS3)
        endif(NOT operation)            
 else(HAVE_NS3)
     message(STATUS "Warning: To use NS-3 Please install ns3 at least version 3.10 (http://www.nsnam.org/releases/)")
-endif(HAVE_NS3)
\ No newline at end of file
+endif(HAVE_NS3)
+
+if(HAVE_NS3 AND enable_supernovae)
+    set(enable_supernovae OFF)
+endif(HAVE_NS3 AND enable_supernovae)
\ No newline at end of file
index f17905e..9b455ef 100644 (file)
@@ -32,6 +32,13 @@ option(enable_print_message "Enable print message during config." off)
 option(enable_model-checking "" off)
 option(enable_lib_static "" off)
 option(enable_jedule "Jedule output of SimDAG." off)
+option(enable_debug "Set NDEBUG flag" on)
+
+if(enable_supernovae AND enable_model-checking)
+       set(enable_model-checking false CACHE TYPE INTERNAL FORCE)
+       message("\n\nWith supernovae mode the model checking must be disable.!!!\n\n")
+endif(enable_supernovae AND enable_model-checking)
+
 
 mark_as_advanced(HAVE_SSH)
 mark_as_advanced(HAVE_RSYNC)
index 4b541a8..5b9912f 100644 (file)
@@ -98,6 +98,7 @@ message("     Compile Smpi   :        ${enable_smpi}")
 message("      Compile Static :        ${enable_lib_static}")
 message("")
 message("      Maintainer mode:        ${enable_maintainer_mode}")
+message("      Supernovae mode:        ${enable_supernovae}")
 message("      Model checking :        ${enable_model-checking}")
 message("      Tracing mode   :        ${enable_tracing}")
 message("      Jedule  mode   :        ${enable_jedule}")
diff --git a/buildtools/Cmake/Supernovae.cmake b/buildtools/Cmake/Supernovae.cmake
new file mode 100644 (file)
index 0000000..4e7c2f9
--- /dev/null
@@ -0,0 +1,69 @@
+### Make supernovae files and libs
+
+#############################################################################
+### Add here every files that should not be supernovaed (generated files) ###
+#############################################################################
+set(simgrid_fragile_sources 
+       src/gras/DataDesc/ddt_parse.yy.c
+       src/surf/surfxml_parse.c
+       src/xbt/graphxml_parse.c
+       src/simdag/sd_daxloader.c
+       ${GTNETS_USED}
+)
+set(gras_fragile_sources
+       src/gras/DataDesc/ddt_parse.yy.c
+       src/xbt/graphxml_parse.c
+)
+
+#####################################################
+### END OF CONFIGURATION, NO NEED TO READ FURTHER ###
+#####################################################
+
+### Rebuild the supernovae source files
+if (enable_supernovae) # I need supernovae
+
+       # supernovae files are generated. I promise
+       set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c
+                                     PROPERTIES GENERATED true)
+       set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c
+                                     PROPERTIES GENERATED true)
+       set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c
+                                     PROPERTIES GENERATED true)
+
+       ADD_CUSTOM_COMMAND(
+               OUTPUT   ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c
+               DEPENDS  ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl ${simgrid_sources}
+               COMMAND  perl ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl --out=${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c '--fragile=${simgrid_fragile_sources}' '${simgrid_sources}'
+               WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
+               COMMENT "Generating supernovae_sg.c"
+       )
+
+       ADD_CUSTOM_COMMAND(
+               OUTPUT   ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c
+               DEPENDS  ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl ${gras_sources}
+               COMMAND  perl ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl --out=${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c '--fragile=${gras_fragile_sources}'    '${gras_sources}'
+               WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
+               COMMENT "Generating supernovae_gras.c"
+       )
+
+       ADD_CUSTOM_COMMAND(
+               OUTPUT   ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c
+               DEPENDS  ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl ${SMPI_SRC}
+               COMMAND  perl ${CMAKE_HOME_DIRECTORY}/src/mk_supernovae.pl --out=${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c  '${SMPI_SRC}'
+               WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
+               COMMENT "Generating supernovae_smpi.c"
+       )
+
+       ### Change the content of the libraries so that it contains only supernovae+fragiles
+       set(simgrid_sources 
+               ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c
+               ${simgrid_fragile_sources})
+
+       set(gras_sources
+               ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c 
+               ${gras_fragile_sources})                
+
+       set(SMPI_SRC 
+               ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
+                               
+endif(enable_supernovae) # I need supernovae
diff --git a/src/mk_supernovae.pl b/src/mk_supernovae.pl
new file mode 100644 (file)
index 0000000..bd99ab4
--- /dev/null
@@ -0,0 +1,110 @@
+#! /usr/bin/perl
+
+use strict;
+use Getopt::Long qw(GetOptions);
+
+#open TMP,">mk_supernovae.pl.args";
+#map {print TMP "$_ "} @ARGV;
+#close TMP;
+
+sub usage($) {
+    my $ret;
+    print "USAGE: mk_supernovae.pl [--fragile=file]* --out=file file1 file2*\n";
+    print "  --help: show this message\n";
+    print "  --fragile=file: specify that file is fragile and shouldn't be supernovaed\n";
+    print "  --out=file: specify the name of the output file\n";
+    print "elements may be separated by semi-columns (;) instead of spaces, too\n";
+    exit $ret;
+}
+
+my @fragile_files=undef;
+my $outfile=undef;
+my $help;
+
+Getopt::Long::config('permute','no_getopt_compat', 'no_auto_abbrev');
+GetOptions(
+    'help|h'                => \$help,
+
+    'fragile=s' =>\@fragile_files,
+    'out=s'     =>\$outfile) or usage(1);
+
+@fragile_files = split(/;/,join(';',@fragile_files));
+@fragile_files = split(/ /,join(' ',@fragile_files));
+
+usage(0) if (defined($help));
+unless(defined($outfile)) {
+    print "ERROR: No outfile defined.\n";
+    usage(1);
+}
+
+#print "mk_supernovae: generate $outfile\n";  
+
+open OUT, ">$outfile" or die "ERROR: cannot open $outfile: $!\n";
+
+print OUT <<EOF
+#define SUPERNOVAE_MODE 1
+#ifndef _GNU_SOURCE
+#  define _GNU_SOURCE     /* for getline() with older libc */
+#endif
+#ifndef _SVID_SOURCE
+#  define _SVID_SOURCE    /* strdup() */
+#endif
+#ifndef _ISOC99_SOURCE
+#  define _ISOC99_SOURCE  /* isfinite() */
+#endif
+#ifndef _ISO_C99_SOURCE
+#  define _ISO_C99_SOURCE /* isfinite() */
+#endif
+#include <ctype.h>
+#include "portable.h"
+#include "xbt.h"
+  
+EOF
+  ;
+
+sub readfile($) {
+    my $filename=shift;
+    open IN,"$filename" || die "ERROR: cannot read $filename: $!\n";
+    my $res;
+    while (<IN>) {
+       $res .= $_;
+    }
+    close IN;  
+    return $res;
+}
+
+
+my %fragile;
+map {$fragile{$_}=1} @fragile_files;
+my @args = split(/;/,join(';',@ARGV));
+@args = split(/ /,join(' ',@args));
+my $nbfile=0;
+foreach my $file (@args) {
+    if ($fragile{$file}) {
+       print "mk_supernovae: $file is fragile, skip it\n";
+       next;
+    } 
+#      print "mk_supernovae: process $file\n";
+    $nbfile++;
+
+    my $needundef=1;
+    print OUT "/* file $file */\n";
+    if ($file eq "xbt/log.c") {
+       print OUT "  #define _simgrid_log_category__default &_simgrid_log_category__log\n";
+    } else {
+       my $ctn = readfile($file);
+       if ($ctn =~ m/XBT_LOG_[^ ]*?DEFAULT_[^ ]*?CATEGORY/s) {
+           my $default=$ctn;
+           $default =~ s/.*XBT_LOG_[^ ]*?DEFAULT_[^ ]*?CATEGORY[^(]*\(([^,)]*).*$/$1/s;
+           print OUT "  #define _simgrid_log_category__default &_simgrid_log_category__$default\n";
+       } else {
+           print OUT "  /* no default category in file $file */\n";
+           $needundef = 0;
+       }
+    }
+    print OUT "  #include \"$file\"\n";
+    print OUT "  #undef _simgrid_log_category__default\n" if $needundef;
+    print OUT "\n";
+}
+close OUT;
+print "mk_supernovae: $outfile contains $nbfile files inlined\n";
index be0e83e..e094d6c 100644 (file)
@@ -231,7 +231,7 @@ void model_floyd_end(AS_t current_routing)
        }
 }
 
-static int surf_pointer_resource_cmp(const void *a, const void *b) {
+static int floyd_pointer_resource_cmp(const void *a, const void *b) {
   return a != b;
 }
 
@@ -288,7 +288,7 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                xbt_assert(!xbt_dynar_compare(
                          (void*)TO_FLOYD_LINK(*src_id, *dst_id)->link_list,
                          (void*)link_route_to_test,
-                         (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
+                         (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
                          "The route between \"%s\" and \"%s\" already exists", src,dst);
        }
        else
@@ -333,7 +333,7 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                        xbt_assert(!xbt_dynar_compare(
                                  (void*)TO_FLOYD_LINK(*dst_id, *src_id)->link_list,
                              (void*)link_route_to_test,
-                                 (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
+                                 (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
                                  "The route between \"%s\" and \"%s\" already exists", src,dst);
                }
                else
index 3263bb8..cc9c541 100644 (file)
@@ -156,7 +156,7 @@ void model_full_end(AS_t current_routing)
   }
 }
 
-static int surf_pointer_resource_cmp(const void *a, const void *b) {
+static int full_pointer_resource_cmp(const void *a, const void *b) {
   return a != b;
 }
 
@@ -193,7 +193,7 @@ void model_full_set_route(AS_t rc, const char *src,
                xbt_assert(!xbt_dynar_compare(
                          (void*)TO_ROUTE_FULL(*src_id, *dst_id)->link_list,
                          (void*)link_route_to_test,
-                         (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
+                         (int_f_cpvoid_cpvoid_t) full_pointer_resource_cmp),
                          "The route between \"%s\" and \"%s\" already exists. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.", src,dst);
        }
        else
@@ -237,7 +237,7 @@ void model_full_set_route(AS_t rc, const char *src,
                        xbt_assert(!xbt_dynar_compare(
                                  (void*)TO_ROUTE_FULL(*dst_id, *src_id)->link_list,
                              (void*)link_route_to_test,
-                                 (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
+                                 (int_f_cpvoid_cpvoid_t) full_pointer_resource_cmp),
                                  "The route between \"%s\" and \"%s\" already exists", src,dst);
                }
                else