[Rd] Rmpi and OpenMPI ?

Ei-ji Nakama nakama at ki.rim.or.jp
Fri Mar 30 05:48:39 CEST 2007


Prof. Nakano(ism Japan) and I wrestled in Rmpi on HP-MPI.
Do not know a method to distinguish MPI well?
It is an ad-hoc patch at that time as follows.

diff -ruN Rmpi.orig/configure Rmpi/configure
--- Rmpi.orig/configure 2006-10-12 23:47:03.000000000 +0900
+++ Rmpi/configure      2007-01-10 21:24:55.000000000 +0900
@@ -1268,7 +1268,7 @@
 fi;

 if test -z "$MPI_ROOT"; then
-  for d in /opt/lib /usr/local/lib /usr/lib; do
+  for d in /opt /opt/lib /usr/local/lib /usr/lib; do
     if test -f $d/lam/include/mpi.h && test -f $d/lam/lib/libmpi.a; then
       echo "I am here $d/lam"
       MPI_ROOT=$d/lam
@@ -1281,6 +1281,10 @@
       echo "I am here $d/mpich"
       MPI_ROOT=$d/mpich
       break
+    elif test -f $d/hpmpi/include/mpi.h; then
+      echo "I am here $d/hpmpi"
+      MPI_ROOT=$d/hpmpi
+      break
     fi
   done
 fi
@@ -2781,6 +2785,9 @@
 if test -f ${MPI_ROOT}/lib/libmpi.a; then
         echo "Found libmpi in ${MPI_ROOT}/lib"
         MPI_LIBS="-L${MPI_ROOT}/lib -lmpi"
+elif test -f ${MPI_ROOT}/lib/linux_amd64/libmpi.a; then
+        echo "Found in ${MPI_ROOT}/lib/linux_amd64"
+        MPI_LIBS="-L${MPI_ROOT}/lib/linux_amd64 -lmpi -lmpio
-Wl,-rpath=${MPI_ROOT}/lib/linux_amd64"
 elif test -f ${MPI_ROOT}/lib/libmpich.a; then
         echo "Found libmpich in ${MPI_ROOT}/lib"
         MPI_LIBS="-L${MPI_ROOT}/lib -lmpich"
@@ -2835,7 +2842,7 @@
 echo "$as_me:$LINENO: result: $ac_cv_lib_mpi_main" >&5
 echo "${ECHO_T}$ac_cv_lib_mpi_main" >&6
 if test $ac_cv_lib_mpi_main = yes; then
-     MPI_LIBS="-lmpi"
+     MPI_LIBS="-lmpi -lmpio"
 else
      echo "libmpi not found. exiting..."
                exit 1
diff -ruN Rmpi.orig/R/Rcomm.R Rmpi/R/Rcomm.R
--- Rmpi.orig/R/Rcomm.R 2006-02-08 07:11:25.000000000 +0900
+++ Rmpi/R/Rcomm.R      2007-01-10 21:26:42.000000000 +0900
@@ -72,11 +72,11 @@

     if (!is.character(slave))
         stop("character argument (slave) expected")
-    #if (nslaves > mpi.universe.size()){
-    #            tmp <- paste("Number of R slaves is over",
-    #                    mpi.universe.size(),": maximum CPUs.")
-    #            warning(tmp)
-    #    }
+    if (nslaves > mpi.universe.size()){
+                tmp <- paste("Number of R slaves is over",
+                        mpi.universe.size(),": maximum CPUs.")
+                warning(tmp)
+    }
     else if (nslaves <= 0)
         stop("Choose a positive number of slaves.")
     .Call("mpi_comm_spawn",
diff -ruN Rmpi.orig/R/zzz.R Rmpi/R/zzz.R
--- Rmpi.orig/R/zzz.R   2005-11-24 04:19:26.000000000 +0900
+++ Rmpi/R/zzz.R        2007-01-10 21:18:49.000000000 +0900
@@ -7,13 +7,13 @@
     #    cat(vertxt)

     # Check if lam-mpi is running
-    if (.Platform$OS=="unix"){
-       if (length(system("lamnodes",TRUE,ignore.stderr = TRUE)) == 0){
-               cat("\n\tLAM/MPI runtime environment is not operating.\n")
-               cat("\tStarting LAM/MPI runtime environment.\n")
-               system("lamboot -H",ignore.stderr = TRUE)
-               }
-    }
+    #if (.Platform$OS=="unix"){
+    #  if (length(system("lamnodes",TRUE,ignore.stderr = TRUE)) == 0){
+    #          cat("\n\tLAM/MPI runtime environment is not operating.\n")
+    #          cat("\tStarting LAM/MPI runtime environment.\n")
+    #          system("lamboot -H",ignore.stderr = TRUE)
+    #  }
+    #}

     library.dynam("Rmpi", pkg, lib)
     if (!TRUE)
diff -ruN Rmpi.orig/src/Rmpi.c Rmpi/src/Rmpi.c
--- Rmpi.orig/src/Rmpi.c        2006-09-05 23:10:59.000000000 +0900
+++ Rmpi/src/Rmpi.c     2007-01-10 21:18:49.000000000 +0900
@@ -77,7 +77,7 @@
        return AsInt(LENGTH(STRING_ELT(sexp_data,0)));
 }

-#ifdef MPI2
+#if defined(MPI2) || (defined(HP_MPI) && HP_MPI > 200)
 SEXP mpi_universe_size(){
        int *MPI_Universe_Size;
        int univ_flag;
@@ -857,7 +857,7 @@
        return AsInt(flag);
 }

-#ifdef MPI2
+#if defined(MPI2) || (defined(HP_MPI) && HP_MPI > 200)
 SEXP mpi_comm_spawn (SEXP sexp_slave,
                                         SEXP sexp_argv,
                                         SEXP sexp_nslave,


2007/3/28, Dirk Eddelbuettel <edd at debian.org>:
>
> Has anybody tried to use Rmpi with the OpenMPI library instead of LAM/MPI?
>
> LAM appears to be somewhat hardcoded in the Rmpi setup. Before I start to
> experiment with changing this, has anybody else tried Rmpi with non-LAM MPI
> implementations?
>
> Dirk
>
> --
> Hell, there are no rules here - we're trying to accomplish something.
>                                                   -- Thomas A. Edison
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
>

-- 
EI-JI Nakama  <nakama at ki.rim.or.jp>
"\u4e2d\u9593\u6804\u6cbb"  <nakama at ki.rim.or.jp>



More information about the R-devel mailing list