Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
start refreshing and fixing the GTNetS interface (WIP)
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 19 Jul 2015 00:14:49 +0000 (02:14 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 19 Jul 2015 00:14:49 +0000 (02:14 +0200)
.cproject
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/Modules/FindGTnets.cmake
doc/doxygen/pls.doc
include/simgrid/link.h
src/surf/gtnets/gtnets_simulator.cc
src/surf/network_gtnets.hpp

index 6739911..65f4132 100644 (file)
--- a/.cproject
+++ b/.cproject
@@ -24,6 +24,7 @@
                                                                <option id="gnu.cpp.compiler.option.include.paths.216814103" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
                                                                        <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
                                                                <option id="gnu.cpp.compiler.option.include.paths.216814103" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
                                                                        <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
+                                                                       <listOptionValue builtIn="false" value="/opt/gtnets/include"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1641160853" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1641160853" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
@@ -31,6 +32,7 @@
                                                                <option id="gnu.c.compiler.option.include.paths.100642505" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
                                                                        <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
                                                                <option id="gnu.c.compiler.option.include.paths.100642505" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
                                                                        <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
+                                                                       <listOptionValue builtIn="false" value="/opt/gtnets/include"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.538328935" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.538328935" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
@@ -45,6 +47,7 @@
                                                                <option id="gnu.both.asm.option.include.paths.2076655261" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
                                                                        <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
                                                                <option id="gnu.both.asm.option.include.paths.2076655261" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
                                                                        <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
+                                                                       <listOptionValue builtIn="false" value="/opt/gtnets/include"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2071407067" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
                                                        </tool>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2071407067" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
                                                        </tool>
index 3ff5472..3237bad 100644 (file)
@@ -75,10 +75,6 @@ TEST_BIG_ENDIAN(BIGENDIAN)
 include(FindGraphviz)
 include(FindLibSigc++)
 
 include(FindGraphviz)
 include(FindLibSigc++)
 
-set(HAVE_GTNETS 0)
-if(enable_gtnets)
-  include(FindGTnets)
-endif()
 if(enable_java)
   find_package(Java REQUIRED COMPONENTS Runtime Development)
   find_package(JNI REQUIRED)
 if(enable_java)
   find_package(Java REQUIRED COMPONENTS Runtime Development)
   find_package(JNI REQUIRED)
@@ -99,6 +95,14 @@ endif()
 if(enable_lua)
   include(FindLua51Simgrid)
 endif()
 if(enable_lua)
   include(FindLua51Simgrid)
 endif()
+
+set(HAVE_GTNETS 0)
+if(enable_gtnets)
+  include(FindGTnets)
+  if (NOT HAVE_GTNETS)
+    message(FATAL_ERROR "Cannot find GTNetS. Please install it, or disable that cmake option")
+  endif()
+endif()
 set(HAVE_NS3 0)
 if(enable_ns3)
   include(FindNS3)
 set(HAVE_NS3 0)
 if(enable_ns3)
   include(FindNS3)
index bd12fa6..04e51d6 100644 (file)
@@ -1,9 +1,14 @@
 find_library(HAVE_GTNETS_LIB
 find_library(HAVE_GTNETS_LIB
-  NAME gtnets
-  PATH_SUFFIXES lib64 lib lib64/gtnets lib/gtnets
-  PATHS
-  ${gtnets_path}
+  NAME gtsim
+  PATHS ${gtnets_path} ${gtnets_path}/lib
   )
   )
+  
+if (HAVE_GTNETS_LIB)
+  message(STATUS "Looking for GTNetS library - found")
+else()
+  message(STATUS "Looking for GTNetS library - no found (search path: ${gtnets_path})")
+  message(STATUS "  library file name must be libgtsim.so (not gtnets.so, not libgtsim-opt.so)")
+endif()
 
 find_path(HAVE_SIMULATOR_H
   NAME simulator.h
 
 find_path(HAVE_SIMULATOR_H
   NAME simulator.h
@@ -11,12 +16,17 @@ find_path(HAVE_SIMULATOR_H
   PATHS
   ${gtnets_path}
   )
   PATHS
   ${gtnets_path}
   )
+if (HAVE_GTNETS_LIB)
+  message(STATUS "Looking for GTNetS header simulator.h - found")
+else()
+  message(STATUS "Looking for GTNetS header simulator.h - no found")
+endif()
 
 string(REPLACE "/libgtnets.${LIB_EXE}" ""  GTNETS_LIB_PATH "${HAVE_GTNETS_LIB}")
 
 if(HAVE_GTNETS_LIB AND HAVE_SIMULATOR_H)
 
 
 string(REPLACE "/libgtnets.${LIB_EXE}" ""  GTNETS_LIB_PATH "${HAVE_GTNETS_LIB}")
 
 if(HAVE_GTNETS_LIB AND HAVE_SIMULATOR_H)
 
-  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -I${HAVE_SIMULATOR_H} -lgtnets -L${GTNETS_LIB_PATH} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp
+  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -I${HAVE_SIMULATOR_H} -lgtsim -L${GTNETS_LIB_PATH} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp
     OUTPUT_VARIABLE COMPILE_GTNETS_VAR)
   if(COMPILE_GTNETS_VAR)
     SET(HAVE_GTNETS 0)
     OUTPUT_VARIABLE COMPILE_GTNETS_VAR)
   if(COMPILE_GTNETS_VAR)
     SET(HAVE_GTNETS 0)
