Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
be compatible with the standard of cmake+MPI
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 16 Jul 2019 23:18:00 +0000 (01:18 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 17 Jul 2019 05:45:11 +0000 (07:45 +0200)
(even if that combination seems somewhat unholy :)

ChangeLog
docs/source/Start_Your_Own_Project.rst
docs/source/app_smpi.rst
src/smpi/smpicc.in
src/smpi/smpicxx.in
src/smpi/smpif90.in
src/smpi/smpiff.in

index c7c9084..205b12e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@ MSG:
 SMPI:
  - Fortran bindings for DVFS have been removed.
  - Add support for MPI_Irsend
+ - SMPI can now be selected by cmake's find_module(MPI) with
+   MPI_C_COMPILER, MPI_CXX_COMPILER, MPI_Fortran_COMPILER variables.
 
 Model-Checker:
  - Option model-checker/hash was removed. This is always activated now.
index bf05453..6297e2e 100644 (file)
@@ -57,6 +57,15 @@ manually but your project will produce relevant error messages when
 trying to compile on a machine where SimGrid is not installed. Please
 also refer to the file header for more information.
 
+MPI projects should include ``find_package (MPI)`` in CMakeLists.txt. Then, the
+variables ``MPI_C_COMPILER``, ``MPI_CXX_COMPILER`` and ``MPI_Fortran_COMPILER`` should
+point to the full path of smpicc, smpicxx and smpiff respectively. Example:
+
+.. code-block:: shell
+
+   cmake -DMPI_C_COMPILER=/opt/simgrid/bin/smpicc -DMPI_CXX_COMPILER=/opt/simgrid/bin/smpicxx -DMPI_Fortran_COMPILER=/opt/simgrid/bin/smpiff .
+
+
 Building your project with Makefile
 -----------------------------------
 
index 31e8b43..2cdd693 100644 (file)
@@ -70,6 +70,14 @@ the right compilation flags along the way. If your application is in
 C++, Fortran 77 or Fortran 90, use respectively ``smpicxx``,
 ``smpiff`` or ``smpif90``.
 
+If you use cmake, set the variables ``MPI_C_COMPILER``, ``MPI_CXX_COMPILER`` and
+``MPI_Fortran_COMPILER`` to the full path of smpicc, smpicxx and smpiff (or
+smpif90), respectively. Example:
+
+.. code-block:: shell
+
+   cmake -DMPI_C_COMPILER=/opt/simgrid/bin/smpicc -DMPI_CXX_COMPILER=/opt/simgrid/bin/smpicxx -DMPI_Fortran_COMPILER=/opt/simgrid/bin/smpiff .
+
 ....................
 Simulating your Code
 ....................
index 9098f97..9ca2c6f 100755 (executable)
@@ -24,7 +24,7 @@ else
 fi
 
 list_set CFLAGS @SMPI_C_FLAGS@
-list_set LINKARGS "-lm"
+list_add LINKARGS
 if [ "x@WIN32@" = "x1" ]; then
     list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
     list_add LINKARGS "@libdir@\libsimgrid.dll"
@@ -48,6 +48,8 @@ else
     list_add LINKARGS "-lsimgrid" ${LINKER_UNDEFINED_ERROR:+"-Wl,-z,defs"}
 fi
 
+# By default, we execute the commands instead of only showing them to cmake
+Show=
 
 list_set CMDARGS
 while [ $# -gt 0 ]; do
@@ -80,7 +82,11 @@ while [ $# -gt 0 ]; do
         '-compiler-version' | '--compiler-version')
             ${CC} --version
             ;;
-        *)
+       '-show'|'-compile-info'|'-link-info')
+            # Dry run displaying commands instead of executing them. Useful to cmake
+           Show=echo
+           ;;
+        *)
             list_add CMDARGS "${ARG}"
             ;;
     esac
@@ -94,4 +100,4 @@ list_add_not_empty CMDLINE "${CMDARGS}"
 list_add_not_empty CMDLINE "${LINKARGS}"
 
 eval $(list_get CMDLINE)
-"$@"
+$Show "$@"
index 9d2a2c8..2630654 100755 (executable)
@@ -32,6 +32,9 @@ else
     list_add LINKARGS "@libdir@\libsimgrid.dll"
 fi
 
+# By default, we execute the commands instead of only showing them to cmake
+Show=
+
 list_set CMDARGS
 while [ $# -gt 0 ]; do
     ARG="$1"
@@ -60,6 +63,10 @@ while [ $# -gt 0 ]; do
         '-compiler-version' | '--compiler-version')
             ${CXX} --version
             ;;
+       '-show'|'-compile-info'|'-link-info')
+            # Dry run displaying commands instead of executing them. Useful to cmake
+           Show=echo
+           ;;
         *)
             list_add CMDARGS "${ARG}"
       ;;
@@ -74,4 +81,4 @@ list_add_not_empty CMDLINE "${CMDARGS}"
 list_add_not_empty CMDLINE "${LINKARGS}"
 
 eval $(list_get CMDLINE)
-"$@"
+$Show "$@"
index aa51d8b..68928b5 100644 (file)
@@ -41,6 +41,9 @@ filter_and_compile() {
 
 NEEDS_OUTPUT=1
 
+# By default, we execute the commands instead of only showing them to cmake
+Show=
+
 list_set CMDLINE "${REAL_FORTRAN_COMPILER}"
 list_add_not_empty CMDLINE "${FFLAGS}"
 while [ $# -gt 0 ]; do
@@ -80,6 +83,10 @@ while [ $# -gt 0 ]; do
             NEEDS_OUTPUT=0
             shift
             ;;
+       '-show'|'-compile-info'|'-link-info')
+            # Dry run displaying commands instead of executing them. Useful to cmake
+           Show=echo
+           ;;
         *)
             list_add CMDLINE "${ARG}"
             ;;
@@ -95,4 +102,4 @@ list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
 list_add_not_empty CMDLINE "${LINKARGS}"
 
 eval $(list_get CMDLINE)
-"$@"
+$Show "$@"
index ea270a4..6b23f7c 100644 (file)
@@ -56,6 +56,9 @@ filter_and_compile_f90() {
 TRACE_CALL_LOCATION=0
 NEEDS_OUTPUT=1
 
+# By default, we execute the commands instead of only showing them to cmake
+Show=
+
 list_set CMDLINE "${REAL_FORTRAN_COMPILER}"
 list_add_not_empty CMDLINE "${FFLAGS}"
 while [ $# -gt 0 ]; do
@@ -113,6 +116,10 @@ while [ $# -gt 0 ]; do
             NEEDS_OUTPUT=0
             shift
             ;;
+       '-show'|'-compile-info'|'-link-info')
+            # Dry run displaying commands instead of executing them. Useful to cmake
+           Show=echo
+           ;;
         *)
             list_add CMDLINE "${ARG}"
             ;;
@@ -128,4 +135,4 @@ list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
 list_add_not_empty CMDLINE "${LINKARGS}"
 
 eval $(list_get CMDLINE)
-"$@"
+$Show "$@"