Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 23 Oct 2015 13:25:14 +0000 (15:25 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 23 Oct 2015 13:25:14 +0000 (15:25 +0200)
CMakeLists.txt
examples/msg/energy/vm/CMakeLists.txt
examples/msg/energy/vm/energy_vm.tesh [new file with mode: 0644]
tools/cmake/DefinePackages.cmake
tools/cmake/Distrib.cmake
tools/cmake/GCCFlags.cmake
tools/cmake/PrintArgs.cmake

index 2fe4ab6..c16dfcb 100644 (file)
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 2.6)
-# Java requires 2.8.6
-message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}$")
+cmake_minimum_required(VERSION 2.6) # Java requires 2.8.6
+message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules)
 
 project(SimGrid C CXX)
 
@@ -30,11 +30,11 @@ else() # gcc or clang
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
 
-  if (CMAKE_COMPILER_IS_GNUCC)
-    if (COMPILER_CXX_VERSION_MAJOR_MINOR STRLESS "4.7")
+  if (CMAKE_COMPILER_IS_GNUCC)    
+    if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
       message(FATAL_ERROR
-              "SimGrid needs at least g++ version 4.7 to compile "
-             "(c++11 support of previous versions is too limited).")
+              "SimGrid needs at least g++ version 4.7 to compile but you have ${CMAKE_CXX_COMPILER_VERSION}."
+             "You need a sufficient support of c++11 to compile SimGrid.")
     endif()
   endif()
 
@@ -45,7 +45,7 @@ else() # gcc or clang
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
   else() 
     message(FATAL_ERROR 
-            "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. "
+            "The compiler ${CMAKE_CXX_COMPILER} (v${CMAKE_CXX_COMPILER_VERSION}) has no C++11 support. "
             "Please use a decent C++ compiler.")
   endif()
 
@@ -56,11 +56,11 @@ else() # gcc or clang
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
   else()
     message(FATAL_ERROR 
-            "The compiler ${CMAKE_C_COMPILER} has no C11 support. "
+            "The compiler ${CMAKE_C_COMPILER} (v${CMAKE_C_COMPILER_VERSION}) has no C11 support. "
             "Please use a decent C compiler "
             "(note that c++11 support of ${CMAKE_CXX_COMPILER} seems ok).")
   endif()
-  if(APPLE AND ("4.6" GREATER COMPILER_C_VERSION_MAJOR_MINOR))
+  if(APPLE AND (CMAKE_C_COMPILER_VERSION VERSION_LESS "4.6"))
       ### gcc 4.[1-5] cannot compile ucontext on OSX
       message(STATUS "Ucontext can't be used with this version of gcc (must be greater than 4.5)")
       set(HAVE_UCONTEXT_H 0)
@@ -132,16 +132,6 @@ else()
   endif()
 endif()
 
-if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
-  exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
-  exec_program("${CMAKE_CXX_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_CXX_VERSION")
-  string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
-  string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_CXX_VERSION "${COMPILER_CXX_VERSION}")
-
-  string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_VERSION_MAJOR_MINOR "${COMPILER_C_VERSION}")
-  string(REPLACE "${COMPILER_C_VERSION_MAJOR_MINOR}." "" COMPILER_C_VERSION_PATCH "${COMPILER_C_VERSION}")  
-endif()
-
 exec_program("${CMAKE_LINKER} --version" OUTPUT_VARIABLE "LINKER_VERSION")
 string(REGEX MATCH "[0-9].[0-9]*" LINKER_VERSION "${LINKER_VERSION}")
 
@@ -194,16 +184,9 @@ if(WIN32)
   string(REGEX REPLACE "/bin/gcc.*" "/include"  CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
   string(REGEX REPLACE "/bin/gcc.*" "/lib"  CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
   set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
+  unset(CMAKE_INCLUDE_WIN)
 
-  if(CMAKE_COMPILER_IS_GNUCC)
-    set(__GNUC__ 1)
-    exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
-    string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
-    string(REGEX MATCH "^[0-9]" COMPILER_C_MAJOR_VERSION "${COMPILER_C_VERSION}")
-    string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_MINOR_VERSION "${COMPILER_C_VERSION}")
-    string(REGEX REPLACE "^${COMPILER_C_MAJOR_VERSION}." "" COMPILER_C_MINOR_VERSION "${COMPILER_C_MINOR_VERSION}")
-  endif()
-
+  find_program(NSIS_PROGRAM NAMES makensi)
   set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITEW6432})
   if(NSIS_WIN_VERSION MATCHES "")
     set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITECTURE})
@@ -214,10 +197,9 @@ if(WIN32)
 
   set(_XBT_WIN32 1)
 
-  message(STATUS "C_COMPILER                    ${CMAKE_C_COMPILER} ${COMPILER_C_VERSION_MAJOR_MINOR}")
-  message(STATUS "CXX_COMPILER                  ${CMAKE_CXX_COMPILER} ${COMPILER_CXX_VERSION_MAJOR_MINOR}")
+  message(STATUS "C_COMPILER                    ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION}")
+  message(STATUS "CXX_COMPILER                  ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_VERSION}")
   message(STATUS "CMAKE_RC_COMPILER             ${CMAKE_RC_COMPILER}")
-  message(STATUS "INCLUDE                       ${CMAKE_INCLUDE_WIN}")
   message(STATUS "LIB                           ${CMAKE_LIB_WIN}")
   message(STATUS "MAKE_PROGRAM                  ${CMAKE_MAKE_PROGRAM}")
   message(STATUS "CMAKE_BUILD_TOOL              ${CMAKE_BUILD_TOOL}")
@@ -232,11 +214,6 @@ include_directories(${INCLUDES})
 ### Setup Options
 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Option.cmake)
 