@@ -32,7 +42,7 @@ if(HAVE_GTNETS_LIB AND HAVE_SIMULATOR_H)
 
     string(REGEX MATCH "${GTNETS_LIB_PATH}" operation "$ENV{LD_LIBRARY_PATH}")
     if(NOT operation)
 
     string(REGEX MATCH "${GTNETS_LIB_PATH}" operation "$ENV{LD_LIBRARY_PATH}")
     if(NOT operation)
-      message(FATAL_ERROR "\n\nTo use GTNETS don't forget to set LD_LIBRARY_PATH with \n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GTNETS_LIB_PATH}\n\n")
+      message(FATAL_ERROR "\nGTNetS library found but unusable. Did you set LD_LIBRARY_PATH?\n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GTNETS_LIB_PATH}\n\n")
     endif()
 
   endif()
     endif()
 
   endif()
index 5dd9f0a..e8a223f 100644 (file)
@@ -4,117 +4,102 @@ It is possible to use a packet-level network simulator
 instead of the default flow-based simulation. You may want to use such
 an approach if you have doubts about the validity of the default model
 or if you want to perform some validation experiments. At the moment,
 instead of the default flow-based simulation. You may want to use such
 an approach if you have doubts about the validity of the default model
 or if you want to perform some validation experiments. At the moment,
-we support the GTNetS simulator and since version 3.6.2, ns-3.
+we support the NS3 and GTNetS simulators.
 
 
 
 
-\section pls_simgrid_configuration_gtnets Using GTNetS
+\section pls_simgrid_configuration_gtnets GTNetS as a SimGrid model
 
 
+\subsection pls_simgrid_configuration_gtnets_compile Compiling a patched version of  GTNetS
 
 
-<i>
-To enable GTNetS model inside SimGrid it is needed to patch the GTNetS simulator source code
-and build/install it from scratch
-</i>
-
- - <b>Download and enter the recent downloaded GTNetS directory</b>
+GTNetS needs to be patched to work with SimGrid, so the easiest
+solution is to run the following commands:
 
 \verbatim
 
 \verbatim
+# Get the files that we prepared for you
 svn checkout svn://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/GTNetS/
 cd GTNetS
 svn checkout svn://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/GTNetS/
 cd GTNetS
-\endverbatim
-
-
- - <b>Use the following commands to unzip and patch GTNetS package to work within SimGrid.</b>
 
 
-\verbatim
+# Unpack and patch the sources
 unzip gtnets-current.zip
 tar zxvf gtnets-current-patch.tgz
 cd gtnets-current
 unzip gtnets-current.zip
 tar zxvf gtnets-current-patch.tgz
 cd gtnets-current
