From 6967083bc37d380d732f0f61c6151fdab50b4ef0 Mon Sep 17 00:00:00 2001 From: "Nathan T. Weeks" Date: Wed, 23 May 2018 16:28:35 -0700 Subject: [PATCH 01/10] Remove duplicate R_CallMethodDef --- src/zzz.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/zzz.c b/src/zzz.c index eff2719..55f6b5f 100644 --- a/src/zzz.c +++ b/src/zzz.c @@ -44,7 +44,6 @@ static const R_CallMethodDef callMethods[] = { /* In file "spmd_communicator_spawn.c". */ {"spmd_comm_spawn", (DL_FUNC) &spmd_comm_spawn, 6}, - {"spmd_comm_spawn", (DL_FUNC) &spmd_comm_spawn, 6}, /* In file "spmd_allgather.c". */ {"spmd_allgather_integer", (DL_FUNC) &spmd_allgather_integer, 3}, From 8dce08412b94e52b5243dc0fdfc6d47c5525f7e4 Mon Sep 17 00:00:00 2001 From: "Nathan T. Weeks" Date: Sat, 26 May 2018 03:54:24 -0700 Subject: [PATCH 02/10] Create comm.set.errhandler() alias for spmd.comm.set.errhandler() --- R/spmd_communicator.r | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/spmd_communicator.r b/R/spmd_communicator.r index fe9b2ff..f16b84b 100644 --- a/R/spmd_communicator.r +++ b/R/spmd_communicator.r @@ -11,6 +11,8 @@ spmd.comm.set.errhandler <- function(comm = .pbd_env$SPMD.CT$comm){ invisible(ret) } # End of spmd.comm.set.errhandler(). +comm.set.errhandler <- spmd.comm.set.errhandler + spmd.comm.is.null <- function(comm = .pbd_env$SPMD.CT$comm){ .Call("spmd_comm_is_null", as.integer(comm), PACKAGE = "pbdMPI") } # End of spmd.comm.is.null(). From bbb4b9339e4cb739b13615bedd501a5f4d31aa00 Mon Sep 17 00:00:00 2001 From: wccsnow Date: Sun, 29 Jul 2018 17:00:10 -0400 Subject: [PATCH 03/10] First try of pkg-config. Need more test on Debian. --- DESCRIPTION | 4 +- configure | 214 ++++++++++++++++++++++++++++++++++++++++----------- configure.ac | 173 +++++++++++++++++++++++++++++------------ 3 files changed, 294 insertions(+), 97 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 72d023b..c4cb78f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pbdMPI -Version: 0.3-6 -Date: 2018-04-30 +Version: 0.3-7 +Date: 2018-07-29 Title: Programming with Big Data -- Interface to MPI Authors@R: c(person("Wei-Chen", "Chen", role = c("aut", "cre"), email = "wccsnow@gmail.com"), diff --git a/configure b/configure index f09bb96..9fd2c40 100755 --- a/configure +++ b/configure @@ -650,6 +650,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +PKG_CONFIG OMPI_INFO MPICC SED @@ -2329,14 +2330,91 @@ $as_echo "no" >&6; } fi +# Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test -z "${MPI_INCLUDE_PATH}" ; then if test "$MPITYPE" = "UNKNOWN" -o "$MPITYPE" = "OPENMPI" ; then - if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" ; then + TMP_INC="F" + TMP_LIB="F" + + if test -n "${PKG_CONFIG}" ; then + echo "found pkg-config ..." + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about OpenMPI" >&5 +$as_echo_n "checking if pkg-config knows about OpenMPI... " >&6; } + + if "${PKG_CONFIG}" --exists ompi; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB=${TMP_LIB_DIRS} + fi + + if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + echo "found mpi.h and libmpi.so ..." + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="OPENMPI" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + + if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then echo "found sed, mpicc, and ompi_info ..." - TMP_INC="F" - TMP_LIB="F" TMP_INC_DIRS=`mpicc --showme:incdirs` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" @@ -2390,10 +2468,47 @@ fi if test -z "${MPI_INCLUDE_PATH}" ; then ### MPICH2 users have to specify --with-mpi-type=MPICH2 to get this. if test "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH" -o "$MPITYPE" = "MPICH3" ; then - if test "$SED" != "F" -a "$MPICC" != "F" ; then + TMP_INC="F" + TMP_LIB="F" + + if test -n "${PKG_CONFIG}" ; then + echo "found pkg-config ..." + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about MPICH" >&5 +$as_echo_n "checking if pkg-config knows about MPICH... " >&6; } + + if "${PKG_CONFIG}" --exists mpich2; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB=${TMP_LIB_DIRS} + fi + + if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then + echo "found mpi.h and libmpich.so ..." + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="MPICH2" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + + if test "$SED" != "F" -a "$MPICC" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then echo "found sed and mpicc ..." - TMP_INC="F" - TMP_LIB="F" TMP_CMD=`mpicc -show` echo ">> TMP_CMD = ${TMP_CMD}" @@ -4218,50 +4333,55 @@ if test "x$ac_cv_lib_pthread_main" = xyes; then : fi -if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" ; then +if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "INTELMPI" -o "$MPI_ROOT" = "NONEED"; then MPI_DEFS="-DMPI2" fi -PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" -case "$MPITYPE" in - OPENMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" - ;; - LAM) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" - ;; - MPICH3) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH2) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - INTELMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" - ;; - *) - if test "X${MPI_LDFLAGS}" != "X" ; then - PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" - else - as_fn_error $? "Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it" "$LINENO" 5 - fi - ;; -esac +if test "$MPI_ROOT" = "NONEED"; then + PKG_CPPFLAGS="${MPI_INCLUDE_PATH} ${MPI_DEFS} -D${MPITYPE}" + PKG_LIBS="${MPI_LIBPATH} ${MPI_LIBS}" +else + PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" + case "$MPITYPE" in + OPENMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" + ;; + LAM) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" + ;; + MPICH3) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH2) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + INTELMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" + ;; + *) + if test "X${MPI_LDFLAGS}" != "X" ; then + PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" + else + as_fn_error $? "Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it" "$LINENO" 5 + fi + ;; + esac +fi MPIRUN=`which mpirun` diff --git a/configure.ac b/configure.ac index 54bceb2..4e6af1b 100644 --- a/configure.ac +++ b/configure.ac @@ -105,15 +105,50 @@ AC_CHECK_PROG(SED, sed, sed, "F") AC_CHECK_PROG(MPICC, mpicc, mpicc, "F") AC_CHECK_PROG(OMPI_INFO, ompi_info, ompi_info, "F") dnl AC_CHECK_PROG(MPICH2VERSION, mpich2version, mpich2version, "F") +AC_PATH_PROG(PKG_CONFIG, [pkg-config]) dnl For OpenMPI if test -z "${MPI_INCLUDE_PATH}" ; then if test "$MPITYPE" = "UNKNOWN" -o "$MPITYPE" = "OPENMPI" ; then - if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" ; then + TMP_INC="F" + TMP_LIB="F" + + if test -n "${PKG_CONFIG}" ; then + echo "found pkg-config ..." + AC_MSG_CHECKING([if pkg-config knows about OpenMPI]) + + if "${PKG_CONFIG}" --exists ompi; then + AC_MSG_RESULT([yes]) + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB=${TMP_LIB_DIRS} + fi + + if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + echo "found mpi.h and libmpi.so ..." + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="OPENMPI" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + fi + else + AC_MSG_RESULT([no]) + fi + fi + + if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then echo "found sed, mpicc, and ompi_info ..." - TMP_INC="F" - TMP_LIB="F" TMP_INC_DIRS=`mpicc --showme:incdirs` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" @@ -169,10 +204,45 @@ dnl For MPICH3/MPICH2/MPICH if test -z "${MPI_INCLUDE_PATH}" ; then ### MPICH2 users have to specify --with-mpi-type=MPICH2 to get this. if test "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH" -o "$MPITYPE" = "MPICH3" ; then - if test "$SED" != "F" -a "$MPICC" != "F" ; then + TMP_INC="F" + TMP_LIB="F" + + if test -n "${PKG_CONFIG}" ; then + echo "found pkg-config ..." + AC_MSG_CHECKING([if pkg-config knows about MPICH]) + + dnl I assume pkg-config only works in MPICH2 + if "${PKG_CONFIG}" --exists mpich2; then + AC_MSG_RESULT([yes]) + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB=${TMP_LIB_DIRS} + fi + + if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then + echo "found mpi.h and libmpich.so ..." + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="MPICH2" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + fi + else + AC_MSG_RESULT([no]) + fi + fi + + if test "$SED" != "F" -a "$MPICC" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then echo "found sed and mpicc ..." - TMP_INC="F" - TMP_LIB="F" TMP_CMD=`mpicc -show` echo ">> TMP_CMD = ${TMP_CMD}" @@ -575,51 +645,58 @@ dnl Now we have found the include and lib paths and may know the type AC_CHECK_LIB(util, openpty, [ MPI_LIBS="$MPI_LIBS -lutil" ]) AC_CHECK_LIB(pthread, main, [ MPI_LIBS="$MPI_LIBS -lpthread" ]) -if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" ; then +if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "INTELMPI" -o "$MPI_ROOT" = "NONEED"; then MPI_DEFS="-DMPI2" fi -PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" -case "$MPITYPE" in - OPENMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" - ;; - LAM) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" - ;; - MPICH3) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH2) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - INTELMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" - ;; - *) - dnl suppose MPI_LDFLAGS is provided - if test "X${MPI_LDFLAGS}" != "X" ; then - PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" - else - AC_MSG_ERROR([Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it]) - fi - ;; -esac +if test "$MPI_ROOT" = "NONEED"; then + dnl This is based on pkg-config which may be an easier way in future. + PKG_CPPFLAGS="${MPI_INCLUDE_PATH} ${MPI_DEFS} -D${MPITYPE}" + PKG_LIBS="${MPI_LIBPATH} ${MPI_LIBS}" +else + dnl This was from old Rmpi/pbdMPI for backward comparable. + PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" + case "$MPITYPE" in + OPENMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" + ;; + LAM) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" + ;; + MPICH3) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH2) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + INTELMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" + ;; + *) + dnl suppose MPI_LDFLAGS is provided + if test "X${MPI_LDFLAGS}" != "X" ; then + PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" + else + AC_MSG_ERROR([Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it]) + fi + ;; + esac +fi dnl Echo all flags to see if they are set properly From 1c326581187e94502ea026c4f981be40921fab34 Mon Sep 17 00:00:00 2001 From: snoweye Date: Sun, 29 Jul 2018 20:54:01 -0400 Subject: [PATCH 04/10] Add man help --- man/zz_comm_internal.Rd | 1 + 1 file changed, 1 insertion(+) diff --git a/man/zz_comm_internal.Rd b/man/zz_comm_internal.Rd index 8b1c28a..5220ebf 100644 --- a/man/zz_comm_internal.Rd +++ b/man/zz_comm_internal.Rd @@ -1,4 +1,5 @@ \name{Comm Internal Functions} +\alias{comm.set.errhandler} \alias{comm.sort.integer} \alias{comm.sort.double} \alias{comm.sort.default} From a21eb546a362bea79546af3439c2b2b235d63998 Mon Sep 17 00:00:00 2001 From: snoweye Date: Sun, 29 Jul 2018 21:17:47 -0400 Subject: [PATCH 05/10] Add MPICH2 with pkg-config --- ChangeLog | 4 ++++ configure | 7 +++++-- configure.ac | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9e4003..b1378dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-07-29: Ver. 0.3-7 + * Add "pkg-config" to "configure.ac". + * Check "OpenMPI" and "MPICH2" with "pkg-config" + 2018-05-18: Ver. 0.3-6 * Move "rlecuyer" to Imports. diff --git a/configure b/configure index 9fd2c40..307cbe0 100755 --- a/configure +++ b/configure @@ -2476,7 +2476,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about MPICH" >&5 $as_echo_n "checking if pkg-config knows about MPICH... " >&6; } - if "${PKG_CONFIG}" --exists mpich2; then + if "${PKG_CONFIG}" --exists mpich; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -2486,9 +2486,12 @@ $as_echo "yes" >&6; } TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` + echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" + if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then TMP_INC=${TMP_INC_DIRS} - TMP_LIB=${TMP_LIB_DIRS} + TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" fi if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then diff --git a/configure.ac b/configure.ac index 4e6af1b..f8835c5 100644 --- a/configure.ac +++ b/configure.ac @@ -212,7 +212,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then AC_MSG_CHECKING([if pkg-config knows about MPICH]) dnl I assume pkg-config only works in MPICH2 - if "${PKG_CONFIG}" --exists mpich2; then + if "${PKG_CONFIG}" --exists mpich; then AC_MSG_RESULT([yes]) TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` @@ -221,9 +221,12 @@ if test -z "${MPI_INCLUDE_PATH}" ; then TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` + echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" + if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then TMP_INC=${TMP_INC_DIRS} - TMP_LIB=${TMP_LIB_DIRS} + TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" fi if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then From 4c19fe9026664f175269047ad8706faf77e0124b Mon Sep 17 00:00:00 2001 From: wccsnow Date: Sun, 29 Jul 2018 21:26:59 -0400 Subject: [PATCH 06/10] Remove version from README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index dc6999a..d1f52b2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # pbdMPI -* **Version:** 0.3-4 * **License:** [![License](http://img.shields.io/badge/license-MPL%202-orange.svg?style=flat)](https://www.mozilla.org/MPL/2.0/) * **Download:** [![Download](http://cranlogs.r-pkg.org/badges/pbdMPI)](https://cran.r-project.org/package=pbdMPI) * **Status:** [![Build Status](https://travis-ci.org/snoweye/pbdMPI.png)](https://travis-ci.org/snoweye/pbdMPI) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/snoweye/pbdMPI) From 5ee86a4658162a4af29bd10810f020cb97259b96 Mon Sep 17 00:00:00 2001 From: snoweye Date: Sat, 4 Aug 2018 12:37:59 -0400 Subject: [PATCH 07/10] test --- ChangeLog | 5 +- DESCRIPTION | 15 +++- README.md | 1 + configure | 210 ++++++++++++++++++++++++++------------------------- configure.ac | 188 ++++++++++++++++++++++++--------------------- 5 files changed, 226 insertions(+), 193 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1378dc..062c859 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ +2018-08-03: Ver. 0.3-8 + * Fedora28 use "module load mpi/openmpi-x86_64" to obtain mpiexec. + 2018-07-29: Ver. 0.3-7 * Add "pkg-config" to "configure.ac". - * Check "OpenMPI" and "MPICH2" with "pkg-config" + * Check "OpenMPI" and "MPICH2" with "pkg-config". 2018-05-18: Ver. 0.3-6 * Move "rlecuyer" to Imports. diff --git a/DESCRIPTION b/DESCRIPTION index c4cb78f..7ba2aea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pbdMPI -Version: 0.3-7 -Date: 2018-07-29 +Version: 0.3-8 +Date: 2018-08-03 Title: Programming with Big Data -- Interface to MPI Authors@R: c(person("Wei-Chen", "Chen", role = c("aut", "cre"), email = "wccsnow@gmail.com"), @@ -33,3 +33,14 @@ MailingList: Please send questions and comments regarding pbdR to RBigData@gmail.com NeedsCompilation: yes Maintainer: Wei-Chen Chen +Packaged: 2018-07-30 01:19:36 UTC; snoweye +Author: Wei-Chen Chen [aut, cre], + George Ostrouchov [aut], + Drew Schmidt [aut], + Pragneshkumar Patel [aut], + Hao Yu [aut], + Christian Heckendorf [ctb] (FreeBSD), + Brian Ripley [ctb] (Windows HPC Pack 2012), + R Core team [ctb] (some functions are modified from the base packages) +Repository: CRAN +Date/Publication: 2018-08-01 15:20:14 UTC diff --git a/README.md b/README.md index d1f52b2..dc6999a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # pbdMPI +* **Version:** 0.3-4 * **License:** [![License](http://img.shields.io/badge/license-MPL%202-orange.svg?style=flat)](https://www.mozilla.org/MPL/2.0/) * **Download:** [![Download](http://cranlogs.r-pkg.org/badges/pbdMPI)](https://cran.r-project.org/package=pbdMPI) * **Status:** [![Build Status](https://travis-ci.org/snoweye/pbdMPI.png)](https://travis-ci.org/snoweye/pbdMPI) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/snoweye/pbdMPI) diff --git a/configure b/configure index 307cbe0..21e66cd 100755 --- a/configure +++ b/configure @@ -673,7 +673,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -751,7 +750,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1004,15 +1002,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1150,7 +1139,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1303,7 +1292,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2377,53 +2365,17 @@ if test -z "${MPI_INCLUDE_PATH}" ; then TMP_INC="F" TMP_LIB="F" - if test -n "${PKG_CONFIG}" ; then - echo "found pkg-config ..." - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about OpenMPI" >&5 -$as_echo_n "checking if pkg-config knows about OpenMPI... " >&6; } - - if "${PKG_CONFIG}" --exists ompi; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` - echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` - echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - - if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB=${TMP_LIB_DIRS} - fi - - if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "found mpi.h and libmpi.so ..." - echo ">> TMP_INC = ${TMP_INC}" - echo ">> TMP_LIB = ${TMP_LIB}" - MPITYPE="OPENMPI" - MPI_INCLUDE_PATH="${TMP_INC}" - MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - - if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then - echo "found sed, mpicc, and ompi_info ..." + if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" ; then + echo "Try sed, mpicc, and ompi_info ..." TMP_INC_DIRS=`mpicc --showme:incdirs` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" TMP_IFS="${IFS}"; IFS=" " for dir in ${TMP_INC_DIRS}; do - echo "checking ${dir} ..." + echo "Checking ${dir} ..." if test -f "${dir}/mpi.h" ; then - echo "found ${dir}/mpi.h ..." + echo "Found ${dir}/mpi.h ..." TMP_INC=${dir} break fi @@ -2435,15 +2387,15 @@ $as_echo "no" >&6; } TMP_IFS="${IFS}"; IFS=" " for dir in ${TMP_LIB_DIRS}; do - echo "checking ${dir} ..." + echo "Checking ${dir} ..." if test -f "${dir}/libmpi.so" ; then - echo "found ${dir}/libmpi.so ..." + echo "Found ${dir}/libmpi.so ..." TMP_LIB=${dir} TMP_LIBNAME="libmpi.so" break fi if test -f "${dir}/libmpi.dylib" ; then - echo "found ${dir}/libmpi.dylib ..." + echo "Found ${dir}/libmpi.dylib ..." TMP_LIB=${dir} TMP_LIBNAME="libmpi.dylib" break @@ -2452,15 +2404,58 @@ $as_echo "no" >&6; } IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "found mpi.h and libmpi.so ..." + echo "Found mpi.h and libmpi.so ... via mpicc --showme" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="OPENMPI" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" + else + echo "Found no mpi.h or libmpi.so ... via mpicc --showme" fi fi + + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then + if test -n "${PKG_CONFIG}" ; then + echo "Try pkg-config ..." + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about OpenMPI" >&5 +$as_echo_n "checking if pkg-config knows about OpenMPI... " >&6; } + + if "${PKG_CONFIG}" --exists ompi; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB=${TMP_LIB_DIRS} + fi + + if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + echo "Found mpi.h and libmpi.so ... via pkg-config" + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="OPENMPI" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + else + echo "Found no mpi.h or libmpi.so ... via pkg-config" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + fi + fi fi @@ -2471,47 +2466,8 @@ if test -z "${MPI_INCLUDE_PATH}" ; then TMP_INC="F" TMP_LIB="F" - if test -n "${PKG_CONFIG}" ; then - echo "found pkg-config ..." - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about MPICH" >&5 -$as_echo_n "checking if pkg-config knows about MPICH... " >&6; } - - if "${PKG_CONFIG}" --exists mpich; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` - echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` - echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - - TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` - echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" - - if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" - fi - - if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then - echo "found mpi.h and libmpich.so ..." - echo ">> TMP_INC = ${TMP_INC}" - echo ">> TMP_LIB = ${TMP_LIB}" - MPITYPE="MPICH2" - MPI_INCLUDE_PATH="${TMP_INC}" - MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - - if test "$SED" != "F" -a "$MPICC" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then - echo "found sed and mpicc ..." + if test "$SED" != "F" -a "$MPICC" != "F" ; then + echo "Try sed and mpicc ..." TMP_CMD=`mpicc -show` echo ">> TMP_CMD = ${TMP_CMD}" @@ -2524,9 +2480,9 @@ $as_echo "no" >&6; } dir_inc=`echo ${dir} | sed -e "s/-I\(.*\)/\1/"` fi - echo "checking ${dir_inc} ..." + echo "Checking ${dir_inc} ..." if test -f "${dir_inc}/mpi.h" ; then - echo "found ${dir_inc}/mpi.h ..." + echo "Found ${dir_inc}/mpi.h ..." TMP_INC=${dir_inc} break fi @@ -2541,15 +2497,15 @@ $as_echo "no" >&6; } dir_lib=`echo ${dir} | sed -e "s/-L\(.*\)/\1/"` fi - echo "checking ${dir_lib} ..." + echo "Checking ${dir_lib} ..." if test -f "${dir_lib}/libmpich.so" ; then - echo "found ${dir_lib}/libmpich.so ..." + echo "Found ${dir_lib}/libmpich.so ... via mpicc --show & sed" TMP_LIB=${dir_lib} TMP_LIBNAME="libmpich.so" break fi if test -f "${dir_lib}/libmpich.dylib" ; then - echo "found ${dir_lib}/libmpich.dylib ..." + echo "Found ${dir_lib}/libmpich.dylib ... via mpicc --show & sed" TMP_LIB=${dir_lib} TMP_LIBNAME="libmpich.dylib" break @@ -2558,15 +2514,61 @@ $as_echo "no" >&6; } IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "found mpi.h and libmpich.so ..." + echo "Found mpi.h and libmpich.so ... via mpicc --show & sed" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="${MPITYPE}" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" + else + echo "Found no mpi.h or libmpi.so ... via mpicc --show & sed" fi fi + + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then + if test -n "${PKG_CONFIG}" ; then + echo "Try pkg-config ..." + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about MPICH" >&5 +$as_echo_n "checking if pkg-config knows about MPICH... " >&6; } + + if "${PKG_CONFIG}" --exists mpich; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` + echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" + + if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" + fi + + if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then + echo "Found mpi.h and libmpich.so ... via pkg-config" + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="MPICH2" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + else + echo "Found no mpi.h or libmpi.so ... via pkg-config" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + fi + fi fi diff --git a/configure.ac b/configure.ac index f8835c5..5ed7131 100644 --- a/configure.ac +++ b/configure.ac @@ -114,50 +114,17 @@ if test -z "${MPI_INCLUDE_PATH}" ; then TMP_INC="F" TMP_LIB="F" - if test -n "${PKG_CONFIG}" ; then - echo "found pkg-config ..." - AC_MSG_CHECKING([if pkg-config knows about OpenMPI]) - - if "${PKG_CONFIG}" --exists ompi; then - AC_MSG_RESULT([yes]) - - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` - echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` - echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - - if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB=${TMP_LIB_DIRS} - fi - - if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "found mpi.h and libmpi.so ..." - echo ">> TMP_INC = ${TMP_INC}" - echo ">> TMP_LIB = ${TMP_LIB}" - MPITYPE="OPENMPI" - MPI_INCLUDE_PATH="${TMP_INC}" - MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" - fi - else - AC_MSG_RESULT([no]) - fi - fi - - if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then - echo "found sed, mpicc, and ompi_info ..." + if test "$SED" != "F" -a "$MPICC" != "F" -a "$OMPI_INFO" != "F" ; then + echo "Try sed, mpicc, and ompi_info ..." TMP_INC_DIRS=`mpicc --showme:incdirs` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" TMP_IFS="${IFS}"; IFS=" " for dir in ${TMP_INC_DIRS}; do - echo "checking ${dir} ..." + echo "Checking ${dir} ..." if test -f "${dir}/mpi.h" ; then - echo "found ${dir}/mpi.h ..." + echo "Found ${dir}/mpi.h ..." TMP_INC=${dir} break fi @@ -169,16 +136,16 @@ if test -z "${MPI_INCLUDE_PATH}" ; then TMP_IFS="${IFS}"; IFS=" " for dir in ${TMP_LIB_DIRS}; do - echo "checking ${dir} ..." + echo "Checking ${dir} ..." if test -f "${dir}/libmpi.so" ; then - echo "found ${dir}/libmpi.so ..." + echo "Found ${dir}/libmpi.so ..." TMP_LIB=${dir} TMP_LIBNAME="libmpi.so" break fi dnl For Mac OS X if test -f "${dir}/libmpi.dylib" ; then - echo "found ${dir}/libmpi.dylib ..." + echo "Found ${dir}/libmpi.dylib ..." TMP_LIB=${dir} TMP_LIBNAME="libmpi.dylib" break @@ -187,15 +154,56 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "found mpi.h and libmpi.so ..." + echo "Found mpi.h and libmpi.so ... via mpicc --showme" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="OPENMPI" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" + else + echo "Found no mpi.h or libmpi.so ... via mpicc --showme" fi fi + + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then + dnl try "pkg-config" + if test -n "${PKG_CONFIG}" ; then + echo "Try pkg-config ..." + AC_MSG_CHECKING([if pkg-config knows about OpenMPI]) + + if "${PKG_CONFIG}" --exists ompi; then + AC_MSG_RESULT([yes]) + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB=${TMP_LIB_DIRS} + fi + + if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + echo "Found mpi.h and libmpi.so ... via pkg-config" + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="OPENMPI" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + else + echo "Found no mpi.h or libmpi.so ... via pkg-config" + fi + else + AC_MSG_RESULT([no]) + fi + fi + fi + fi fi @@ -207,45 +215,8 @@ if test -z "${MPI_INCLUDE_PATH}" ; then TMP_INC="F" TMP_LIB="F" - if test -n "${PKG_CONFIG}" ; then - echo "found pkg-config ..." - AC_MSG_CHECKING([if pkg-config knows about MPICH]) - - dnl I assume pkg-config only works in MPICH2 - if "${PKG_CONFIG}" --exists mpich; then - AC_MSG_RESULT([yes]) - - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` - echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` - echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - - TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` - echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" - - if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" - fi - - if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then - echo "found mpi.h and libmpich.so ..." - echo ">> TMP_INC = ${TMP_INC}" - echo ">> TMP_LIB = ${TMP_LIB}" - MPITYPE="MPICH2" - MPI_INCLUDE_PATH="${TMP_INC}" - MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" - fi - else - AC_MSG_RESULT([no]) - fi - fi - - if test "$SED" != "F" -a "$MPICC" != "F" -a "$TMP_INC" = "F" -a "$TMP_LIB" = "F" ; then - echo "found sed and mpicc ..." + if test "$SED" != "F" -a "$MPICC" != "F" ; then + echo "Try sed and mpicc ..." TMP_CMD=`mpicc -show` echo ">> TMP_CMD = ${TMP_CMD}" @@ -260,9 +231,9 @@ if test -z "${MPI_INCLUDE_PATH}" ; then dir_inc=`echo ${dir} | sed -e "s/-I\(.*\)/\1/"` fi - echo "checking ${dir_inc} ..." + echo "Checking ${dir_inc} ..." if test -f "${dir_inc}/mpi.h" ; then - echo "found ${dir_inc}/mpi.h ..." + echo "Found ${dir_inc}/mpi.h ..." TMP_INC=${dir_inc} break fi @@ -279,16 +250,16 @@ if test -z "${MPI_INCLUDE_PATH}" ; then dir_lib=`echo ${dir} | sed -e "s/-L\(.*\)/\1/"` fi - echo "checking ${dir_lib} ..." + echo "Checking ${dir_lib} ..." if test -f "${dir_lib}/libmpich.so" ; then - echo "found ${dir_lib}/libmpich.so ..." + echo "Found ${dir_lib}/libmpich.so ... via mpicc --show & sed" TMP_LIB=${dir_lib} TMP_LIBNAME="libmpich.so" break fi dnl For Mac OS X if test -f "${dir_lib}/libmpich.dylib" ; then - echo "found ${dir_lib}/libmpich.dylib ..." + echo "Found ${dir_lib}/libmpich.dylib ... via mpicc --show & sed" TMP_LIB=${dir_lib} TMP_LIBNAME="libmpich.dylib" break @@ -297,15 +268,60 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "found mpi.h and libmpich.so ..." + echo "Found mpi.h and libmpich.so ... via mpicc --show & sed" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="${MPITYPE}" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" + else + echo "Found no mpi.h or libmpi.so ... via mpicc --show & sed" + fi + fi + + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then + dnl try "pkg-config" + if test -n "${PKG_CONFIG}" ; then + echo "Try pkg-config ..." + AC_MSG_CHECKING([if pkg-config knows about MPICH]) + + dnl I assume pkg-config only works in MPICH2 + if "${PKG_CONFIG}" --exists mpich; then + AC_MSG_RESULT([yes]) + + TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` + echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` + echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" + + TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` + echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" + + if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then + TMP_INC=${TMP_INC_DIRS} + TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" + fi + + if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then + echo "Found mpi.h and libmpich.so ... via pkg-config" + echo ">> TMP_INC = ${TMP_INC}" + echo ">> TMP_LIB = ${TMP_LIB}" + MPITYPE="MPICH2" + MPI_INCLUDE_PATH="${TMP_INC}" + MPI_LIBPATH="${TMP_LIB}" + MPI_LIBNAME="" + MPI_ROOT="NONEED" + else + echo "Found no mpi.h or libmpi.so ... via pkg-config" + fi + else + AC_MSG_RESULT([no]) + fi fi fi + fi fi From d1b6cea08650b4b2317b6333299b95f5c3ff0af3 Mon Sep 17 00:00:00 2001 From: snoweye Date: Sat, 4 Aug 2018 22:33:34 -0400 Subject: [PATCH 08/10] More modification to pkg-config --- ChangeLog | 2 + DESCRIPTION | 2 +- configure | 210 +++++++++++++++++++++++++++------------------- configure.ac | 232 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 266 insertions(+), 180 deletions(-) diff --git a/ChangeLog b/ChangeLog index 062c859..f1eea27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2018-08-03: Ver. 0.3-8 * Fedora28 use "module load mpi/openmpi-x86_64" to obtain mpiexec. + * Roll back partially to Ver. 0.3-6 because pkg-config may give linking order + differently that may triggle some dynamic loading problems. 2018-07-29: Ver. 0.3-7 * Add "pkg-config" to "configure.ac". diff --git a/DESCRIPTION b/DESCRIPTION index 7ba2aea..99aa141 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pbdMPI Version: 0.3-8 -Date: 2018-08-03 +Date: 2018-08-04 Title: Programming with Big Data -- Interface to MPI Authors@R: c(person("Wei-Chen", "Chen", role = c("aut", "cre"), email = "wccsnow@gmail.com"), diff --git a/configure b/configure index 21e66cd..7558955 100755 --- a/configure +++ b/configure @@ -2416,6 +2416,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then fi fi + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then if test -n "${PKG_CONFIG}" ; then echo "Try pkg-config ..." @@ -2426,28 +2427,51 @@ $as_echo_n "checking if pkg-config knows about OpenMPI... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` + TMP_INC_DIRS=`"${PKG_CONFIG}" --variable=includedir ompi` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_INC_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/mpi.h" ; then + echo "Found ${dir}/mpi.h ..." + TMP_INC=${dir} + break + fi + done + IFS="${TMP_IFS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --variable=libdir ompi` echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB=${TMP_LIB_DIRS} - fi + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_LIB_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/libmpi.so" ; then + echo "Found ${dir}/libmpi.so ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpi.so" + break + fi + if test -f "${dir}/libmpi.dylib" ; then + echo "Found ${dir}/libmpi.dylib ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpi.dylib" + break + fi + done + IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "Found mpi.h and libmpi.so ... via pkg-config" + echo "Found mpi.h and libmpi.so ... via pkg-config ... ompi" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="OPENMPI" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" + MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via pkg-config" + echo "Found no mpi.h or libmpi.so ... via pkg-config ... ompi" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -2456,6 +2480,7 @@ $as_echo "no" >&6; } fi fi + fi fi @@ -2522,45 +2547,66 @@ if test -z "${MPI_INCLUDE_PATH}" ; then MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via mpicc --show & sed" + echo "Found no mpi.h or libmpich.so ... via mpicc --show & sed" fi fi + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then if test -n "${PKG_CONFIG}" ; then echo "Try pkg-config ..." { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config knows about MPICH" >&5 $as_echo_n "checking if pkg-config knows about MPICH... " >&6; } - if "${PKG_CONFIG}" --exists mpich; then + if "${PKG_CONFIG}" --exists mpich; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` + TMP_INC_DIRS=`"${PKG_CONFIG}" --variable=includedir mpich` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_INC_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/mpi.h" ; then + echo "Found ${dir}/mpi.h ..." + TMP_INC=${dir} + break + fi + done + IFS="${TMP_IFS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --variable=libdir mpich` echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` - echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" - - if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" - fi + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_LIB_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/libmpich.so" ; then + echo "Found ${dir}/libmpich.so ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpi.so" + break + fi + if test -f "${dir}/libmpich.dylib" ; then + echo "Found ${dir}/libmpich.dylib ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpich.dylib" + break + fi + done + IFS="${TMP_IFS}" - if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then - echo "Found mpi.h and libmpich.so ... via pkg-config" + if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + echo "Found mpi.h and libmpich.so ... via pkg-config ... mpich" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" - MPITYPE="MPICH2" + MPITYPE="${MPITYPE}" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" + MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via pkg-config" + echo "Found no mpi.h or libmpich.so ... via pkg-config ... mpich" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -2569,6 +2615,7 @@ $as_echo "no" >&6; } fi fi + fi fi @@ -2599,57 +2646,57 @@ fi /usr/lib64/mpi/gcc/ompi \ /usr/local/mpi/openmpi ; do if test -f $d/include/openmpi-i386/mpi.h && test -d $d/lib/openmpi/lib; then - echo "I am here $d and it is openmpi" + echo "I am here $d and it is OpenMPI (Fedora 17+, openmpi-i386)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi-x86_64/mpi.h && test -d $d/lib/openmpi/lib; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (Fedora 17+, openmpi-x86_64)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi-x86_64/mpi.h && test -d $d/lib64/openmpi/lib; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (Fedora 17+, lib64)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib64/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib64/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi/mpi.h && test -d $d/lib/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/openmpi, /lib/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi/mpi.h && test -d $d/lib64/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/openmpi, /lib64/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib64/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib64/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/ompi/mpi.h && test -d $d/lib/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/ompi, /lib/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/ompi/mpi.h && test -d $d/lib64/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/ompi, /lib64/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break @@ -4338,55 +4385,50 @@ if test "x$ac_cv_lib_pthread_main" = xyes; then : fi -if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "INTELMPI" -o "$MPI_ROOT" = "NONEED"; then +if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "INTELMPI" ; then MPI_DEFS="-DMPI2" fi -if test "$MPI_ROOT" = "NONEED"; then - PKG_CPPFLAGS="${MPI_INCLUDE_PATH} ${MPI_DEFS} -D${MPITYPE}" - PKG_LIBS="${MPI_LIBPATH} ${MPI_LIBS}" -else - PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" - case "$MPITYPE" in - OPENMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" - ;; - LAM) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" - ;; - MPICH3) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH2) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - INTELMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" - ;; - *) - if test "X${MPI_LDFLAGS}" != "X" ; then - PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" - else - as_fn_error $? "Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it" "$LINENO" 5 - fi - ;; - esac -fi +PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" +case "$MPITYPE" in + OPENMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" + ;; + LAM) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" + ;; + MPICH3) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH2) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + INTELMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" + ;; + *) + if test "X${MPI_LDFLAGS}" != "X" ; then + PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" + else + as_fn_error $? "Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it" "$LINENO" 5 + fi + ;; +esac MPIRUN=`which mpirun` diff --git a/configure.ac b/configure.ac index 5ed7131..a19be02 100644 --- a/configure.ac +++ b/configure.ac @@ -166,6 +166,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then fi fi + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then dnl try "pkg-config" if test -n "${PKG_CONFIG}" ; then @@ -175,28 +176,52 @@ if test -z "${MPI_INCLUDE_PATH}" ; then if "${PKG_CONFIG}" --exists ompi; then AC_MSG_RESULT([yes]) - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags ompi` + TMP_INC_DIRS=`"${PKG_CONFIG}" --variable=includedir ompi` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs ompi` + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_INC_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/mpi.h" ; then + echo "Found ${dir}/mpi.h ..." + TMP_INC=${dir} + break + fi + done + IFS="${TMP_IFS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --variable=libdir ompi` echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - if test "${TMP_INC_DIRS}" != "" -a "${TMP_LIB_DIRS}" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB=${TMP_LIB_DIRS} - fi + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_LIB_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/libmpi.so" ; then + echo "Found ${dir}/libmpi.so ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpi.so" + break + fi + dnl For Mac OS X + if test -f "${dir}/libmpi.dylib" ; then + echo "Found ${dir}/libmpi.dylib ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpi.dylib" + break + fi + done + IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "Found mpi.h and libmpi.so ... via pkg-config" + echo "Found mpi.h and libmpi.so ... via pkg-config ... ompi" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="OPENMPI" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" + MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via pkg-config" + echo "Found no mpi.h or libmpi.so ... via pkg-config ... ompi" fi else AC_MSG_RESULT([no]) @@ -204,6 +229,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then fi fi + fi fi @@ -276,45 +302,66 @@ if test -z "${MPI_INCLUDE_PATH}" ; then MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via mpicc --show & sed" + echo "Found no mpi.h or libmpich.so ... via mpicc --show & sed" fi fi + if test "$TMP_INC" = "F" -o "$TMP_LIB" = "F" ; then dnl try "pkg-config" if test -n "${PKG_CONFIG}" ; then echo "Try pkg-config ..." AC_MSG_CHECKING([if pkg-config knows about MPICH]) - dnl I assume pkg-config only works in MPICH2 if "${PKG_CONFIG}" --exists mpich; then AC_MSG_RESULT([yes]) - TMP_INC_DIRS=`"${PKG_CONFIG}" --cflags mpich` + TMP_INC_DIRS=`"${PKG_CONFIG}" --variable=includedir mpich` echo ">> TMP_INC_DIRS = ${TMP_INC_DIRS}" - TMP_LIB_DIRS=`"${PKG_CONFIG}" --libs mpich` + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_INC_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/mpi.h" ; then + echo "Found ${dir}/mpi.h ..." + TMP_INC=${dir} + break + fi + done + IFS="${TMP_IFS}" + + TMP_LIB_DIRS=`"${PKG_CONFIG}" --variable=libdir mpich` echo ">> TMP_LIB_DIRS = ${TMP_LIB_DIRS}" - TMP_LIB_PATH=`"${PKG_CONFIG}" --variable=libdir mpich` - echo ">> TMP_LIB_PATH = ${TMP_LIB_PATH}" + TMP_IFS="${IFS}"; IFS=" " + for dir in ${TMP_LIB_DIRS}; do + echo "Checking ${dir} ..." + if test -f "${dir}/libmpich.so" ; then + echo "Found ${dir}/libmpich.so ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpi.so" + break + fi + dnl For Mac OS X + if test -f "${dir}/libmpich.dylib" ; then + echo "Found ${dir}/libmpich.dylib ..." + TMP_LIB=${dir} + TMP_LIBNAME="libmpich.dylib" + break + fi + done + IFS="${TMP_IFS}" - if test "$TMP_INC_DIRS" != "" -a "$TMP_LIB_DIRS" != "" ; then - TMP_INC=${TMP_INC_DIRS} - TMP_LIB="-L${TMP_LIB_PATH} ${TMP_LIB_DIRS}" - fi - - if test "$TMP_INC" != "" -a "$TMP_LIB" != "" ; then - echo "Found mpi.h and libmpich.so ... via pkg-config" + if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + echo "Found mpi.h and libmpich.so ... via pkg-config ... mpich" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" - MPITYPE="MPICH2" + MPITYPE="${MPITYPE}" MPI_INCLUDE_PATH="${TMP_INC}" MPI_LIBPATH="${TMP_LIB}" - MPI_LIBNAME="" - MPI_ROOT="NONEED" + MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via pkg-config" + echo "Found no mpi.h or libmpich.so ... via pkg-config ... mpich" fi else AC_MSG_RESULT([no]) @@ -322,6 +369,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then fi fi + fi fi @@ -354,60 +402,60 @@ if test -z "${MPI_INCLUDE_PATH}" ; then /usr/lib64/mpi/gcc/ompi \ /usr/local/mpi/openmpi ; do if test -f $d/include/openmpi-i386/mpi.h && test -d $d/lib/openmpi/lib; then - dnl This is what Fedora 17 had - echo "I am here $d and it is openmpi" + dnl This is what Fedora 17+ had + echo "I am here $d and it is OpenMPI (Fedora 17+, openmpi-i386)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi-x86_64/mpi.h && test -d $d/lib/openmpi/lib; then - dnl This is what Fedora 17 had - echo "I am here $d and it is OpenMPI" + dnl This is what Fedora 17+ had + echo "I am here $d and it is OpenMPI (Fedora 17+, openmpi-x86_64)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi-x86_64/mpi.h && test -d $d/lib64/openmpi/lib; then - dnl This is what Fedora 17 had - echo "I am here $d and it is OpenMPI" + dnl This is what Fedora 17+ had + echo "I am here $d and it is OpenMPI (Fedora 17+, lib64)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib64/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib64/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi/mpi.h && test -d $d/lib/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/openmpi, /lib/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/openmpi/mpi.h && test -d $d/lib64/openmpi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/openmpi, /lib64/openmpi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/mpi.h && test -d $d/lib64/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include, /lib64/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/ompi/mpi.h && test -d $d/lib/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/ompi, /lib/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break elif test -f $d/include/ompi/mpi.h && test -d $d/lib64/ompi; then - echo "I am here $d and it is OpenMPI" + echo "I am here $d and it is OpenMPI (/include/ompi, /lib64/ompi)" MPI_ROOT=$d MPITYPE="OPENMPI" break @@ -504,11 +552,11 @@ if test -z "${MPI_INCLUDE_PATH}" ; then echo "Trying to find mpi.h ..." if test -f ${MPI_ROOT}/include/openmpi-i386/mpi.h; then - dnl This is what Fedora 17 had + dnl This is what Fedora 17+ had echo "Found in ${MPI_ROOT}/include/openmpi-i386" MPI_INCLUDE_PATH="${MPI_ROOT}/include/openmpi-i386" elif test -f ${MPI_ROOT}/include/openmpi-x86_64/mpi.h; then - dnl This is what Fedora 17 had + dnl This is what Fedora 17+ had echo "Found in ${MPI_ROOT}/include/openmpi-x86_64" MPI_INCLUDE_PATH="${MPI_ROOT}/include/openmpi-x86_64" elif test -f ${MPI_ROOT}/include/openmpi/mpi.h; then @@ -549,12 +597,12 @@ if test -z "${MPI_INCLUDE_PATH}" ; then MPI_LIBPATH="${MPI_ROOT}" MPI_LIBNAME="libmpi.so" elif test -f ${MPI_ROOT}/lib/openmpi/lib/libmpi.so; then - dnl This is what Fedora 17 had + dnl This is what Fedora 17+ had echo "Found libmpi in ${MPI_ROOT}/lib/openmpi/lib" MPI_LIBPATH="${MPI_ROOT}/lib/openmpi/lib" MPI_LIBNAME="libmpi.so" elif test -f ${MPI_ROOT}/lib64/openmpi/lib/libmpi.so; then - dnl This is what Fedora 17 had + dnl This is what Fedora 17+ had echo "Found libmpi in ${MPI_ROOT}/lib64/openmpi/lib" MPI_LIBPATH="${MPI_ROOT}/lib64/openmpi/lib" MPI_LIBNAME="libmpi.so" @@ -654,7 +702,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then fi fi -fi dnl Dnd of 'Paths not specified' +fi dnl End of 'Paths not specified' @@ -664,58 +712,52 @@ dnl Now we have found the include and lib paths and may know the type AC_CHECK_LIB(util, openpty, [ MPI_LIBS="$MPI_LIBS -lutil" ]) AC_CHECK_LIB(pthread, main, [ MPI_LIBS="$MPI_LIBS -lpthread" ]) -if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "INTELMPI" -o "$MPI_ROOT" = "NONEED"; then +if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "INTELMPI" ; then MPI_DEFS="-DMPI2" fi -if test "$MPI_ROOT" = "NONEED"; then - dnl This is based on pkg-config which may be an easier way in future. - PKG_CPPFLAGS="${MPI_INCLUDE_PATH} ${MPI_DEFS} -D${MPITYPE}" - PKG_LIBS="${MPI_LIBPATH} ${MPI_LIBS}" -else - dnl This was from old Rmpi/pbdMPI for backward comparable. - PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" - case "$MPITYPE" in - OPENMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" - ;; - LAM) - PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" - ;; - MPICH3) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH2) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - MPICH) - if test "X$ENABLE_OPA" = "Xyes" ; then - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" - else - PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" - fi - ;; - INTELMPI) - PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" - ;; - *) - dnl suppose MPI_LDFLAGS is provided - if test "X${MPI_LDFLAGS}" != "X" ; then - PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" - else - AC_MSG_ERROR([Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it]) - fi - ;; - esac -fi +dnl This was from old Rmpi/pbdMPI for backward comparable. +PKG_CPPFLAGS="-I${MPI_INCLUDE_PATH} ${MPI_INCL2} ${MPI_DEFS} -D${MPITYPE}" +case "$MPITYPE" in + OPENMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi ${MPI_LIBS}" + ;; + LAM) + PKG_LIBS="-L${MPI_LIBPATH} -lmpi -llam ${MPI_LIBS}" + ;; + MPICH3) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH2) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + MPICH) + if test "X$ENABLE_OPA" = "Xyes" ; then + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" + else + PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl ${MPI_LIBS}" + fi + ;; + INTELMPI) + PKG_LIBS="-L${MPI_LIBPATH} -lmpigf -lmpi -lmpigi ${MPI_LIBS}" + ;; + *) + dnl suppose MPI_LDFLAGS is provided + if test "X${MPI_LDFLAGS}" != "X" ; then + PKG_LIBS="${MPI_LDFLAGS} ${MPI_LIBS}" + else + AC_MSG_ERROR([Unknown type of mpi: use --with-mpi-type or MPI_TYPE to specify it]) + fi + ;; +esac dnl Echo all flags to see if they are set properly From fb13191dc76c07dd54c9851095b969ffd508428e Mon Sep 17 00:00:00 2001 From: wccsnow Date: Sun, 5 Aug 2018 11:43:45 -0400 Subject: [PATCH 09/10] updates --- configure | 35 ++++++++++++++++++++++++++++++----- configure.ac | 22 +++++++++++++++++----- src/Makevars.in | 1 + 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 7558955..49a17cf 100755 --- a/configure +++ b/configure @@ -634,6 +634,7 @@ MPI_LIBPATH MPI_INCLUDE_PATH MPITYPE MPI_ROOT +TMP_FOUND TMP_LIBNAME TMP_LIB TMP_INC @@ -673,6 +674,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -750,6 +752,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1002,6 +1005,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1139,7 +1151,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1292,6 +1304,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2404,6 +2417,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + TMP_FOUND="mpicc --showme" echo "Found mpi.h and libmpi.so ... via mpicc --showme" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" @@ -2463,7 +2477,8 @@ $as_echo "yes" >&6; } IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "Found mpi.h and libmpi.so ... via pkg-config ... ompi" + TMP_FOUND="pkg-config ompi" + echo "Found mpi.h and libmpi.so ... via pkg-config ompi" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="OPENMPI" @@ -2471,7 +2486,7 @@ $as_echo "yes" >&6; } MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via pkg-config ... ompi" + echo "Found no mpi.h or libmpi.so ... via pkg-config ompi" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -2539,6 +2554,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + TMP_FOUND="mpicc --showme & sed" echo "Found mpi.h and libmpich.so ... via mpicc --show & sed" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" @@ -2598,7 +2614,8 @@ $as_echo "yes" >&6; } IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "Found mpi.h and libmpich.so ... via pkg-config ... mpich" + TMP_FOUND="pkg-config mpich" + echo "Found mpi.h and libmpich.so ... via pkg-config mpich" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="${MPITYPE}" @@ -2606,7 +2623,7 @@ $as_echo "yes" >&6; } MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpich.so ... via pkg-config ... mpich" + echo "Found no mpi.h or libmpich.so ... via pkg-config mpich" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -2620,6 +2637,12 @@ $as_echo "no" >&6; } fi +if test -z "${TMP_FOUND}"; then + TMP_FOUND="Nothing found from mpicc --show & sed nor pkg-config ..." +fi +echo ">> TMP_FOUND = ${TMP_FOUND}" + + if test -z "${MPI_INCLUDE_PATH}" ; then # Check whether --with-mpi was given. @@ -4488,6 +4511,7 @@ echo " " echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" echo ">> TMP_LIBNAME = ${TMP_LIBNAME}" +echo ">> TMP_FOUND = ${TMP_FOUND}" echo ">> MPI_ROOT = ${MPI_ROOT}" echo ">> MPITYPE = ${MPITYPE}" echo ">> MPI_INCLUDE_PATH = ${MPI_INCLUDE_PATH}" @@ -4523,6 +4547,7 @@ echo " " + ac_config_files="$ac_config_files src/Makevars" diff --git a/configure.ac b/configure.ac index a19be02..2246add 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + TMP_FOUND="mpicc --showme" echo "Found mpi.h and libmpi.so ... via mpicc --showme" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" @@ -213,7 +214,8 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "Found mpi.h and libmpi.so ... via pkg-config ... ompi" + TMP_FOUND="pkg-config ompi" + echo "Found mpi.h and libmpi.so ... via pkg-config ompi" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="OPENMPI" @@ -221,7 +223,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpi.so ... via pkg-config ... ompi" + echo "Found no mpi.h or libmpi.so ... via pkg-config ompi" fi else AC_MSG_RESULT([no]) @@ -294,6 +296,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then + TMP_FOUND="mpicc --showme & sed" echo "Found mpi.h and libmpich.so ... via mpicc --show & sed" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" @@ -353,7 +356,8 @@ if test -z "${MPI_INCLUDE_PATH}" ; then IFS="${TMP_IFS}" if test "${TMP_INC}" != "F" -a "${TMP_LIB}" != "F" ; then - echo "Found mpi.h and libmpich.so ... via pkg-config ... mpich" + TMP_FOUND="pkg-config mpich" + echo "Found mpi.h and libmpich.so ... via pkg-config mpich" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" MPITYPE="${MPITYPE}" @@ -361,7 +365,7 @@ if test -z "${MPI_INCLUDE_PATH}" ; then MPI_LIBPATH="${TMP_LIB}" MPI_LIBNAME="${TMP_LIBNAME}" else - echo "Found no mpi.h or libmpich.so ... via pkg-config ... mpich" + echo "Found no mpi.h or libmpich.so ... via pkg-config mpich" fi else AC_MSG_RESULT([no]) @@ -374,7 +378,13 @@ if test -z "${MPI_INCLUDE_PATH}" ; then fi -dnl For nothing found from above +dnl Nothing found from above +if test -z "${TMP_FOUND}"; then + TMP_FOUND="Nothing found from mpicc --show & sed nor pkg-config ..." +fi +echo ">> TMP_FOUND = ${TMP_FOUND}" + + dnl 'Paths not specified' if test -z "${MPI_INCLUDE_PATH}" ; then dnl Another way is to specify MPI_ROOT, perhaps via --with-mpi @@ -822,6 +832,7 @@ echo " " echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" echo ">> TMP_LIBNAME = ${TMP_LIBNAME}" +echo ">> TMP_FOUND = ${TMP_FOUND}" echo ">> MPI_ROOT = ${MPI_ROOT}" echo ">> MPITYPE = ${MPITYPE}" echo ">> MPI_INCLUDE_PATH = ${MPI_INCLUDE_PATH}" @@ -846,6 +857,7 @@ AC_SUBST(ORTERUN) AC_SUBST(TMP_INC) AC_SUBST(TMP_LIB) AC_SUBST(TMP_LIBNAME) +AC_SUBST(TMP_FOUND) AC_SUBST(MPI_ROOT) AC_SUBST(MPITYPE) AC_SUBST(MPI_INCLUDE_PATH) diff --git a/src/Makevars.in b/src/Makevars.in index f3d6830..6b2b686 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -16,6 +16,7 @@ Makeconf: echo "TMP_INC = @TMP_INC@" >> $(USER_CONF) echo "TMP_LIB = @TMP_LIB@" >> $(USER_CONF) echo "TMP_LIBNAME = @TMP_LIBNAME@" >> $(USER_CONF) + echo "TMP_FOUND = @TMP_FOUND@" >> $(USER_CONF) echo "MPI_ROOT = @MPI_ROOT@" >> $(USER_CONF) echo "MPITYPE = @MPITYPE@" >> $(USER_CONF) echo "MPI_INCLUDE_PATH = @MPI_INCLUDE_PATH@" >> $(USER_CONF) From e527dbbabbe5d978f7a54a87dd14005a778e916d Mon Sep 17 00:00:00 2001 From: snoweye Date: Sun, 5 Aug 2018 17:21:47 -0400 Subject: [PATCH 10/10] updates --- .Rbuildignore | 1 + NAMESPACE | 1 + R/get_conf.r | 9 +++++++-- R/util_execmpi.r | 16 +++++++++------ configure | 51 +++++++++++++++++++++++++++++++++++------------ configure.ac | 39 ++++++++++++++++++++++++++++++++++++ man/uu_execmpi.Rd | 3 +++ 7 files changed, 99 insertions(+), 21 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 169fde0..f6dd5db 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1 +1,2 @@ ^\.travis\.yml$ +appveyor.yml diff --git a/NAMESPACE b/NAMESPACE index ae64793..49766e7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -79,6 +79,7 @@ export( ### "R/util_*.r" "execmpi", + "runmpi", ### "R/000_pbd_opt.r" "pbd_opt" #, diff --git a/R/get_conf.r b/R/get_conf.r index 437ff0e..60d82df 100644 --- a/R/get_conf.r +++ b/R/get_conf.r @@ -2,7 +2,7 @@ ### "pbd*/src/Makevars.in" and "pbd*/src/Makevar.win" ### to find the default configurations from ### "pbd*/etc${R_ARCH}/Makconf". -get.conf <- function(arg, arch = '', package = "pbdMPI"){ +get.conf <- function(arg, arch = '', package = "pbdMPI", return = FALSE){ file.name <- paste("./etc", arch, "/Makeconf", sep = "") file.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) @@ -10,7 +10,12 @@ get.conf <- function(arg, arch = '', package = "pbdMPI"){ id <- grep(paste("^", arg, " = ", sep = ""), ret) if(length(id) > 0){ - cat(gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]])) + ret <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) + if(!return){ + cat(ret) + } else{ + return(invisible(ret)) + } } else{ stop("The arg is not found.") } diff --git a/R/util_execmpi.r b/R/util_execmpi.r index 5217c70..cd599da 100644 --- a/R/util_execmpi.r +++ b/R/util_execmpi.r @@ -45,17 +45,20 @@ execmpi <- function(spmd.code = NULL, spmd.file = NULL, mpicmd <- "mpiexec" } } else{ - mpicmd <- system("which mpiexec", intern = TRUE) + mpicmd <- suppressWarnings(system("which mpiexec", + ignore.stderr = TRUE, intern = TRUE)) if(! is.null(attr(mpicmd, "status"))){ - mpicmd <- system("which mpirun", intern = TRUE) + mpicmd <- suppressWarnings(system("which mpirun", + ignore.stderr = TRUE, intern = TRUE)) if(! is.null(attr(mpicmd, "status"))){ - mpicmd <- system("which orterun", intern = TRUE) + mpicmd <- suppressWarnings(system("which orterun", + ignore.stderr = TRUE, intern = TRUE)) if(! is.null(attr(mpicmd, "status"))){ - mpicmd <- get.conf("MPIEXEC") + mpicmd <- get.conf("MPIEXEC", return = TRUE) if(mpicmd == ""){ - mpicmd <- get.conf("MPIRUN") + mpicmd <- get.conf("MPIRUN", return = TRUE) if(mpicmd == ""){ - mpicmd <- get.conf("ORTERUN") + mpicmd <- get.conf("ORTERUN", return = TRUE) if(mpicmd == ""){ warning("No MPI executable can be found.") return(invisible(NULL)) @@ -128,3 +131,4 @@ execmpi <- function(spmd.code = NULL, spmd.file = NULL, invisible(ret) } # End of execmpi(). +runmpi <- execmpi diff --git a/configure b/configure index 49a17cf..763d027 100755 --- a/configure +++ b/configure @@ -674,7 +674,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -752,7 +751,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1005,15 +1003,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1151,7 +1140,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1304,7 +1293,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -4458,6 +4446,40 @@ MPIRUN=`which mpirun` MPIEXEC=`which mpiexec` ORTERUN=`which orterun` +if test "X$MPIRUN" = "X" -o "X$MPIEXEC" = "X" -o "X$ORTERUN" = "X" ; then + if test "$MPITYPE" = "OPENMPI" ; then + TMP_MODULE=`module avail mpi/o | grep "mpi/o" | sed -e "s/^\(mpi\/o\S*\)\(\s*.*\)$/\1/"` + fi + + if test "$MPITYPE" = "MPICH" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "MPICH3" ; then + TMP_MODULE=`module avail mpi/m | grep "mpi/m" | sed -e "s/^\(mpi\/m\S*\)\(\s*.*\)$/\1/"` + fi + + if test $"X$TMP_MODULE" != "X" ; then + if test "X$MPIRUN" = "X" ; then + TMP_EXEC=`module load ${TMP_MODULE}; which mpirun` + if test "X$TMP_EXEC" != "X" ; then + MPIRUN="module load ${TMP_MODULE}; ${TMP_EXEC}" + fi + fi + + if test "X$MPIEXEC" = "X" ; then + TMP_EXEC=`module load ${TMP_MODULE}; which mpiexec` + if test "X$TMP_EXEC" != "X" ; then + MPIEXEC="module load ${TMP_MODULE}; ${TMP_EXEC}" + fi + fi + + if test "X$ORTERUN" = "X" ; then + TMP_EXEC=`module load ${TMP_MODULE}; which orterun` + if test "X$TMP_EXEC" != "X" ; then + ORTERUN="module load ${TMP_MODULE}; ${TMP_EXEC}" + fi + fi + + fi +fi + # Check whether --enable-pbdPROF was given. if test "${enable_pbdPROF+set}" = set; then : @@ -4508,6 +4530,9 @@ fi echo " " echo "******************* Results of pbdMPI package configure *****************" echo " " +echo ">> MPIRUN = ${MPIRUN}" +echo ">> MPIEXEC = ${MPIEXEC}" +echo ">> ORTERUN = ${ORTERUN}" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" echo ">> TMP_LIBNAME = ${TMP_LIBNAME}" diff --git a/configure.ac b/configure.ac index 2246add..f8c6b70 100644 --- a/configure.ac +++ b/configure.ac @@ -775,6 +775,42 @@ MPIRUN=`which mpirun` MPIEXEC=`which mpiexec` ORTERUN=`which orterun` +dnl Mainly for Fedora which has "mpi/openmpi-x86_64" and "mpi/mpich-x86_64" +dnl Others may have "mpi/gcc/openmpi-*" or so which need more works. +if test "X$MPIRUN" = "X" -o "X$MPIEXEC" = "X" -o "X$ORTERUN" = "X" ; then + if test "$MPITYPE" = "OPENMPI" ; then + TMP_MODULE=`module avail mpi/o | grep "mpi/o" | sed -e "s/^\(mpi\/o\S*\)\(\s*.*\)$/\1/"` + fi + + if test "$MPITYPE" = "MPICH" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "MPICH3" -o "$MPITYPE" = "MPICH3" ; then + TMP_MODULE=`module avail mpi/m | grep "mpi/m" | sed -e "s/^\(mpi\/m\S*\)\(\s*.*\)$/\1/"` + fi + + if test $"X$TMP_MODULE" != "X" ; then + if test "X$MPIRUN" = "X" ; then + TMP_EXEC=`module load ${TMP_MODULE}; which mpirun` + if test "X$TMP_EXEC" != "X" ; then + MPIRUN="module load ${TMP_MODULE}; ${TMP_EXEC}" + fi + fi + + if test "X$MPIEXEC" = "X" ; then + TMP_EXEC=`module load ${TMP_MODULE}; which mpiexec` + if test "X$TMP_EXEC" != "X" ; then + MPIEXEC="module load ${TMP_MODULE}; ${TMP_EXEC}" + fi + fi + + if test "X$ORTERUN" = "X" ; then + TMP_EXEC=`module load ${TMP_MODULE}; which orterun` + if test "X$TMP_EXEC" != "X" ; then + ORTERUN="module load ${TMP_MODULE}; ${TMP_EXEC}" + fi + fi + + fi +fi + dnl pbdPROF AC_ARG_ENABLE([pbdPROF], @@ -829,6 +865,9 @@ dnl Report echo " " echo "******************* Results of pbdMPI package configure *****************" echo " " +echo ">> MPIRUN = ${MPIRUN}" +echo ">> MPIEXEC = ${MPIEXEC}" +echo ">> ORTERUN = ${ORTERUN}" echo ">> TMP_INC = ${TMP_INC}" echo ">> TMP_LIB = ${TMP_LIB}" echo ">> TMP_LIBNAME = ${TMP_LIBNAME}" diff --git a/man/uu_execmpi.Rd b/man/uu_execmpi.Rd index 76399c7..85eb4b5 100644 --- a/man/uu_execmpi.Rd +++ b/man/uu_execmpi.Rd @@ -1,5 +1,6 @@ \name{Utility execmpi} \alias{execmpi} +\alias{runmpi} \title{ Execute MPI code in system } \description{ This function basically saves code in a spmd.file and executes @@ -9,6 +10,8 @@ \usage{ execmpi(spmd.code = NULL, spmd.file = NULL, mpicmd = NULL, nranks = 2L, verbose = TRUE) +runmpi(spmd.code = NULL, spmd.file = NULL, + mpicmd = NULL, nranks = 2L, verbose = TRUE) } \arguments{ \item{spmd.code}{SPMD code to be run via mpicmd and \code{Rscript}.}