-set(CMAKE_MODULE_PATH
-  ${CMAKE_MODULE_PATH}
-  ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules
-  )
-
 ### Determine the assembly flavor that we need today
 include(CMakeDetermineSystem)
 IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
index db84556..14ae4f6 100644 (file)
@@ -3,10 +3,11 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
 add_executable(energy_vm energy_vm.c)
 
 ### Add definitions for compile
-target_link_libraries(energy_vm simgrid )
+target_link_libraries(energy_vm simgrid)
 
 set(tesh_files
   ${tesh_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/energy_vm.tesh
   PARENT_SCOPE
   )
 
diff --git a/examples/msg/energy/vm/energy_vm.tesh b/examples/msg/energy/vm/energy_vm.tesh
new file mode 100644 (file)
index 0000000..ce66ee7
--- /dev/null
@@ -0,0 +1,23 @@
+#! ./tesh
+
+p Testing the mechanism for computing host energy consumption in case of VMs
+
+$ $SG_TEST_EXENV energy/vm/energy_vm$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:dvfs@MyHost1) Creating and starting two VMs
+> [  0.000000] (0:@) Create VM(vm1)@PM(MyHost1) with 0 mounted disks
+> [  0.000000] (0:@) Create VM(vm2)@PM(MyHost3) with 0 mounted disks
+> [  0.000000] (1:dvfs@MyHost1) Create two tasks on Host1: one inside a VM, the other directly on the host
+> [  0.000000] (1:dvfs@MyHost1) Create two tasks on Host2: both directly on the host
+> [  0.000000] (1:dvfs@MyHost1) Create two tasks on Host3: both inside a VM
+> [  0.000000] (1:dvfs@MyHost1) Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, so they run for 6 seconds)
+> [  5.000000] (1:dvfs@MyHost1) Wait another 5 seconds. The tasks stop at some point in between
+> [  6.000000] (4:p21@MyHost2) This worker is done.
+> [  6.000000] (5:p22@MyHost2) This worker is done.
+> [  6.000000] (3:p12@MyHost1) This worker is done.
+> [  6.000000] (2:p11@vm1) This worker is done.
+> [  6.000000] (6:p31@vm2) This worker is done.
+> [  6.000000] (7:p32@vm2) This worker is done.
+> [ 10.000000] (0:@) Total simulation time: 10.00; All hosts must have the exact same energy consumption.
+> [ 10.000000] (0:@) Total energy of host MyHost1: 1580.000000 Joules
+> [ 10.000000] (0:@) Total energy of host MyHost2: 1600.000000 Joules
+> [ 10.000000] (0:@) Total energy of host MyHost3: 1600.000000 Joules
index 00f033a..e402f08 100644 (file)
@@ -1061,6 +1061,7 @@ set(EXAMPLES_CMAKEFILES_TXT
   examples/msg/energy/onoff/CMakeLists.txt
   examples/msg/energy/vm/CMakeLists.txt
   examples/msg/energy/pstate/CMakeLists.txt
+  examples/msg/energy/vm/CMakeLists.txt
   examples/msg/exception/CMakeLists.txt
   examples/msg/gpu/CMakeLists.txt
   examples/msg/gtnets/CMakeLists.txt 
index 2f9177e..6a2a461 100644 (file)
@@ -360,9 +360,6 @@ add_custom_target(maintainer-clean
   )
 
 if(WIN32)
-  find_program(NSIS_PROGRAM NAMES makensi)
-  message(STATUS "nsis: ${NSIS_PROGRAM}")
-
   if(NSIS_PROGRAM)
     ADD_CUSTOM_TARGET(nsis
       COMMENT "Generating the SimGrid installer for Windows..."
index 11d5caf..15aecc8 100644 (file)
@@ -54,7 +54,7 @@ if(enable_lto) #¬†User wants LTO. Try if we can do that
       AND CMAKE_COMPILER_IS_GNUCC
       AND (NOT enable_model-checking))
     if(WIN32)
-      if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8")
+      if (CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8")
         # On windows, we need 4.8 or higher to enable lto because of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50293
         #
         # We are experiencing assertion failures even with 4.8 on MinGW.
@@ -89,7 +89,7 @@ if(enable_lto) # User wants LTO, and it seems usable. Go for it
   # these objects you have to use the gcc wrappers:
   # gcc-ar, gcc-nm and gcc-ranlib."
   if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU"
-      AND COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8")
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8")
     set (CMAKE_AR gcc-ar)
     set (CMAKE_RANLIB gcc-ranlib)
   endif()
index 32a1398..4bf538f 100644 (file)
@@ -74,10 +74,10 @@ else()
 endif()
 message("")
 message("        Compiler: C .................: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})")
-message("                version .............: ${COMPILER_C_VERSION}")
+message("                version .............: ${CMAKE_C_COMPILER_VERSION}")
 if(CMAKE_CXX_COMPILER)
   message("        Compiler: C++ ...............: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})")
-  message("                version .............: ${COMPILER_CXX_VERSION}")
+  message("                version .............: ${CMAKE_CXX_COMPILER_VERSION}")
 endif()
 if(HAVE_Java)
   message("        Compiler: Javac .............: ${Java_JAVAC_EXECUTABLE}")
@@ -85,7 +85,7 @@ if(HAVE_Java)
 endif()
 if(CMAKE_Fortran_COMPILER)
   message("        Compiler: Fortran ...........: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID})")
-  message("                version .............: ${COMPILER_Fortran_VERSION}")
+  message("                version .............: ${CMAKE_Fortran_COMPILER_VERSION}")
 endif()
 message("        Linker: .....................: ${CMAKE_LINKER}")
 message("                version .............: ${LINKER_VERSION}")