-cat ../00*.patch | patch -p1
-\endverbatim
-
-  - <b>OPTIONALLY</b> you can use a patch for itanium 64bit processor family.
+cat ../*.patch | patch -p1
 
 
-\verbatim
-cat ../AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch | patch -p1
-\endverbatim
-
- - <b>Compile GTNetS</b>
-
-   Due to portability issues it is possible that GTNetS does not compile in your architecture. The patches furnished in SimGrid SVN repository are intended for use in Linux architecture only. Unfortunately, we do not have the time, the money, neither the manpower to guarantee GTNetS portability. We advice you to use one of GTNetS communication channel to get more help in compiling GTNetS.
-
-
-\verbatim
+# Compile GTNetS
 ln -sf Makefile.linux Makefile
 sed -i 's/-fPIC/-fPIC -fpermissive/g' Makefile
 make depend
 ln -sf Makefile.linux Makefile
 sed -i 's/-fPIC/-fPIC -fpermissive/g' Makefile
 make depend
-make debug
+make opt   # compile an optimized version (required)
+make debug # compile a debug version (optional)
+
+# Install under /opt 
+mkdir -p /opt/gtnets/include /opt/gtnets/lib
+cp -fr SRC/*.h /opt/gtnets/include
+cp libgtsim-opt.so /opt/gtnets/lib/libgtsim.so
 \endverbatim
 
 \endverbatim
 
+Some remarks:
 
 
- - <b>NOTE</b> A lot of warnings are expected but the application should compile
- just fine. If the makefile insists in compiling some QT libraries
- please try a make clean before asking for help.
+<ul>
 
 
+  <li>The patch
+   AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch is
+   only useful if you want to compile on Itanium 64bits (but should be
+   harmless on other architectures). Note that we only provide support
+   for Linux so far.  Your patches are welcome to improve this ;)</li>
 
 
- - <b>To compile optimized version</b>
+  <li>The compilation spits a lot of warnings, but the application
+   should compile by the end. If the makefile insists in compiling
+   some QT libraries please try a make clean before asking for help.</li>
 
 
-\verbatim
-make opt
-\endverbatim
+  <li>If you need to use another version of GTNetS, then you will
+   probably need to modify the patch. Please drop us a line: we will
+   gratefully integrate your work. For the record, the version that we
+   provide were downloaded from <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>
+   on June 12th, 2008.</li>
 
 
+  <li>Of course you can install GTNets wherever you want on your hard
+   disk. We provide the commands for /opt just to help you.</li>
+</ul>
 
 
- - <b>Installing GTNetS</b>
-
- It is important to put the full path of your libgtsim-xxxx.so file when creating the symbolic link. Replace < userhome > by some path you have write access to.
+Add the following to your .bashrc so that it gets defined each time:
 
 \verbatim
 
 \verbatim
-ln -sf /<absolute_path>/gtnets_current/libgtsim-debug.so /<userhome>/usr/lib/libgtnets.so
-export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/<userhome>/usr/lib/
-mkdir /<userhome>/usr/include/gtnets
-cp -fr SRC/*.h /<userhome>/usr/include/gtnets
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/opt/gtnets/lib/
 \endverbatim
 
 \endverbatim
 
+\subsection pls_simgrid_configuration_gtnets_config Enabling SimGrid's support for GTNetS
 
 
- - <b>Enable GTNetS support in SimGrid</b>
-
-In order to enable gtnets with simgrid you have to give where is gtnets. (path to \<gtnets_path\>/lib and \<gtnets_path\>/include)
+You just have to enable GTNetS in ccmake or cmake as follows, and
+recompile SimGrid.
 
 \verbatim
 
 \verbatim
-cmake . -Denable_gtnets=ON -Dgtnets_path=/<userhome>/usr
+cmake . -Denable_gtnets=ON -Dgtnets_path=/opt/gtnets
 \endverbatim
 
 \endverbatim
 
- - <b>Once you have followed all the instructions for compiling and
-   installing successfully you can activate this feature at
-   runntime with the following options:</b>
+By the end of the configuration, cmake reports whether GTNetS was found.
+You can also double-check by executing the tests after the compilation.
 
 \verbatim
 
 \verbatim
-cd simgrid
-make
-ctest -R gtnets
+$ ctest -R gtnets
+(several tests should be run)
 \endverbatim
 
 \endverbatim
 
+\subsection pls_simgrid_configuration_gtnets_use Using GTNetS from SimGrid
 
 
- - <b>Or try the GTNetS model dogbone example with</b>
+A working example can be found in the folder examples/msg/gtnets.
 
 \verbatim
 
 \verbatim
-gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network_model:GTNets
+gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network/model:GTNets
 \endverbatim
 
 \endverbatim
 
+For more information, please refer to the <a
+href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS
+Website</a> or to this
+<a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS
+HowTo.html">possibly outdated longer HowTo</a>
 
 
- A long version of this <a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS HowTo.html">HowTo</a>  it is available
-
-
- More about GTNetS simulator at <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS Website</a>
-
-
- - <b>DISCLAIMER</b>
- The patches provided by us worked successfully with GTNetS found
- <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>,
- dated from 12th June 2008. Due to the discontinuing development of
- GTNetS it is impossible to precise a version number. We STRONGLY recommend you
- to download and install the GTNetS version found in SimGrid repository as explained above.
-
-\section pls_simgrid_configuration_ns3 Using NS3
+\section pls_simgrid_configuration_ns3 NS3 as a SimGrid model
 
 You may want to replace the SimGrid network models by the ones of the
 well known packet-level network simulator <a href="http://www.nsnam.org/">NS-3</a> instead.
 
 You may want to replace the SimGrid network models by the ones of the
 well known packet-level network simulator <a href="http://www.nsnam.org/">NS-3</a> instead.
index ea0d9fa..3f52777 100644 (file)
@@ -8,12 +8,15 @@
 #ifndef INCLUDE_SIMGRID_LINK_H_
 #define INCLUDE_SIMGRID_LINK_H_
 
 #ifndef INCLUDE_SIMGRID_LINK_H_
 #define INCLUDE_SIMGRID_LINK_H_
 
+
 #ifdef __cplusplus
 class Link;
 #else
 typedef struct Link Link;
 #endif
 
 #ifdef __cplusplus
 class Link;
 #else
 typedef struct Link Link;
 #endif
 
+
+
 /* C interface */
 SG_BEGIN_DECL()
 XBT_PUBLIC(int) sg_link_is_shared(Link *link);
 /* C interface */
 SG_BEGIN_DECL()
 XBT_PUBLIC(int) sg_link_is_shared(Link *link);
