From: Marion Guthmuller Date: Mon, 2 Apr 2012 16:08:05 +0000 (+0200) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid X-Git-Tag: v3_7~65^2~7 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/217b4afb954d1795f011f060767b8d89533f2b71?hp=5657b6cbb51a403dbc777e905664dc17ec49f327 Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid --- diff --git a/.gitignore b/.gitignore index b782a25324..ee1d9abc95 100644 --- a/.gitignore +++ b/.gitignore @@ -70,6 +70,7 @@ Testing/ Makefile bin/ lib/ +manpages/ build_dir/ build/ buildtools/Cmake/test_prog/prog_va_copy.c @@ -94,6 +95,7 @@ doc/latex/ doc/html doc/index-API.doc doc/index.php +doc/logcategories.doc doc/simgrid.tag doc/simgrid_modules.map doc/publis_core.bib @@ -133,6 +135,11 @@ examples/msg/masterslave/toto.txt examples/msg/simulation.trace examples/msg/toto.txt examples/msg/z_gtnets.trace +examples/msg/tracing/link_srcdst_user_variables +examples/msg/tracing/link_user_variables +examples/msg/tracing/simple +examples/msg/tracing/trace_platform +examples/msg/tracing/user_variables examples/msg/tracing/procmig examples/msg/tracing/tasks examples/msg/tracing/volume @@ -263,6 +270,7 @@ teshsuite/gras/small_sleep/log.txt teshsuite/gras/small_sleep/small_sleep_function teshsuite/gras/modelcheck/modelcheck_checker teshsuite/msg/get_sender +teshsuite/msg/trace/test_trace_integration teshsuite/simdag/basic0 teshsuite/simdag/basic1 teshsuite/simdag/basic2 @@ -287,6 +295,7 @@ teshsuite/simdag/partask/test_comp_only_par teshsuite/simdag/partask/test_comp_only_seq teshsuite/xbt/log_large_test teshsuite/xbt/parallel_log_crashtest +testsuite/xbt/parmap_bench testsuite/run_tests testsuite/simdag/sd_test testsuite/surf/lmm_usage diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index 816e0f73ab..29a849d98f 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -613,6 +613,7 @@ set(DOC_SOURCES #doc/index-API.doc doc/index.doc + ${CMAKE_HOME_DIRECTORY}/doc/logcategories.doc doc/module-amok.doc doc/module-gras.doc doc/module-msg.doc diff --git a/buildtools/Cmake/GenerateDoc.cmake b/buildtools/Cmake/GenerateDoc.cmake index a828caced4..a2739f533d 100644 --- a/buildtools/Cmake/GenerateDoc.cmake +++ b/buildtools/Cmake/GenerateDoc.cmake @@ -27,8 +27,6 @@ endif(${OUTPUT_BIBTEX2HTML_VERSION_2} STREQUAL ${OUTPUT_BIBTEX2HTML_VERSION}) if(DOXYGEN_PATH AND FIG2DEV_PATH AND BIBTEX2HTML_PATH AND GOOD_BIBTEX2HTML_VERSION) - string(REGEX REPLACE ";.*logcategories.doc" "" LISTE_DEUX "${LISTE_DEUX}") - #DOC_SOURCE=doc/*.doc, defined in DefinePackage set(DOCSSOURCES "${source_doxygen}\n${DOC_SOURCE}") string(REPLACE "\n" ";" DOCSSOURCES ${DOCSSOURCES}) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 9fcc61a4b0..07415d05cd 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -654,6 +654,7 @@ INPUT = index.doc \ gtut-tour-16-exchangecb.doc \ gtut-howto.doc \ gtut-howto-design.doc \ + @top_srcdir@/doc/logcategories.doc \ @top_srcdir@/src/instr/ \ @top_srcdir@/include/ \ @top_srcdir@/include/msg \ diff --git a/doc/bindings.doc b/doc/bindings.doc index f88237a472..122eacbee3 100644 --- a/doc/bindings.doc +++ b/doc/bindings.doc @@ -11,7 +11,7 @@ \section bindings_binding_lua Lua Binding Most of Simgrid modules require a good level in C programming, since simgrid is used to be as standard C library. - Sometime users prefer using some kind of « easy scripts » or a language easier to code with, for their works, + Sometime users prefer using some kind of “easy scripts” or a language easier to code with, for their works, which avoid dealing with C errors, and sometime an important gain of time. Besides Java Binding, Lua and Ruby bindings are available since version 3.4 of Simgrid for MSG Module, and we are currenlty working on bindings for other modules. @@ -153,4 +153,4 @@ Yes, Here too you have to resgiter your application before running the simulatio the full example is distributed in the file examples/lua/master_slave_bypass.lua - */ \ No newline at end of file + */ diff --git a/doc/gtut-tour-08-exceptions.doc b/doc/gtut-tour-08-exceptions.doc index 057e9bf7fd..b9c7e36da3 100644 --- a/doc/gtut-tour-08-exceptions.doc +++ b/doc/gtut-tour-08-exceptions.doc @@ -62,7 +62,7 @@ CATCH(e) { Another strange thing is that you should actually free the memory allocated to the exception with xbt_ex_fres() if you manage to deal with them. There is a bit more than this on the picture (#TRY_CLEANUP blocks, for example), and -you should check the section \ref XBT_ex for more details. +you should check the section \ref XBT_ex for more details. You should be very carfull when using the exceptions. They work great when used correctly, but there is a few golden rules you should never break. diff --git a/doc/modules.doc b/doc/modules.doc index 76e25a142c..2c69baee40 100644 --- a/doc/modules.doc +++ b/doc/modules.doc @@ -79,25 +79,103 @@ \ingroup SimGrid_API \brief Programming environment for the simulation of MPI applications - Once implemented, this programming environment will allow you to study - within the simulator any MPI application without having to modify them - for that. In other words, it will constitute an emulation solution for - parallel codes. +This programming environment permits to study existing MPI application +by emulating them on top of the SimGrid simulator. In other words, it +will constitute an emulation solution for parallel codes. You don't +even have to modify your code for that, although that may help, as +detailed below. - \section SMPI_who Who should use this (and who shouldn't) +\section SMPI_who Who should use SMPI (and who shouldn't) - You should use this programming environment of the SimGrid suite if you - want to study existing MPI applications. - If you want to work on a distributed application, have a look at the - \ref GRAS_API environment. - If you want to study some heuristics for a given problem (and if your - goal is to produce theorems, not code), have a look at the \ref MSG_API - environment, or the \ref SD_API one if you need to use DAGs. - If none of those programming environments fits your needs, you may - consider implementing your own directly on top of \ref SURF_API (but you - probably want to contact us before). +You should use this programming environment of the SimGrid suite if +you want to study existing MPI applications. If you want to create a +distributed application, you may be interested in the \ref GRAS_API +environment instead (but note that GRAS is not very actively +maintained nowadays). If you want to study some heuristics for a given +problem (and if your goal is to produce theorems and publications, not +code), have a look at the \ref MSG_API environment, or the \ref SD_API +one if you need to use DAGs. If none of those programming environments +fits your needs, you may consider implementing your own directly on +top of \ref SURF_API (but you probably want to contact us before). - */ +\section SMPI_what What can run within SMPI? + +You can run unmodified MPI applications (both C and Fortran) within +SMPI, provided you only use MPI calls that we implemented in MPI. Our +coverage of the interface is not bad, but will probably never be +complete. One sided communications and I/O primitives are not targeted +for now. The full list of not yet implemented functions is available +in file include/smpi/smpi.h of the archive, between two lines +containing the FIXME marker. If you really need a missing +feature, please get in touch with us: we can guide you though the +SimGrid code to help you implementing it, and we'd glad to integrate +it in the main project afterward if you contribute them back. + +\section SMPI_adapting Adapting your MPI code to the use of SMPI + +As detailed in the reference article (available at +http://hal.inria.fr/inria-00527150), you may want to adapt your code +to improve the simulation performance. But these tricks may seriously +hinder the result qualtity (or even prevent the app to run) if used +wrongly. We assume that if you want to simulate an HPC application, +you know what you are doing. Don't prove us wrong! + +If you get short on memory (the whole app is executed on a single node +when simulated), you should have a look at the SMPI_SHARED_MALLOC and +SMPI_SHARED_FREE macros. It allows to share memory areas between +processes. For example, matrix multiplication code may want to store +the blocks on the same area. Of course, the resulting computations +will useless, but you can still study the application behavior this +way. Of course, if your code is data-dependent, this won't work. + +If your application is too slow, try using SMPI_SAMPLE_LOCAL, +SMPI_SAMPLE_GLOBAL and friends to indicate which computation loops can +be sampled. Some of the loop iterations will be executed to measure +their duration, and this duration will be used for the subsequent +iterations. These samples are done per processor with +SMPI_SAMPLE_LOCAL, and shared between all processors with +SMPI_SAMPLE_GLOBAL. Of course, none of this will work if the execution +time of your loop iteration are not stable. + +Yes, that's right, these macros are not documented yet, but we'll fix +it as soon as time permits. Sorry about that -- patch welcomed! +Meanwhile, grep for them on the examples for more information. + +\section SMPI_compiling Compiling your code + +This is very simply done with the smpicc script. If you +already compiled any MPI code before, you already know how to use it. +If not, you should try to get your MPI code running on top of MPI +before giving SMPI a spin. Actually, that's very simple even if it's +the first time you use MPI code: just use smpicc as a compiler (in +replacement of gcc or your usual compiler), and you're set. + +\section SMPI_executing Executing your code on top of the simulator + +This is done though the smpirun script as follows. +my_hostfile.txt is a classical MPI hostfile (that is, this +file lists the machines on which the processes must be dispatched, one +per line) my_platform.xml is a classical SimGrid platform +file. Of course, the hosts of the hostfile must exist in the provided +platform. ./program is the MPI program that you want to +simulate (must be compiled by smpicc) while -arg is +a command-line parameter passed to this program. + +\verbatim +smpirun -hostfile my_hostfile.txt -platform my_platform.xml ./program -arg +\endverbatim + +smpirun accepts other parameters, such as -np if you don't +want to use all the hosts defined in the hostfile, -map to +display on which host each rank gets mapped of -trace to +activate the tracing during the simulation. You can get the full list +by running +\verbatim +smpirun -help +\endverbatim + + +*/ /** \defgroup SD_API SimDag diff --git a/doc/platform.doc b/doc/platform.doc index c8ed826f9d..b14feef62a 100644 --- a/doc/platform.doc +++ b/doc/platform.doc @@ -128,7 +128,7 @@ A host represents a computer, where you will be able to execute code and host attributes : \li id (mandatory): the identifier of the host to be used when referring to it. -\li power (mandatory):the peak number FLOPS the CPU can manage. Expressed in flop/s. +\li power (mandatory):the peak number FLOPS the CPU can manage. Expressed in flop/s. \li core: The number of core of this host. If setted, the power gives the power of one core. The specified computing power will be available to up to 6 sequential tasks without sharing. If more tasks are placed on this host, the resource will be shared accordingly. For example, if you schedule 12 @@ -338,10 +338,10 @@ Example link: \endverbatim Expressing sharing policy -By default a network link is SHARED, that is if more than one flow go through +By default a network link is SHARED, that is if more than one flow go through a link, each gets a share of the available bandwidth similar to the share TCP connections offers. -Conversely if a link is defined as a FATPIPE, each flow going through this link will get all the available bandwidth, whatever the number of flows. The FATPIPE +Conversely if a link is defined as a FATPIPE, each flow going through this link will get all the available bandwidth, whatever the number of flows. The FATPIPE behavior allows to describe big backbones that won't affect performances (except latency). Finally a link can be considered as FULLDUPLEX, that means that in the simulator, 2 links (one named UP and the other DOWN) will be created for each link, so as the transfers from one side to the other will interact similarly as TCP when ACK returning packets circulate on the other direction. More discussion about it is available in link_ctn description. \verbatim @@ -350,14 +350,14 @@ behavior allows to describe big backbones that won't affect performances (except Expressing dynamicity and failures - As for hosts, it is possible to declare links whose state, bandwidth or latency change over the time. In this case, the bandwidth and latency attributes are respectively replaced by the bandwidth file and latency file attributes and the corresponding text files. + As for hosts, it is possible to declare links whose state, bandwidth or latency change over the time. In this case, the bandwidth and latency attributes are respectively replaced by the bandwidth file and latency file attributes and the corresponding text files. \verbatim \endverbatim -It has to be noted that even if the syntax is the same, the semantic of bandwidth and latency trace files -differs from that of host availability files. Those files do not express availability as a fraction of the available +It has to be noted that even if the syntax is the same, the semantic of bandwidth and latency trace files +differs from that of host availability files. Those files do not express availability as a fraction of the available capacity but directly in bytes per seconds for the bandwidth and in seconds for the latency. This is because most tools allowing to capture traces on real platforms (such as NWS ) express their results this way. @@ -426,7 +426,7 @@ For graph-based shortest path algorithms, routers are mandatory, because both al Routers are naturally an important concept in GTNetS or ns-3 since the way they run the packet routing algorithms is actually simulated. Instead, the SimGrid’s analytical models aggregate the routing time with the transfer time. -Rebuilding a graph representation only from the route information turns to be a very difficult task, because +Rebuilding a graph representation only from the route information turns to be a very difficult task, because of the missing information about how routes intersect. That is why we introduced a \ tag, which is simply used to express these intersection points. The only attribute accepted by this tag an id. It is important to understand that the \ tag is only used to provide topological information. diff --git a/examples/platforms/generation_scripts/create_hierarchical_clusters.pl b/examples/platforms/generation_scripts/create_hierarchical_clusters.pl index 2378e7e487..61384e5b23 100755 --- a/examples/platforms/generation_scripts/create_hierarchical_clusters.pl +++ b/examples/platforms/generation_scripts/create_hierarchical_clusters.pl @@ -1,21 +1,21 @@ #! /usr/bin/perl # L.Bobelin (Perl newbie) 25th of November -# Quick script to generate hierarchical clusters. Usage : p s d where : +# Quick script to generate hierarchical clusters. Usage : p s d where : # - p : 2^p gives the total number of hosts. -# - s : cluster size -# - d : degree of inner nodes. +# - s : cluster size +# - d : degree of inner nodes. +# +# output is the standard one. # -# output is the standard one. -#  # #Each node is numbered by a DFS in the tree. Each cluster is numbered by the DFS number of the leaf it is attached to and the number of cluster for each leaf. # Other infos : # - Same bb_lat used for any routers inside (not that complicated to modify too). # - constants defined in the first part of the script corresponding to classic cluster parameters. links_bw and links_lat added for the inner tree links # - bb_lat and bb_bw used in any backbone of the tree. -# - fails if you set an obviously too small total number of hosts compared to the cluster size (generates a lot of stuff for nothing actually). -#  +# - fails if you set an obviously too small total number of hosts compared to the cluster size (generates a lot of stuff for nothing actually). +# use Math::BigInt; @@ -75,11 +75,11 @@ if ( $height->bcmp(Math::BigInt->new("1")) != 0 && ($height->copy()->bpow($d))-> # print STDERR "totalnumberofcluster: " . $totalnumberofCluster . "\n"; # print STDERR "last cluster size (if equals to cluster size, then all clusters will be homogeneous) : " . $last . "\n"; -# Counter for giving unique IDs to ASes. +# Counter for giving unique IDs to ASes. $ASnumber; $ASnumber = 0; -# Printing preamble +# Printing preamble print "\n"; print "\n"; print "\n\n"; @@ -96,14 +96,14 @@ print "\n"; sub DF_creation { my($currDepth) = @_; - # Curr AS creation + # Curr AS creation print "\n"; - # Curr router AS creation stuff + # Curr router AS creation stuff print "\n"; print " \n"; print "\n"; - # Saving my current number to return it to my father + # Saving my current number to return it to my father my $toReturn = $ASnumber; $ASnumber++; if ($currDepth<=$height && $totalnumberofCluster > 0) @@ -173,7 +173,7 @@ sub DF_creation { } $totalnumberofCluster--; } - # Creating links to clusters + # Creating links to clusters for(my $i = 1; $i <= $lastNumberOfClusterCreated ; $i++) { print "\n"; } @@ -182,7 +182,7 @@ sub DF_creation { # curr backbone creation print "\n"; - # I must create routes between clusters now + # I must create routes between clusters now for (my $i =1; $i<=$lastNumberOfClusterCreated ; $i++) { for (my $j =$i+1; $j<=$lastNumberOfClusterCreated ; $j++) @@ -205,7 +205,7 @@ sub DF_creation { { print "\n"; @@ -214,7 +214,7 @@ sub DF_creation { print "\n"; } print "\n"; - # Should be done with it... + # Should be done with it... return $toReturn; } diff --git a/examples/platforms/generation_scripts/enhancedDTDwithHierarchicalCluster.pl b/examples/platforms/generation_scripts/enhancedDTDwithHierarchicalCluster.pl index e5c1124f39..1acf037d3f 100755 --- a/examples/platforms/generation_scripts/enhancedDTDwithHierarchicalCluster.pl +++ b/examples/platforms/generation_scripts/enhancedDTDwithHierarchicalCluster.pl @@ -1,10 +1,10 @@ #! /usr/bin/perl # L.Bobelin (Perl newbie) 24th of November -# Quick script to generate hierarchical clusters. Usage : add the special cluster tag (description below) in your "normal" platform file. Then run the script : +# Quick script to generate hierarchical clusters. Usage : add the special cluster tag (description below) in your "normal" platform file. Then run the script : # - First arg : the input file where you midified your cluster tag -# - Second one : the output file where all the stuff will be generated. -# Builds a complete tree to access clusters ; each node of the tree is inclosed in an AS, where full routing applies. +# - Second one : the output file where all the stuff will be generated. +# Builds a complete tree to access clusters ; each node of the tree is inclosed in an AS, where full routing applies. # # Number of cluster per leaf is given by cabinetnodes attr. # @@ -13,19 +13,19 @@ # - nbsons : degree of inner # - height : tree heigth # - cabinetnodes : cluster per leaf -#  -# Each node is numbered by a DFS in the tree. Each cluster is numbered by the DFS number of the leaf it is attached to and the number of cluster for each leaf. -#  -# +# +# Each node is numbered by a DFS in the tree. Each cluster is numbered by the DFS number of the leaf it is attached to and the number of cluster for each leaf. +# +# # Example syntax for hierarchical cluster creation : # # Other infos : -# - special tag has to be on one line because I don't want to bother with parsing issues +# - special tag has to be on one line because I don't want to bother with parsing issues # - Same bb_lat used for any routers inside (not that complicated to modify too) # - lame perl ? I'm a script kiddie in perl, it may well be my first perl stuff. # - Don't try to check or validate the modified file with the DTD, of course, as this is not a part of it. -# Counter for giving unique IDs to ASes. +# Counter for giving unique IDs to ASes. $ASnumber; $ASnumber = 0; @@ -102,14 +102,14 @@ print $infile . " -> " . $outfile . " ... Done.\n"; sub DF_creation { my($currDepth) = @_; - # Curr AS creation + # Curr AS creation print OUT "\n"; - # Curr router AS creation stuff + # Curr router AS creation stuff print OUT "\n"; print OUT " \n"; print OUT "\n"; - # Saving my current number to return it to my father + # Saving my current number to return it to my father my $toReturn = $ASnumber; $ASnumber++; if ($currDepth<$height) @@ -167,7 +167,7 @@ sub DF_creation { print OUT "\n"; } - # Creating links to clusters + # Creating links to clusters for(my $i = 1; $i <= $cabinetnodes; $i++) { print OUT "\n"; } @@ -176,7 +176,7 @@ sub DF_creation { # curr backbone creation print OUT "\n"; - # I must create routes between clusters now + # I must create routes between clusters now for (my $i =1; $i<=$cabinetnodes ; $i++) { for (my $j =$i+1; $j<=$cabinetnodes ; $j++) @@ -199,7 +199,7 @@ sub DF_creation { { print OUT "\n"; @@ -208,7 +208,7 @@ sub DF_creation { print OUT "\n"; } print OUT "\n"; - # Should be done with it... + # Should be done with it... return $toReturn; } diff --git a/examples/smpi/bcast.tesh b/examples/smpi/bcast.tesh index 68aaa81864..278d8dc7e4 100644 --- a/examples/smpi/bcast.tesh +++ b/examples/smpi/bcast.tesh @@ -16,13 +16,12 @@ $ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/ # second test p Test Broadcast with as much processes than hosts ! setenv LD_LIBRARY_PATH=../../lib -$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/small_platform.xml -np 6 ./bcast -q +$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/small_platform.xml -np 5 ./bcast -q > [rank 0] -> Tremblay > [rank 1] -> Jupiter > [rank 2] -> Fafard > [rank 3] -> Ginette > [rank 4] -> Bourassa -> [rank 5] -> Tremblay > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9' > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI' > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304' @@ -33,6 +32,7 @@ $ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/ p Test Broadcast with more processes than hosts ! setenv LD_LIBRARY_PATH=../../lib $ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/small_platform.xml -np 12 ./bcast -q +> You requested to use 12 processes, but there is only 5 processes in your hostfile... > [rank 0] -> Tremblay > [rank 1] -> Jupiter > [rank 2] -> Fafard diff --git a/examples/smpi/reduce.tesh b/examples/smpi/reduce.tesh index 12c68f7173..8725a0e98c 100644 --- a/examples/smpi/reduce.tesh +++ b/examples/smpi/reduce.tesh @@ -21,35 +21,34 @@ $ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/ # second test ! setenv LD_LIBRARY_PATH=../../lib -p Test Reduce with 6 processes -$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/small_platform.xml -np 6 ./reduce -q +p Test Reduce with 5 processes +$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/small_platform.xml -np 5 ./reduce -q > [rank 0] -> Tremblay > [rank 1] -> Jupiter > [rank 2] -> Fafard > [rank 3] -> Ginette > [rank 4] -> Bourassa -> [rank 5] -> Tremblay > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9' > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI' > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304' > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s) > ** Scalar Int Test Result: -> [0] sum=21 ... validation ok. +> [0] sum=15 ... validation ok. > [0] min=1 ... validation ok. -> [0] max=6 ... validation ok. +> [0] max=5 ... validation ok. > ** IBM Test Result: ... > ok. > ok. > ok. > ok. > ok. -> ok. # third test ! setenv LD_LIBRARY_PATH=../../lib p Test Reduce with 12 processes $ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/small_platform.xml -np 12 ./reduce -q +> You requested to use 12 processes, but there is only 5 processes in your hostfile... > [rank 0] -> Tremblay > [rank 1] -> Jupiter > [rank 2] -> Fafard diff --git a/include/xbt/ex.h b/include/xbt/ex.h index ef5b9168a2..b7903c152a 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -516,5 +516,5 @@ XBT_PUBLIC(void) xbt_backtrace_display(xbt_ex_t * e); SG_END_DECL() -/** @} */ +/** @} */ #endif /* __XBT_EX_H__ */ diff --git a/include/xbt/log.h b/include/xbt/log.h index a398c405e2..fe7d3ba8b4 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -94,36 +94,20 @@ typedef enum { /* The root of the category hierarchy. */ #define XBT_LOG_ROOT_CAT root -/* The whole tree of categories is connected by setting the address of - * the parent category as a field of the child one. +/* The whole tree of categories is connected by setting the address of the + * parent category as a field of the child one. This is normally done at the + * first use of the category. * - * In strict ansi C, we are allowed to initialize a variable with "a - * pointer to an lvalue designating an object of static storage - * duration" [ISO/IEC 9899:1999, Section 6.6]. - * - * Unfortunately, Visual C builder does not target any standard - * compliance, and C99 is not an exception to this unfortunate rule. - * - * So, we work this around by adding a XBT_LOG_CONNECT_PARENT() macro, - * allowing to connect a child to its parent. It should be used - * during the initialization of the code, before the child category - * gets used. - * - * When compiling with gcc, this is not necessary (XBT_LOG_CONNECT_PARENT - * defines to nothing). When compiling with MSVC, this is needed if - * you don't want to see your child category become a child of root - * directly. - */ -#if defined(_MSC_VER) -# define _XBT_LOG_PARENT_INITIALIZER(parent) NULL -# define XBT_LOG_CONNECT_PARENT(child, parent_cat) \ - _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat) -#else -# define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent) -# define XBT_LOG_CONNECT_PARENT(child, parent_cat) \ - /* xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat)); */ \ - ((void)0) -#endif + * It is however necessary to make this connections as early as possible, if we + * want the category to be listed by --help-log-categories. + * + * When possible, the initializations takes place automatically before the start + * of main(). It's the case when compiling with gcc. + * + * For the other cases, you can use the XBT_LOG_CONNECT(cat) macro to force + * early initialization. See, for example, in xbt/log.c, the function + * xbt_log_connect_categories(). + */ #define XBT_LOG_CONNECT(cat) \ if (1) { \ @@ -140,12 +124,12 @@ typedef enum { void _XBT_LOGV_CTOR(catName)(void) \ { \ XBT_LOG_EXTERNAL_CATEGORY(catName); \ - /* Note: _XBT_LOGV(parent) should be already declared here. */ \ - XBT_LOG_CONNECT_PARENT(catName, parent); \ - _xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized); \ + if (!_XBT_LOGV(catName).initialized) { \ + _xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized); \ + } \ } \ XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \ - _XBT_LOG_PARENT_INITIALIZER(parent), \ + &_XBT_LOGV(parent), \ NULL /* firstChild */, \ NULL /* nextSibling */, \ #catName, \ diff --git a/include/xbt/str.h b/include/xbt/str.h index 50be43f5b8..a7a17e7cf7 100644 --- a/include/xbt/str.h +++ b/include/xbt/str.h @@ -49,7 +49,7 @@ XBT_PUBLIC(char *) xbt_str_diff(const char *a, const char *b); XBT_PUBLIC(char *) xbt_str_from_file(FILE * file); -/** @brief Classical alias to (char*) +/** @brief Classical alias to (char*) * * This of almost no use, beside cosmetics and the XBT datadesc parsing macro (see \ref XBT_dd_auto). */ diff --git a/src/bindings/lua/lua_stub_generator.c b/src/bindings/lua/lua_stub_generator.c index 16d8f0b752..0b13f2691d 100644 --- a/src/bindings/lua/lua_stub_generator.c +++ b/src/bindings/lua/lua_stub_generator.c @@ -327,7 +327,7 @@ void generate_makefile_local(const char *project) "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<\n" "\n"); fprintf(OUT, - "## Rules for tarballs and cleaning\n" + "## Rules for tarballs and cleaning\n" "DIST_FILES= $(EXTRA_DIST) $(GENERATED_C_FILES) $(PRECIOUS_C_FILES) " MAKEFILE_FILENAME_LOCAL " " /*MAKEFILE_FILENAME_REMOTE */ "\n" "distdir: $(DIST_FILES)\n" "\trm -rf $(DISTDIR)\n" diff --git a/src/include/surf/datatypes.h b/src/include/surf/datatypes.h index bac27788c4..f51895af6e 100644 --- a/src/include/surf/datatypes.h +++ b/src/include/surf/datatypes.h @@ -7,15 +7,16 @@ #ifndef MAXMIN_DATATYPES_H #define MAXMIN_DATATYPES_H -/** \brief Model datatype - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Model datatype * * Generic data structure for a model. The workstations, * the CPUs and the network links are examples of models. */ typedef struct surf_model *surf_model_t; -/** \brief Action datatype - * \ingroup SURF_actions + +/** \ingroup SURF_actions + * \brief Action datatype * * An action is some working amount on a model. * It is represented as a cost, a priority, a duration and a state. diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 7ec4c48892..d8f73c5b55 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -63,8 +63,8 @@ enum heap_action_type{ NOTSET }; -/** \brief Action structure - * \ingroup SURF_actions +/** \ingroup SURF_actions + * \brief Action structure * * Never create s_surf_action_t by yourself ! The actions are created * on the fly when you call execute or communicate on a model. @@ -107,8 +107,8 @@ typedef struct surf_action_lmm { enum heap_action_type hat; } s_surf_action_lmm_t, *surf_action_lmm_t; -/** \brief Action states - * \ingroup SURF_actions +/** \ingroup SURF_actions + * \brief Action states * * Action states. * @@ -124,8 +124,8 @@ typedef enum { /**< Not in the system anymore. Why did you ask ? */ } e_surf_action_state_t; -/** \brief Action state sets - * \ingroup SURF_actions +/** \ingroup SURF_actions + * \brief Action state sets * * This structure contains some sets of actions. * It provides a fast access to the actions in each state. @@ -150,15 +150,15 @@ typedef struct s_routing_global s_routing_global_t, *routing_global_t; XBT_PUBLIC_DATA(routing_global_t) global_routing; -/** \brief Private data available on all models - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Private data available on all models */ typedef struct surf_model_private *surf_model_private_t; /* Cpu model */ - /** \brief CPU model extension public - * \ingroup SURF_models + /** \ingroup SURF_models + * \brief CPU model extension public * * Public functions specific to the CPU model. */ @@ -182,8 +182,8 @@ typedef struct s_network_element_info *network_element_t; /* Network model */ - /** \brief Network model extension public - * \ingroup SURF_models + /** \ingroup SURF_models + * \brief Network model extension public * * Public functions specific to the network model */ @@ -210,8 +210,8 @@ typedef struct surf_network_model_extension_public { /* Storage model */ -/** \brief Storage model extension public - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Storage model extension public * * Public functions specific to the Storage model. */ @@ -225,8 +225,8 @@ typedef struct surf_storage_model_extension_public { void* (*create_resource) (const char* id, const char* model,const char* type_id); } s_surf_model_extension_storage_t; - /** \brief Workstation model extension public - * \ingroup SURF_models + /** \ingroup SURF_models + * \brief Workstation model extension public * * Public functions specific to the workstation model. */ @@ -280,8 +280,8 @@ typedef struct surf_workstation_model_extension_public { -/** \brief Model datatype - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Model datatype * * Generic data structure for a model. The workstations, * the CPUs and the network links are examples of models. @@ -395,13 +395,13 @@ typedef struct surf_resource_lmm { /**************************************/ -/** \brief The CPU model - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The CPU model */ XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model; -/** \brief Initializes the CPU model with the model Cas01 - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the CPU model with the model Cas01 * * By default, this model uses the lazy optimization mechanism that * relies on partial invalidation in LMM and a heap for lazy action update. @@ -415,8 +415,8 @@ XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model; */ XBT_PUBLIC(void) surf_cpu_model_init_Cas01(void); -/** \brief Initializes the CPU model with trace integration [Deprecated] - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the CPU model with trace integration [Deprecated] * * You shouldn't have to call it by yourself. * \see surf_workstation_model_init_CLM03() @@ -433,14 +433,14 @@ XBT_PUBLIC(double) generic_share_resources(double now); */ XBT_PUBLIC(void) generic_update_actions_state(double now, double delta); -/** \brief The list of all available optimization modes (both for cpu and networks). - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The list of all available optimization modes (both for cpu and networks). * These optimization modes can be set using --cfg=cpu/optim:... and --cfg=network/optim:... */ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_optimization_mode_description[]; -/** \brief The list of all available cpu model models - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The list of all available cpu model models */ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[]; @@ -451,8 +451,8 @@ XBT_PUBLIC(void) create_workstations(void); */ -/** \brief The network model - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The network model * * When creating a new API on top on SURF, you shouldn't use the * network model unless you know what you are doing. Only the workstation @@ -461,8 +461,8 @@ XBT_PUBLIC(void) create_workstations(void); */ XBT_PUBLIC_DATA(surf_model_t) surf_network_model; -/** \brief Same as network model 'LagrangeVelho', only with different correction factors. - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Same as network model 'LagrangeVelho', only with different correction factors. * * This model is proposed by Pierre-Nicolas Clauss and Martin Quinson and Stéphane Génaud * based on the model 'LV08' and different correction factors depending on the communication @@ -473,8 +473,8 @@ XBT_PUBLIC_DATA(surf_model_t) surf_network_model; */ XBT_PUBLIC(void) surf_network_model_init_SMPI(void); -/** \brief Initializes the platform with the network model 'LegrandVelho' - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model 'LegrandVelho' * * This model is proposed by Arnaud Legrand and Pedro Velho based on * the results obtained with the GTNets simulator for onelink and @@ -484,8 +484,8 @@ XBT_PUBLIC(void) surf_network_model_init_SMPI(void); */ XBT_PUBLIC(void) surf_network_model_init_LegrandVelho(void); -/** \brief Initializes the platform with the network model 'Constant' - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model 'Constant' * * In this model, the communication time between two network cards is * constant, hence no need for a routing table. This is particularly @@ -497,8 +497,8 @@ XBT_PUBLIC(void) surf_network_model_init_LegrandVelho(void); */ XBT_PUBLIC(void) surf_network_model_init_Constant(void); -/** \brief Initializes the platform with the network model CM02 - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model CM02 * * This function is called by surf_workstation_model_init_CLM03 * or by yourself only if you plan using surf_workstation_model_init_compound @@ -516,8 +516,8 @@ XBT_PUBLIC(void) surf_network_model_init_bypass(const char *id, double initial_lat); #ifdef HAVE_GTNETS -/** \brief Initializes the platform with the network model GTNETS - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model GTNETS * \param filename XML platform file name * * This function is called by surf_workstation_model_init_GTNETS @@ -529,8 +529,8 @@ XBT_PUBLIC(void) surf_network_model_init_GTNETS(void); #endif #ifdef HAVE_NS3 -/** \brief Initializes the platform with the network model NS3 - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model NS3 * \param filename XML platform file name * * This function is called by surf_workstation_model_init_NS3 @@ -541,8 +541,8 @@ XBT_PUBLIC(void) surf_network_model_init_GTNETS(void); XBT_PUBLIC(void) surf_network_model_init_NS3(void); #endif -/** \brief Initializes the platform with the network model Reno - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model Reno * \param filename XML platform file name * * The problem is related to max( sum( arctan(C * Df * xi) ) ). @@ -556,8 +556,8 @@ XBT_PUBLIC(void) surf_network_model_init_NS3(void); */ XBT_PUBLIC(void) surf_network_model_init_Reno(void); -/** \brief Initializes the platform with the network model Reno2 - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model Reno2 * \param filename XML platform file name * * The problem is related to max( sum( arctan(C * Df * xi) ) ). @@ -571,8 +571,8 @@ XBT_PUBLIC(void) surf_network_model_init_Reno(void); */ XBT_PUBLIC(void) surf_network_model_init_Reno2(void); -/** \brief Initializes the platform with the network model Vegas - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the network model Vegas * \param filename XML platform file name * * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent @@ -587,8 +587,8 @@ XBT_PUBLIC(void) surf_network_model_init_Reno2(void); */ XBT_PUBLIC(void) surf_network_model_init_Vegas(void); -/** \brief The list of all available network model models - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The list of all available network model models */ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_network_model_description[]; @@ -598,13 +598,13 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) -/** \brief The storage model - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The storage model */ XBT_PUBLIC(void) surf_storage_model_init_default(void); -/** \brief The list of all available storage modes. - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The list of all available storage modes. * This storage mode can be set using --cfg=storage/model:... */ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[]; @@ -615,8 +615,8 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[]; -/** \brief The workstation model - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The workstation model * * Note that when you create an API on top of SURF, * the workstation model should be the only one you use @@ -625,8 +625,8 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[]; */ XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model; -/** \brief Initializes the platform with a compound workstation model - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with a compound workstation model * * This function should be called after a cpu_model and a * network_model have been set up. @@ -634,8 +634,8 @@ XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model; */ XBT_PUBLIC(void) surf_workstation_model_init_compound(void); -/** \brief Initializes the platform with the current best network and cpu models at hand - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the current best network and cpu models at hand * * This platform model seperates the workstation model and the network model. * The workstation model will be initialized with the model compound, the network @@ -646,8 +646,8 @@ XBT_PUBLIC(void) surf_workstation_model_init_compound(void); */ XBT_PUBLIC(void) surf_workstation_model_init_current_default(void); -/** \brief Initializes the platform with the workstation model CLM03 - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the workstation model CLM03 * * This platform model seperates the workstation model and the network model. * The workstation model will be initialized with the model CLM03, the network @@ -658,8 +658,8 @@ XBT_PUBLIC(void) surf_workstation_model_init_current_default(void); */ XBT_PUBLIC(void) surf_workstation_model_init_CLM03(void); -/** \brief Initializes the platform with the model KCCFLN05 - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief Initializes the platform with the model KCCFLN05 * * With this model, only parallel tasks can be used. Resource sharing * is done by identifying bottlenecks and giving an equal share of @@ -668,14 +668,14 @@ XBT_PUBLIC(void) surf_workstation_model_init_CLM03(void); */ XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(void); -/** \brief The list of all available workstation model models - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief The list of all available workstation model models */ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_workstation_model_description[]; -/** \brief List of initialized models - * \ingroup SURF_models +/** \ingroup SURF_models + * \brief List of initialized models */ XBT_PUBLIC_DATA(xbt_dynar_t) model_list; @@ -684,8 +684,8 @@ XBT_PUBLIC_DATA(xbt_dynar_t) model_list; /*******************************************/ XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set; -/** \brief Initialize SURF - * \ingroup SURF_simulation +/** \ingroup SURF_simulation + * \brief Initialize SURF * \param argc argument number * \param argv arguments * @@ -698,15 +698,15 @@ XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set; */ XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */ -/** \brief Finish simulation initialization - * \ingroup SURF_simulation +/** \ingroup SURF_simulation + * \brief Finish simulation initialization * * This function must be called before the first call to surf_solve() */ XBT_PUBLIC(void) surf_presolve(void); -/** \brief Performs a part of the simulation - * \ingroup SURF_simulation +/** \ingroup SURF_simulation + * \brief Performs a part of the simulation * \param max_date Maximum date to update the simulation to, or -1 * \return the elapsed time, or -1.0 if no event could be executed * @@ -718,15 +718,15 @@ XBT_PUBLIC(void) surf_presolve(void); */ XBT_PUBLIC(double) surf_solve(double max_date); -/** \brief Return the current time - * \ingroup SURF_simulation +/** \ingroup SURF_simulation + * \brief Return the current time * * Return the current time in millisecond. */ XBT_PUBLIC(double) surf_get_clock(void); -/** \brief Exit SURF - * \ingroup SURF_simulation +/** \ingroup SURF_simulation + * \brief Exit SURF * * Clean everything. * diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index c00fb8560d..f689fe61e7 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -54,8 +54,8 @@ size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t * r Open text file for reading. The stream is positioned at the beginning of the file. * r+ Open for reading and writing. The stream is positioned at the beginning of the file. * w Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. - * w+ Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the begin‐ - * ning of the file. + * w+ Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the + * beginning of the file. * a Open for appending (writing at end of file). The file is created if it does not exist. The stream is positioned at the end of the file. * a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading * is at the beginning of the file, but output is always appended to the end of the file. diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 1f15df9603..829da194cd 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -254,7 +254,7 @@ double SD_workstation_get_computation_time(SD_workstation_t workstation, } /** - * \brief Returns the latency of the route between two workstations, i.e. the sum of all link latencies + * \brief Returns the latency of the route between two workstations, i.e. the sum of all link latencies * between the workstations. * * \param src the first workstation @@ -283,7 +283,7 @@ double SD_route_get_current_latency(SD_workstation_t src, } /** - * \brief Returns the bandwidth of the route between two workstations, i.e. the minimum link bandwidth of all + * \brief Returns the bandwidth of the route between two workstations, i.e. the minimum link bandwidth of all * between the workstations. * * \param src the first workstation diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 4bc0c03b9e..1770c4b4db 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -13,7 +13,6 @@ LOOPBACK_BANDWIDTH="${DEFAULT_LOOPBACK_BANDWIDTH}" LOOPBACK_LATENCY="${DEFAULT_LOOPBACK_LATENCY}" NETWORK_BANDWIDTH="${DEFAULT_NETWORK_BANDWIDTH}" NETWORK_LATENCY="${DEFAULT_NETWORK_LATENCY}" -NUMPROCS="${DEFAULT_NUMPROCS}" POWER="${DEFAULT_POWER}" SIMOPTS="--cfg=maxmin/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP_gamma:4194304" @@ -21,15 +20,19 @@ SIMOPTS="--cfg=maxmin/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP_ #usage to print the way this script should be called function usage () { echo "usage:" - echo "$0 [-quiet] [-keep-temps]" + echo "$0 [-keep-temps]" echo " [-np ] -platform -hostfile [-map] program [program-options]" + echo " [-keep-temps] # don't remove the generated files after execution" + echo " [-map] # display the machine on which each process rank is mapped" + echo " [-np ] # use that amount of processes from the hostfile." + echo " # By default, all processes of the hostfile are used." echo " [-trace] # activate tracing" echo " [-trace-grouped] # group MPI processes by location" echo " [-trace-resource] # trace resource utilization" echo " [-trace-triva] # generate configuration for Triva's GraphView" echo " [-trace-file ] # name of the tracefile (simgrid_smpi.trace)" echo "or (deprecated usage):" - echo "$0 [-quiet] [-keep-temps] [-np ] [-bandwidth ] [-latency ] program [program-options]" + echo "$0 [-keep-temps] [-np ] [-bandwidth ] [-latency ] program [program-options]" echo } @@ -56,7 +59,7 @@ while true; do ;; "-platform") PLATFORM="$2" - if [ ! -f ${PLATFORM} ]; then + if [ ! -f "${PLATFORM}" ]; then echo "[$0] ** error: the file '${PLATFORM}' does not exist. Aborting." exit 1 fi @@ -64,7 +67,7 @@ while true; do ;; "-hostfile") HOSTFILE="$2" - if [ ! -f ${HOSTFILE} ]; then + if [ ! -f "${HOSTFILE}" ]; then echo "[$0] ** error: the file '${HOSTFILE}' does not exist. Aborting." exit 1 fi @@ -129,15 +132,31 @@ shift ##----------------------------------- -# test if we have something to execute, otherwise show usage and exit -if [ -z ${EXEC} ] -then - echo "Program is missing" +# Basic checks on the provided arguments +if [ -z "${EXEC}" ] ; then + echo "You must provide a program to execute." + usage + exit 1 +fi + +if [ -z "${HOSTFILE}" ] ; then + echo "No hostfile specified." usage exit 1 fi +# Don't use wc -l to compute it to avoid issues with trailing \n at EOF +hostfile_procs=`grep -c [a-zA-Z0-9] $HOSTFILE` +if [ -z "${NUMPROCS}" ] ; then + # Use the amount of processes in the hostfile as default value for the -np parameter + NUMPROCS=$hostfile_procs +fi + + +if [ ${NUMPROCS} -gt ${hostfile_procs} ] ; then + echo "You requested to use ${NUMPROCS} processes, but there is only ${hostfile_procs} processes in your hostfile..." >&2 +fi ##-------------------------------- DEFAULT or SPECIFIED PLATFORM -------------------------------------- if [ -z "${PLATFORM}" ]; then diff --git a/src/xbt/graph.c b/src/xbt/graph.c index 240a974dc2..fdf9f5f07d 100644 --- a/src/xbt/graph.c +++ b/src/xbt/graph.c @@ -172,7 +172,7 @@ void xbt_graph_free_graph(xbt_graph_t g, } -/** @brief remove the given node from the given graph */ +/** @brief remove the given node from the given graph */ void xbt_graph_free_node(xbt_graph_t g, xbt_node_t n, void_f_pvoid_t node_free_function, void_f_pvoid_t edge_free_function) @@ -210,7 +210,7 @@ void xbt_graph_free_node(xbt_graph_t g, xbt_node_t n, return; } -/** @brief remove the given edge from the given graph */ +/** @brief remove the given edge from the given graph */ void xbt_graph_free_edge(xbt_graph_t g, xbt_edge_t e, void_f_pvoid_t free_function) { diff --git a/src/xbt/xbt_matrix.c b/src/xbt/xbt_matrix.c index 89eadf13ee..58941b703e 100644 --- a/src/xbt/xbt_matrix.c +++ b/src/xbt/xbt_matrix.c @@ -138,7 +138,7 @@ void xbt_matrix_copy_values(xbt_matrix_t dst, xbt_matrix_t src, } -/** \brief Creates a new matrix of double filled with zeros */ +/** \brief Creates a new matrix of double filled with zeros */ xbt_matrix_t xbt_matrix_double_new_zeros(int lines, int rows) { xbt_matrix_t res = xbt_matrix_new(lines, rows, sizeof(double), NULL); @@ -147,7 +147,7 @@ xbt_matrix_t xbt_matrix_double_new_zeros(int lines, int rows) return res; } -/** \brief Creates a new matrix of double being the identity matrix */ +/** \brief Creates a new matrix of double being the identity matrix */ xbt_matrix_t xbt_matrix_double_new_id(int lines, int rows) { xbt_matrix_t res = xbt_matrix_double_new_zeros(lines, rows); @@ -158,7 +158,7 @@ xbt_matrix_t xbt_matrix_double_new_id(int lines, int rows) return res; } -/** \brief Creates a new matrix of double randomly filled */ +/** \brief Creates a new matrix of double randomly filled */ xbt_matrix_t xbt_matrix_double_new_rand(int lines, int rows) { xbt_matrix_t res = xbt_matrix_new(lines, rows, sizeof(double), NULL); @@ -170,7 +170,7 @@ xbt_matrix_t xbt_matrix_double_new_rand(int lines, int rows) return res; } -/** \brief Creates a new matrix of double containing the sequence of numbers in order */ +/** \brief Creates a new matrix of double containing the sequence of numbers in order */ xbt_matrix_t xbt_matrix_double_new_seq(int lines, int rows) { xbt_matrix_t res = xbt_matrix_new(lines, rows, sizeof(double), NULL); @@ -182,7 +182,7 @@ xbt_matrix_t xbt_matrix_double_new_seq(int lines, int rows) return res; } -/** \brief Checks whether the matrix contains the sequence of numbers */ +/** \brief Checks whether the matrix contains the sequence of numbers */ int xbt_matrix_double_is_seq(xbt_matrix_t mat) { int i; diff --git a/src/xbt/xbt_str.c b/src/xbt/xbt_str.c index b2593e5f1f..6d7a2e25b7 100644 --- a/src/xbt/xbt_str.c +++ b/src/xbt/xbt_str.c @@ -574,14 +574,82 @@ long getline(char **buf, size_t * n, FILE * stream) /* * Diff related functions */ +static XBT_INLINE void diff_push(xbt_dynar_t dyn, char prefix, const char *s) +{ + char *topush = bprintf("%c %s", prefix, s); + xbt_dynar_push(dyn, &topush); +} + +static int diff_member(const char *s, xbt_dynar_t d, unsigned from, unsigned to) +{ + unsigned i; + for (i = from; i < to; i++) + if (!strcmp(s, xbt_dynar_get_as(d, i, char *))) + return 1; + return 0; +} + +static void diff_easy_prefix(xbt_dynar_t res, xbt_dynar_t da, xbt_dynar_t db) +{ + while (xbt_dynar_length(da) > 0 && xbt_dynar_length(db) > 0) { + char *sa = xbt_dynar_getfirst_as(da, char *); + char *sb = xbt_dynar_getfirst_as(db, char *); + + if (!strcmp(sa, sb)) { + /* sa == sb */ + diff_push(res, ' ', sa); + xbt_dynar_shift(da, NULL); + xbt_dynar_shift(db, NULL); + } else if (!diff_member(sa, db, 1, xbt_dynar_length(db))) { + /* sa not in db */ + diff_push(res, '-', sa); + xbt_dynar_shift(da, NULL); + } else if (!diff_member(sb, da, 1, xbt_dynar_length(da))) { + /* sb not in da */ + diff_push(res, '+', sb); + xbt_dynar_shift(db, NULL); + } else { + /* sa in db, and sb in da: cannot go further */ + return; + } + } +} + +static void diff_easy_suffix(xbt_dynar_t res, xbt_dynar_t da, xbt_dynar_t db) +{ + while (xbt_dynar_length(da) > 0 && xbt_dynar_length(db) > 0) { + char *sa = xbt_dynar_getlast_as(da, char *); + char *sb = xbt_dynar_getlast_as(db, char *); + + if (!strcmp(sa, sb)) { + /* sa == sb */ + diff_push(res, ' ', sa); + xbt_dynar_pop(da, NULL); + xbt_dynar_pop(db, NULL); + } else if (!diff_member(sb, da, 0, xbt_dynar_length(da) - 1)) { + /* sb not in da */ + diff_push(res, '+', sb); + xbt_dynar_pop(db, NULL); + } else if (!diff_member(sa, db, 0, xbt_dynar_length(db) - 1)) { + /* sa not in db */ + diff_push(res, '-', sa); + xbt_dynar_pop(da, NULL); + } else { + /* sa in db, and sb in da: cannot go further */ + return; + } + } +} + static XBT_INLINE int diff_get(xbt_matrix_t C, int i, int j) { return (i == -1 || j == -1) ? 0 : xbt_matrix_get_as(C, i, j, int); } -static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db, - int len_a, int len_b) +static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db) { + unsigned len_a = xbt_dynar_length(da); + unsigned len_b = xbt_dynar_length(db); xbt_matrix_t C = xbt_matrix_new(len_a, len_b, sizeof(int), NULL); int i, j; @@ -606,10 +674,10 @@ static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db, if (!strcmp(xbt_dynar_get_as(da, i, char *), xbt_dynar_get_as(db, j, char *))) - *((int *) xbt_matrix_get_ptr(C, i, j)) = diff_get(C, i - 1, j - 1) + 1; + xbt_matrix_get_as(C, i, j, int) = diff_get(C, i - 1, j - 1) + 1; else - *((int *) xbt_matrix_get_ptr(C, i, j)) = max(diff_get(C, i, j - 1), - diff_get(C, i - 1, j)); + xbt_matrix_get_as(C, i, j, int) = max(diff_get(C, i, j - 1), + diff_get(C, i - 1, j)); } return C; } @@ -618,7 +686,6 @@ static void diff_build_diff(xbt_dynar_t res, xbt_matrix_t C, xbt_dynar_t da, xbt_dynar_t db, int i, int j) { - char *topush; /* Construct the diff function printDiff(C[0..m,0..n], X[1..m], Y[1..n], i, j) if i > 0 and j > 0 and X[i] = Y[j] @@ -636,18 +703,15 @@ static void diff_build_diff(xbt_dynar_t res, if (i >= 0 && j >= 0 && !strcmp(xbt_dynar_get_as(da, i, char *), xbt_dynar_get_as(db, j, char *))) { diff_build_diff(res, C, da, db, i - 1, j - 1); - topush = bprintf(" %s", xbt_dynar_get_as(da, i, char *)); - xbt_dynar_push(res, &topush); + diff_push(res, ' ', xbt_dynar_get_as(da, i, char *)); } else if (j >= 0 && (i == -1 || diff_get(C, i, j - 1) >= diff_get(C, i - 1, j))) { diff_build_diff(res, C, da, db, i, j - 1); - topush = bprintf("+ %s", xbt_dynar_get_as(db, j, char *)); - xbt_dynar_push(res, &topush); + diff_push(res, '+', xbt_dynar_get_as(db, j, char *)); } else if (i >= 0 && (j == -1 || diff_get(C, i, j - 1) < diff_get(C, i - 1, j))) { diff_build_diff(res, C, da, db, i - 1, j); - topush = bprintf("- %s", xbt_dynar_get_as(da, i, char *)); - xbt_dynar_push(res, &topush); + diff_push(res, '-', xbt_dynar_get_as(da, i, char *)); } } @@ -658,11 +722,12 @@ char *xbt_str_diff(const char *a, const char *b) xbt_dynar_t db = xbt_str_split(b, "\n"); xbt_matrix_t C; xbt_dynar_t diff; + xbt_dynar_t diff2; char *res; size_t len; - unsigned length_da; diff = xbt_dynar_new(sizeof(char *), &xbt_free_ref); + diff2 = xbt_dynar_new(sizeof(char *), NULL); /* Clean empty lines at the end of da and db */ len = strlen(a); @@ -672,39 +737,27 @@ char *xbt_str_diff(const char *a, const char *b) if (len > 0 && b[len - 1] == '\n') xbt_dynar_pop(db, NULL); - /* Find the common suffix, do it before extracting the prefix, + /* Extract the easy suffix, do it before extracting the prefix, * as xbt_dynar_pop costs less than xbt_dynar_shift */ - length_da = xbt_dynar_length(da); - while (length_da > 0 && xbt_dynar_length(db) > 0 && - !strcmp(xbt_dynar_get_as(da, length_da - 1, char *), - xbt_dynar_getlast_as(db, char *))) { - xbt_dynar_pop(db, NULL); - length_da--; - } + diff_easy_suffix(diff2, da, db); - /* Extract the common prefix */ - while (length_da > 0 && xbt_dynar_length(db) > 0 && - !strcmp(xbt_dynar_getfirst_as(da, char *), - xbt_dynar_getfirst_as(db, char *))) { - char *topush = bprintf(" %s", xbt_dynar_getfirst_as(da, char *)); - xbt_dynar_push(diff, &topush); - xbt_dynar_shift(da, NULL); - xbt_dynar_shift(db, NULL); - length_da--; - } + /* Extract the easy prefix */ + diff_easy_prefix(diff, da, db); /* Compute the diff for the remaining */ - C = diff_build_LCS(da, db, length_da, xbt_dynar_length(db)); - diff_build_diff(diff, C, da, db, length_da - 1, xbt_dynar_length(db) - 1); + C = diff_build_LCS(da, db); + diff_build_diff(diff, C, da, db, + xbt_dynar_length(da) - 1, xbt_dynar_length(db) - 1); xbt_matrix_free(C); xbt_dynar_free(&db); + xbt_dynar_free(&da); - /* Add the common suffix */ - for (; length_da < xbt_dynar_length(da); length_da++) { - char *topush = bprintf(" %s", xbt_dynar_get_as(da, length_da, char *)); + /* Add the easy suffix, in reverse order */ + while (!xbt_dynar_is_empty(diff2)) { + char *topush = xbt_dynar_pop_as(diff2, char *); xbt_dynar_push(diff, &topush); } - xbt_dynar_free(&da); + xbt_dynar_free(&diff2); /* Build the final result */ res = xbt_str_join(diff, "\n"); diff --git a/tools/gras/CMakeLists.txt b/tools/gras/CMakeLists.txt index 632026f7e1..8a5f391931 100644 --- a/tools/gras/CMakeLists.txt +++ b/tools/gras/CMakeLists.txt @@ -3,10 +3,13 @@ cmake_minimum_required(VERSION 2.6) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") add_executable(gras_stub_generator stub_generator.c unix_stub_generator.c windows_stub_generator.c) +add_executable(struct_diff struct_diff.c) ### Add definitions for compile if(NOT WIN32) target_link_libraries(gras_stub_generator simgrid pthread m) + target_link_libraries(struct_diff simgrid pthread m) else(NOT WIN32) target_link_libraries(gras_stub_generator simgrid) + target_link_libraries(struct_diff simgrid) endif(NOT WIN32) \ No newline at end of file diff --git a/tools/gras/s_smx_process_t b/tools/gras/s_smx_process_t new file mode 100644 index 0000000000..a3526ed84e --- /dev/null +++ b/tools/gras/s_smx_process_t @@ -0,0 +1,21 @@ +struct s_smx_process_t { + s_xbt_swag_hookup_t process_hookup; + s_xbt_swag_hookup_t synchro_hookup; + s_xbt_swag_hookup_t host_proc_hookup; + s_xbt_swag_hookup_t destroy_hookup; + + unsigned long pid; + char *name XBT_ANNOTE(size,1); + smx_host_t smx_host; + smx_context_t context; + xbt_running_ctx_t *running_ctx XBT_ANNOTE(size,1); + short int FLAGS; + smx_host_t new_host; + smx_action_t waiting_action; + xbt_fifo_t comms; + xbt_dict_t properties; + s_smx_simcall_t simcall; + + +} s_smx_process_t; + diff --git a/tools/gras/s_smx_simcall_t b/tools/gras/s_smx_simcall_t new file mode 100644 index 0000000000..28ae88feae --- /dev/null +++ b/tools/gras/s_smx_simcall_t @@ -0,0 +1,424 @@ +typedef struct s_smx_simcall { + e_smx_simcall_t call; + smx_process_t issuer; + + union { + + struct { + const char *name; + smx_host_t result; + } host_get_by_name; + + struct { + smx_host_t host; + const char* result; + } host_get_name; + + struct { + smx_host_t host; + xbt_dict_t result; + } host_get_properties; + + struct { + smx_host_t host; + double result; + } host_get_speed; + + struct { + smx_host_t host; + double result; + } host_get_available_speed; + + struct { + smx_host_t host; + int result; + } host_get_state; + + struct { + smx_host_t host; + void* result; + } host_get_data; + + struct { + smx_host_t host; + void* data; + } host_set_data; + + struct { + const char* name; + smx_host_t host; + double computation_amount; + double priority; + smx_action_t result; + } host_execute; + + struct { + const char *name; + int host_nb; + smx_host_t *host_list; + double *computation_amount; + double *communication_amount; + double amount; + double rate; + smx_action_t result; + } host_parallel_execute; + + struct { + smx_action_t execution; + } host_execution_destroy; + + struct { + smx_action_t execution; + } host_execution_cancel; + + struct { + smx_action_t execution; + double result; + } host_execution_get_remains; + + struct { + smx_action_t execution; + e_smx_state_t result; + } host_execution_get_state; + + struct { + smx_action_t execution; + double priority; + } host_execution_set_priority; + + struct { + smx_action_t execution; + e_smx_state_t result; + } host_execution_wait; + + struct { + smx_process_t *process; + const char *name; + xbt_main_func_t code; + void *data; + const char *hostname; + int argc; + char **argv; + xbt_dict_t properties; + } process_create; + + struct { + smx_process_t process; + } process_kill; + + struct { + smx_process_t process; + } process_cleanup; + + struct { + smx_process_t process; + smx_host_t dest; + } process_change_host; + + struct { + smx_process_t process; + } process_suspend; + + struct { + smx_process_t process; + } process_resume; + + struct { + int result; + } process_count; + + struct { + smx_process_t process; + void* result; + } process_get_data; + + struct { + smx_process_t process; + void* data; + } process_set_data; + + struct { + smx_process_t process; + smx_host_t result; + } process_get_host; + + struct { + smx_process_t process; + const char *result; + } process_get_name; + + struct { + smx_process_t process; + int result; + } process_is_suspended; + + struct { + smx_process_t process; + xbt_dict_t result; + } process_get_properties; + + struct { + double duration; + e_smx_state_t result; + } process_sleep; + + struct { + const char *name; + smx_rdv_t result; + } rdv_create; + + struct { + smx_rdv_t rdv; + } rdv_destroy; + + struct { + const char* name; + smx_rdv_t result; + } rdv_get_by_name; + + struct { + smx_rdv_t rdv; + smx_host_t host; + unsigned int result; + } rdv_comm_count_by_host; + + struct { + smx_rdv_t rdv; + smx_action_t result; + } rdv_get_head; + + struct { + smx_rdv_t rdv; + double task_size; + double rate; + void *src_buff; + size_t src_buff_size; + int (*match_fun)(void *, void *); + void *data; + double timeout; + } comm_send; + + struct { + smx_rdv_t rdv; + double task_size; + double rate; + void *src_buff; + size_t src_buff_size; + int (*match_fun)(void *, void *); + void (*clean_fun)(void *); + void *data; + int detached; + smx_action_t result; + } comm_isend; + + struct { + smx_rdv_t rdv; + void *dst_buff; + size_t *dst_buff_size; + int (*match_fun)(void *, void *); + void *data; + double timeout; + } comm_recv; + + struct { + smx_rdv_t rdv; + void *dst_buff; + size_t *dst_buff_size; + int (*match_fun)(void *, void *); + void *data; + smx_action_t result; + } comm_irecv; + + struct { + smx_action_t comm; + } comm_destroy; + + struct { + smx_action_t comm; + } comm_cancel; + + struct { + xbt_dynar_t comms; + unsigned int result; + } comm_waitany; + + struct { + smx_action_t comm; + double timeout; + } comm_wait; + + struct { + smx_action_t comm; + int result; + } comm_test; + + struct { + xbt_dynar_t comms; + int result; + } comm_testany; + + struct { + smx_action_t comm; + double result; + } comm_get_remains; + + struct { + smx_action_t comm; + e_smx_state_t result; + } comm_get_state; + + struct { + smx_action_t comm; + void *result; + } comm_get_src_data; + + struct { + smx_action_t comm; + void *result; + } comm_get_dst_data; + + struct { + smx_action_t comm; + smx_process_t result; + } comm_get_src_proc; + + struct { + smx_action_t comm; + smx_process_t result; + } comm_get_dst_proc; + + struct { + smx_action_t comm; + int result; + } comm_is_latency_bounded; + + struct { + smx_action_t action; + const char *category; + } set_category; + + struct { + smx_mutex_t result; + } mutex_init; + + struct { + smx_mutex_t mutex; + } mutex_lock; + + struct { + smx_mutex_t mutex; + int result; + } mutex_trylock; + + struct { + smx_mutex_t mutex; + } mutex_unlock; + + struct { + smx_mutex_t mutex; + } mutex_destroy; + + struct { + smx_cond_t result; + } cond_init; + + struct { + smx_cond_t cond; + } cond_destroy; + + struct { + smx_cond_t cond; + } cond_signal; + + struct { + smx_cond_t cond; + smx_mutex_t mutex; + } cond_wait; + + struct { + smx_cond_t cond; + smx_mutex_t mutex; + double timeout; + } cond_wait_timeout; + + struct { + smx_cond_t cond; + } cond_broadcast; + + struct { + int capacity; + smx_sem_t result; + } sem_init; + + struct { + smx_sem_t sem; + } sem_destroy; + + struct { + smx_sem_t sem; + } sem_release; + + struct { + smx_sem_t sem; + int result; + } sem_would_block; + + struct { + smx_sem_t sem; + } sem_acquire; + + struct { + smx_sem_t sem; + double timeout; + } sem_acquire_timeout; + + struct { + smx_sem_t sem; + int result; + } sem_get_capacity; + + struct { + const char* storage; + void *ptr; + size_t size; + size_t nmemb; + m_file_t stream; + size_t result; + } file_read; + + struct { + const char* storage; + const void *ptr; + size_t size; + size_t nmemb; + m_file_t stream; + size_t result; + } file_write; + + struct { + const char* storage; + const char* path; + const char* mode; + m_file_t result; + } file_open; + + struct { + const char* storage; + m_file_t fp; + int result; + } file_close; + + struct { + const char* storage; + int fd; + //Next should be struct stat* buf + void* buf; + int result; + } file_stat; + + }; +} s_smx_simcall_t, *smx_simcall_t; + + + + diff --git a/tools/gras/struct_diff.c b/tools/gras/struct_diff.c new file mode 100644 index 0000000000..4de4567f72 --- /dev/null +++ b/tools/gras/struct_diff.c @@ -0,0 +1,161 @@ +/* struct_diff -- little tool to see which structure's field are modified on mc_diff */ + +/* Copyright (c) 2012. 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 +#include +#include +#include +#include +#include +#include +#include + +#include "xbt.h" +#include "xbt/datadesc.h" +#include "../../src/xbt/datadesc/datadesc_private.h" // RAAAAH! ugly relative path, but it's late, I want it to be done NOW. +#include "simix/datatypes.h" +#include "../../src/simix/smx_smurf_private.h" // RAAAAH! ugly relative path, but it's even later and it still doesn't work + +static void define_types(void) { + xbt_datadesc_type_t desc; + + /* typedef struct xbt_swag_hookup { + * void *next; + * void *prev; + * } s_xbt_swag_hookup_t; */ + desc = xbt_datadesc_struct("s_xbt_swag_hookup_t"); + xbt_datadesc_struct_append(desc,"next",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_struct_append(desc,"prev",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_struct_close(desc); + + /* FIXME: maybe we should provide the internal details */ + xbt_datadesc_copy("smx_host_t",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_copy("smx_context_t",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_copy("smx_action_t",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_copy("xbt_dict_t",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_copy("xbt_fifo_t",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_copy("smx_process_t",xbt_datadesc_by_name("data pointer")); + + /* typedef struct { + * char *msg; + * xbt_errcat_t category; + + * int value; + * short int remote; + * char *host; + * char *procname; + * + * int pid; + * char *file; + * int line; + * char *func; + + * int used; + * char **bt_strings; + * void *bt[XBT_BACKTRACE_SIZE]; + * } xbt_ex_t; */ + desc = xbt_datadesc_struct("xbt_ex_t"); + xbt_datadesc_struct_append(desc,"msg",xbt_datadesc_by_name("string")); + + xbt_assert(sizeof(xbt_errcat_t)==sizeof(int), + "I was assuming that xbt_errcat_t is of the same size than integer, but it's not true: it's %zu (int:%zu)\n", + sizeof(xbt_errcat_t),sizeof(int)); + xbt_datadesc_struct_append(desc,"category",xbt_datadesc_by_name("short int")); + + xbt_datadesc_struct_append(desc,"value",xbt_datadesc_by_name("short int")); + xbt_datadesc_struct_append(desc,"remote",xbt_datadesc_by_name("short int")); + xbt_datadesc_struct_append(desc,"host",xbt_datadesc_by_name("string")); + xbt_datadesc_struct_append(desc,"procname",xbt_datadesc_by_name("string")); + xbt_datadesc_struct_append(desc,"pid",xbt_datadesc_by_name("int")); + xbt_datadesc_struct_append(desc,"file",xbt_datadesc_by_name("string")); + xbt_datadesc_struct_append(desc,"line",xbt_datadesc_by_name("int")); + xbt_datadesc_struct_append(desc,"func",xbt_datadesc_by_name("string")); + xbt_datadesc_struct_append(desc,"used",xbt_datadesc_by_name("int")); + xbt_datadesc_struct_append(desc,"bt_strings",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_struct_append(desc,"bt",xbt_datadesc_array_fixed("xbt_bt",xbt_datadesc_by_name("data pointer"),XBT_BACKTRACE_SIZE)); + xbt_datadesc_struct_close(desc); + + /* typedef struct { + * __ex_mctx_t *ctx_mctx; + * volatile int ctx_caught; + * volatile xbt_ex_t exception; + * } xbt_running_ctx_t; */ + desc = xbt_datadesc_struct("xbt_running_ctx_t"); + xbt_datadesc_struct_append(desc,"ctx_mctx",xbt_datadesc_by_name("data pointer")); + xbt_datadesc_struct_append(desc,"ctx_caught",xbt_datadesc_by_name("int")); + xbt_datadesc_struct_append(desc,"exception",xbt_datadesc_by_name("int")); + xbt_datadesc_struct_close(desc); + + xbt_assert(sizeof(e_smx_simcall_t)==sizeof(int), + "I was assuming that e_smx_simcall_t is of the same size than integer, but it's not true: it's %zu (int:%zu)\n", + sizeof(e_smx_simcall_t),sizeof(int)); + xbt_datadesc_copy("e_smx_simcall_t", xbt_datadesc_by_name("int")); +} + +static void parse_from_file(const char *name){ + int in=open(name,O_RDONLY); + if (in==-1){ + fprintf(stderr,"Cannot read structure file from %s: %s\n",name,strerror(errno)); + exit(1); + } + + xbt_strbuff_t strbuff = xbt_strbuff_new(); + int r; + do { + char buffer[1024]; + r = read(in,&buffer,1023); + buffer[r] = '\0'; + xbt_strbuff_append(strbuff,buffer); + } while (r!=0); + + printf("File %s content:\n%s\n",name,strbuff->data); + xbt_datadesc_parse(name,strbuff->data); + +} + +int main(int argc, char** argv) { + xbt_init(&argc, argv); + define_types(); + + if (argc<3) { + fprintf(stderr,"Usage: %s struct-file offset1 offset2 ...\n",argv[0]); + exit(1); + } + + parse_from_file("s_smx_simcall_t"); + parse_from_file(argv[1]); + + int cpt; + xbt_datadesc_type_t type = xbt_datadesc_by_name(argv[1]); + for (cpt=2;cptname, xbt_dynar_length(type->category.struct_data.fields)); + xbt_dynar_foreach(type->category.struct_data.fields,cursor,field) { + if (field->offset[GRAS_THISARCH]<= offset&& + field->offset[GRAS_THISARCH]+field->type->size[GRAS_THISARCH] >= offset) { + found = 1; + printf("This offset is somewhere in field %s, which starts at offset %zu and is of size %zu\n", + field->name,field->offset[GRAS_THISARCH],field->type->size[GRAS_THISARCH]); + + } + } + if (!found) { + + printf("Damnit, the structure is too short to find the the field (last field %s was at offset %zu, with size %zu). Weird.\n", + field->name,field->offset[GRAS_THISARCH],field->type->size[GRAS_THISARCH]); + } + } + return 0; +} + + + diff --git a/tools/gras/unix_stub_generator.c b/tools/gras/unix_stub_generator.c index 87c087a355..4642ef30f0 100644 --- a/tools/gras/unix_stub_generator.c +++ b/tools/gras/unix_stub_generator.c @@ -371,7 +371,7 @@ void generate_makefile_local(char *project, char *deployment) "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<\n" "\n"); fprintf(FICOUT, - "## Rules for tarballs and cleaning\n" + "## Rules for tarballs and cleaning\n" "DIST_FILES= $(EXTRA_DIST) $(GENERATED_C_FILES) $(PRECIOUS_C_FILES) " MAKEFILE_FILENAME_LOCAL " " /*MAKEFILE_FILENAME_REMOTE */ "\n" "distdir: $(DIST_FILES)\n" "\trm -rf $(DISTDIR)\n" diff --git a/tools/sg_unit_extractor.pl b/tools/sg_unit_extractor.pl index 1c6285997c..0aa5faf6de 100755 --- a/tools/sg_unit_extractor.pl +++ b/tools/sg_unit_extractor.pl @@ -240,7 +240,7 @@ EOF last if /SGU: BEGIN SUITES DECLARATION/; } - ### Done with prototypes. And now, the actual code + ### Done with prototypes. And now, the actual code # search my prototype while () {