index 920b915..6c348f7 100644 (file)
@@ -14,6 +14,7 @@
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 #include "RngStream.h"
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 #include "RngStream.h"
+#include <unistd.h> /* pipe */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets_simulator, surf_network_gtnets,
                                 "Logging specific to the SURF network GTNetS simulator");
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets_simulator, surf_network_gtnets,
                                 "Logging specific to the SURF network GTNetS simulator");
index b15f2bb..7f320f4 100644 (file)
@@ -4,7 +4,7 @@
 /* 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 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 "network.hpp"
+#include "network_cm02.hpp"
 
 #ifndef NETWORK_GTNETS_HPP_
 #define NETWORK_GTNETS_HPP_
 
 #ifndef NETWORK_GTNETS_HPP_
 #define NETWORK_GTNETS_HPP_
@@ -21,6 +21,7 @@
 #include "event.h"
 #include "routing-manual.h"
 #include "red.h"
 #include "event.h"
 #include "routing-manual.h"
 #include "red.h"
+#include "surf/gtnets/gtnets_topology.h"
 
 xbt_dict_t network_card_ids;
 
 
 xbt_dict_t network_card_ids;
 
@@ -76,7 +77,7 @@ private:
 
    map<int, TCPServer*> p_gtnetsServers;
    map<int, TCPSend*> p_gtnetsClients;
 
    map<int, TCPServer*> p_gtnetsServers;
    map<int, TCPSend*> p_gtnetsClients;
-   map<int, Linkp2p*> p_gtnetsLinks_;
+   map<int, GTLinkp2p*> p_gtnetsLinks_;
    map<int, Node*> p_gtnetsNodes;
    map<void*, int> p_gtnetsActionToFlow;
 
    map<int, Node*> p_gtnetsNodes;
    map<void*, int> p_gtnetsActionToFlow;