Rmpi/0000755000176000001440000000000012337042621011211 5ustar ripleyusersRmpi/inst/0000755000176000001440000000000012015571556012175 5ustar ripleyusersRmpi/inst/CITATION0000644000176000001440000000062612014446634013333 0ustar ripleyuserscitHeader("To cite Rmpi in a publication use:") citEntry( entry = "Article", title = "Rmpi: Parallel Statistical Computing in R", author = "Hao Yu", journal = "R News", year = "2002", volume= "2", number = "2", pages = "10--14", url = "http://cran.r-project.org/doc/Rnews/Rnews_2002-2.pdf", textVersion = "Yu, H. (2002). Rmpi: Parallel Statistical Computing in R. R News 2/2:10-14." ) Rmpi/inst/Rslaves.sh0000755000176000001440000000062712021424667014155 0ustar ripleyusers#!/bin/sh if [ $# -lt 4 ]; then echo "Need 4 arguments" > err.log exit 1 fi Rscript=$1 R_HOME=$4 if [ ! -r $Rscript ]; then echo $Rscript "does not exist or is not readable!" > err.log exit 1 fi if [ "$3" = "needlog" ]; then hn=`hostname -s` $R_HOME/bin/R --no-init-file --slave --no-save -f $1 > $hn.$2.$$.log 2>&1 else $R_HOME/bin/R --no-init-file --slave --no-save -f $1 > /dev/null 2>&1 fi Rmpi/inst/cslavePI.c0000644000176000001440000000211707475755624014066 0ustar ripleyusers#include #include #include int main(int argc, char **argv){ int i, *univ_size, univ_flag, *n; int rank, size; double mypi, pi, h, sum, x; MPI_Comm slavecomm, all_processes; /*Initialize MPI*/ MPI_Init(&argc, &argv); MPI_Comm_get_parent(&slavecomm); MPI_Intercomm_merge(slavecomm, 1, &all_processes); /*How many processes are there?*/ MPI_Comm_size(all_processes, &size); /*Which one am I?*/ MPI_Comm_rank(all_processes, &rank); MPI_Bcast(n,1,MPI_INT,0, all_processes); /*Compute portion of pi on each node */ h = 1.0 / (double) (*n); sum = 0.0; for (i = rank ; i <= *n; i += size-1) { x = h * ((double)i - 0.5); sum += (4.0 / (1.0 + x*x)); } mypi = h * sum; /*Send all computed portion of pi to rank 0 and sum together */ MPI_Reduce(&mypi, &pi,1, MPI_DOUBLE, MPI_SUM,0, all_processes); /*All done*/ MPI_Comm_free(&all_processes); MPI_Finalize(); exit(0); } Rmpi/inst/Rprofile0000644000176000001440000000372412111753322013676 0ustar ripleyusers# This R profile can be used when a cluster does not allow spawning or a job # scheduler is required to launch any parallel jobs. Saving this file as # .Rprofile in the working directory or root directory. For unix platform, run # mpirun -n [cpu numbers] R --no-save -q # Another way is to modify R_home_dir/bin/R by adding the following line after # R_HOME_DIR # R_PROFILE=${R_HOME_DIR}/library/Rmpi/Rprofile; export R_PROFILE # For windows platform with mpich2, use mpiexec wrapper and specify a working # directory where .Rprofile is inside. # Cannot be used as Rprofile.site because it will not work # If no CPU consumptions of slaves while waiting are desirable, change # nonblocak=FALSE to nonblock=TRUE and change sleep time accordingly # Following system libraries are not loaded automatically. So manual loads are # needed. library(utils) library(stats) library(datasets) library(grDevices) library(graphics) library(methods) #Change to TRUE if you don't want any slave host info quiet=FALSE if (!invisible(library(Rmpi,logical.return = TRUE))){ warning("Rmpi cannot be loaded") q(save = "no") } options(error=quote(assign(".mpi.err", FALSE, envir = .GlobalEnv))) if (mpi.comm.size(0) > 1) invisible(mpi.comm.dup(0,1)) if (mpi.comm.rank(0) >0){ #sys.load.image(".RData",TRUE) options(echo=FALSE) .comm <- 1 mpi.barrier(0) repeat try(eval(mpi.bcast.cmd(rank=0,comm=.comm, nonblock=FALSE, sleep=0.1)),TRUE) if (is.loaded("mpi_comm_disconnect")) mpi.comm.disconnect(.comm) else mpi.comm.free(.comm) mpi.quit() } if (mpi.comm.rank(0)==0) { #options(echo=TRUE) mpi.barrier(0) if(mpi.comm.size(0) > 1 && !quiet) slave.hostinfo(1) } .Last <- function(){ if (is.loaded("mpi_initialize")){ if (mpi.comm.size(1) > 1){ print("Please use mpi.close.Rslaves() to close slaves") mpi.close.Rslaves(comm=1) } } print("Please use mpi.quit() to quit R") mpi.quit() } Rmpi/inst/Rslaves32.cmd0000644000176000001440000000117212021421552014432 0ustar ripleyusers@echo off set Rscript=%1% set R_HOME=%2% set WDrive=%3% set WDir=%4% set Master=%5% set MapDrive=%6% set RemotePath=%7% if %MapDrive%==FALSE goto last set FirstOne=FALSE if exist %WDrive%:\NUL goto next set FirstOne=TRUE net use %WDrive%: %RemotePath% if not errorlevel 0 set FirstOne=FALSE :next cd /D %WDir% %R_HOME%\bin\i386\Rscript.exe --vanilla %Rscript% if %FirstOne%==FALSE goto end net use /delete %WDrive%: goto:eof :last if %Master% == %COMPUTERNAME% ( %R_HOME%\bin\i386\Rscript.exe --vanilla %Rscript% goto:eof ) cd /D %TMP% %R_HOME%\bin\i386\Rscript.exe --vanilla %Rscript% :endRmpi/inst/MacR64slaves.sh0000755000176000001440000000062712015571556014753 0ustar ripleyusers#!/bin/sh if [ $# -lt 4 ]; then echo "Need 4 arguments" > err.log exit 1 fi Rscript=$1 R_HOME=$4 if [ ! -r $Rscript ]; then echo $Rscript "does not exist or is not readable!" > err.log exit 1 fi if [ "$3" = "needlog" ]; then hn=`hostname -s` $R_HOME/bin/R64 --no-init-file --slave --no-save < $1 > $hn.$2.$$.log 2>&1 else $R_HOME/bin/R64 --no-init-file --slave --no-save < $1 > /dev/null 2>&1 fi Rmpi/inst/Rslaves64.cmd0000644000176000001440000000101612024675564014455 0ustar ripleyusers@echo off set Rscript=%1% set R_HOME=%2% set WDrive=%3% set WDir=%4% set Master=%5% set MapDrive=%6% set RemotePath=%7% if %MapDrive%==FALSE goto last net use %WDrive%: %RemotePath% if not errorlevel 0 goto last cd /D %WDir% %R_HOME%\bin\x64\Rscript.exe --vanilla %Rscript% goto :EOF :last if %Master% == %COMPUTERNAME% ( cd /D %WDir% if not errorlevel 0 cd /D e:\ %R_HOME%\bin\x64\Rscript.exe --vanilla %Rscript% goto:eof ) :home cd /D e:\ %R_HOME%\bin\x64\Rscript.exe --vanilla %Rscript% Rmpi/inst/slavedaemon.R0000644000176000001440000000136512112040232014577 0ustar ripleyusersif (!library(Rmpi,logical.return = TRUE)){ warning("Rmpi cannot be loaded") q(save = "no") } options(error=quote(assign(".mpi.err", TRUE, envir = .GlobalEnv))) .comm <- 1 .intercomm <- 2 invisible(mpi.comm.get.parent(.intercomm)) invisible(mpi.intercomm.merge(.intercomm,1,.comm)) invisible(mpi.comm.set.errhandler(.comm)) mpi.hostinfo(.comm) invisible(mpi.comm.disconnect(.intercomm)) .nonblock <- as.logical(mpi.bcast(integer(1),type=1,rank=0,comm=.comm)) .sleep <- mpi.bcast(double(1),type=2,rank=0,comm=.comm) repeat try(eval(mpi.bcast.cmd(rank=0,comm=.comm, nonblock=.nonblock, sleep=.sleep),envir=.GlobalEnv),TRUE) print("Done") invisible(mpi.comm.disconnect(.comm)) invisible(mpi.comm.set.errhandler(0)) mpi.quit() Rmpi/configure.ac0000644000176000001440000002351712321017754013511 0ustar ripleyusersdnl Process this file with autoconf to produce a configure script. AC_INIT(DESCRIPTION) ## One way is to specify both include and lib paths AC_ARG_WITH([Rmpi-include], AC_HELP_STRING([--with-Rmpi-include=INCLUDE_PATH], [location of MPI header files]), [mpi_include_path=$withval]) if test -n "${mpi_include_path}" ; then MPI_INCLUDE_PATH="${mpi_include_path}" if test ! -f "${MPI_INCLUDE_PATH}/mpi.h"; then AC_MSG_ERROR([Value of --with-Rmpi-include does not contain mpi.h]) fi else if test -n "${RMPI_INCLUDE}" ; then MPI_INCLUDE_PATH="${RMPI_INCLUDE}" if test ! -f "${MPI_INCLUDE_PATH}/mpi.h"; then AC_MSG_ERROR([Value of RMPI_INCLUDE does not contain mpi.h]) fi echo "setting mpi include path from RMPI_INCLUDE" fi fi AC_ARG_WITH([Rmpi-libpath], AC_HELP_STRING([--with-Rmpi-libpath=LIB_PATH], [location of MPI library files]), [mpi_lib_path=$withval]) if test -n "${mpi_lib_path}" ; then MPI_LIBPATH="${mpi_lib_path}" else if test -n "${RMPI_LIB_PATH}" ; then MPI_LIBPATH="${RMPI_LIB_PATH}" echo "setting mpi lib path from RMPI_LIB_PATH" fi fi if test -n "${MPI_INCLUDE_PATH}" -a -z "${MPI_LIBPATH}" ; then AC_MSG_ERROR([Must specify both the include and lib paths]) fi if test -z "${MPI_INCLUDE_PATH}" -a -n "${MPI_LIBPATH}" ; then AC_MSG_ERROR([Must specify both the include and lib paths]) fi MPITYPE="UNKNOWN" AC_ARG_WITH([Rmpi-type], AC_HELP_STRING([--with-Rmpi-type=MPI_TYPE], [the type of MPI: OPENMPI,LAM,MPICH,MPICH2, or CRAY]), [mpi_type=$withval]) if test -n "${mpi_type}" ; then MPITYPE="${mpi_type}" else if test -n "${RMPI_TYPE}" ; then MPITYPE="${RMPI_TYPE}" fi fi if test -z "${MPI_INCLUDE_PATH}" ; then dnl 'paths not specified' ## another way is to specify MPI_ROOT, perhaps via --with-mpi AC_ARG_WITH(mpi, AC_HELP_STRING([--with-mpi=LIB_PATH], [location of top-level MPI directory]), [ if test "${withval}" != "no"; then MPI_ROOT=${withval} MPI_INCLUDE_PATH="${MPI_ROOT}/include" LDFLAGS="$LDFLAGS -L${withval}/lib" CPPFLAGS="$CPPFLAGS -I${withval}/include" fi ] ) CC=`"${R_HOME}/bin/R" CMD config CC` CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS` AC_PROG_CC if test "X$CC" = "X" ; then # Our best guess... CC="gcc -std=gnu99" fi if test -z "$MPI_ROOT" ; then for d in /opt/lib /usr/lib /usr /usr/local/lib /usr/local \ /usr/lib64/mpi/gcc/openmpi; do if test -f $d/include/mpi.h && test -d $d/lib/openmpi; then echo "I am here $d and it is 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" MPI_ROOT=$d MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include/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" MPI_ROOT=$d MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include/openmpi break elif test -f $d/openmpi/include/mpi.h && test -d $d/openmpi/lib; then echo "I am here $d/openmpi and it is OpenMPI" MPI_ROOT=$d/openmpi MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include/openmpi break elif test -f $d/include/mpi.h && test -d $d/lib64; then echo "I am here $d and it is OpenMPI" MPI_ROOT=$d MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include break elif test -f $d/lam/include/mpi.h && test -f $d/lam/lib/libmpi.so; then echo "I am here $d/lam and it is LAM" MPI_ROOT=$d/lam MPITYPE="LAM" MPI_INCLUDE_PATH=$d/include/lam break elif test -f $d/include/lam/mpi.h && test -f $d/lib/lam/libmpi.so; then echo "I am here $d and it is LAM" MPI_ROOT=$d MPITYPE="LAM" MPI_INCLUDE_PATH=$d/include/lam break elif test -f $d/include/lam/mpi.h && test -f $d/lib64/lam/libmpi.so; then echo "I am here $d and it is LAM" MPI_ROOT=$d MPITYPE="LAM" MPI_INCLUDE_PATH=$d/include/lam break elif test -f $d/mpich/include/mpi.h; then echo "I am here $d/mpich and it is MPICH" MPI_ROOT=$d/mpich MPITYPE="MPICH" MPI_INCLUDE_PATH=$d/mpich/include break elif test -f $d/mpi/include/mpi.h; then echo "I am here $d/mpi" MPI_ROOT=$d/mpi MPI_INCLUDE_PATH=$d/mpi/include break elif test -f $d/include/mpi.h; then echo "I am here $d" MPI_ROOT=$d break fi done fi if test -n "$MPI_ROOT"; then #guess MPITYPE if it is unknown and user supplies MPI_ROOT if test $MPITYPE = "UNKNOWN" ; then if test -d ${MPI_ROOT}/openmpi; then MPITYPE="OPENMPI" elif test -d ${MPI_ROOT}/lib/openmpi; then MPITYPE="OPENMPI" elif test -d ${MPI_ROOT}/lib64/openmpi; then MPITYPE="OPENMPI" elif test -f ${MPI_ROOT}/lib/liblam.so; then MPITYPE="LAM" elif test -d ${MPI_ROOT}/lib/lam; then MPITYPE="LAM" elif test -d ${MPI_ROOT}/lib64/lam; then MPITYPE="LAM" elif test -f ${MPI_ROOT}/lib/libmpich.a; then MPITYPE="MPICH" elif test -f ${MPI_ROOT}/lib64/libmpich.a; then MPITYPE="MPICH" fi fi echo "Trying to find mpi.h ..." if test -f ${MPI_ROOT}/include/mpi.h; then echo "Found in ${MPI_ROOT}/include" MPI_INCLUDE_PATH="${MPI_ROOT}/include" elif test -f ${MPI_ROOT}/include/openmpi/mpi.h; then echo "Found in ${MPI_ROOT}/include/openmpi" MPI_INCLUDE_PATH="${MPI_ROOT}/include/openmpi" elif test -f ${MPI_ROOT}/include/lam/mpi.h; then echo "Found in ${MPI_ROOT}/include/lam" MPI_INCLUDE_PATH="${MPI_ROOT}/include/lam" else echo "Cannot find mpi.h header file" echo "Please use --with-mpi=/path/to/mpi or specify the environment variable MPI_ROOT" exit 1 fi else AC_CHECK_HEADER(mpi.h,, AC_MSG_ERROR(["Cannot find mpi.h header file"])) fi echo "Trying to find libmpi.so or libmpich.a ..." if test -f ${MPI_ROOT}/lib/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib" MPI_LIBPATH="${MPI_ROOT}/lib" elif test -f ${MPI_ROOT}/libmpi.so; then dnl This is what Fedora 10 had echo "Found libmpi in ${MPI_ROOT}" MPI_LIBPATH="${MPI_ROOT}" elif test -f ${MPI_ROOT}/lib/openmpi/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib/openmpi" MPI_LIBPATH="${MPI_ROOT}/lib/openmpi" elif test -f ${MPI_ROOT}/lib64/openmpi/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib64/openmpi" MPI_LIBPATH="${MPI_ROOT}/lib64/openmpi" elif test -f ${MPI_ROOT}/lib64/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib64" MPI_LIBPATH="${MPI_ROOT}/lib64" elif test -f ${MPI_ROOT}/lib/lam/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib/lam" MPI_LIBPATH="${MPI_ROOT}/lib/lam" MPI_INCL2="-I${MPI_INCLUDE_PATH}/32" elif test -f ${MPI_ROOT}/lib64/lam/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib64/lam" MPI_LIBPATH="${MPI_ROOT}/lib64/lam" MPI_INCL2="-I${MPI_INCLUDE_PATH}/64" elif test -f ${MPI_ROOT}/lib/libmpich.so; then echo "Found libmpich in ${MPI_ROOT}/lib" MPI_LIBPATH="${MPI_ROOT}/lib" AC_CHECK_DECLS([MPICH2, MPICH2],[ MPI_DEFS="-DMPI2" ],, [#include ]) elif test -f ${MPI_ROOT}/lib64/libmpich.a; then echo "Found libmpich in ${MPI_ROOT}/lib64" MPI_LIBPATH="${MPI_ROOT}/lib64" AC_CHECK_DECLS([MPICH2, MPICH2],[ MPI_DEFS="-DMPI2" ],, [#include ]) else AC_CHECK_LIB(mpi, main, MPI_LIBPATH="${MPI_ROOT}/lib", [ echo "libmpi not found. exiting..." exit 1 ] ) fi if test "$MPITYPE" = "OPENMPI" ; then AC_CHECK_PROG(ORTED, orted, yes, no) if test "$ORTED" = no ; then AC_MSG_ERROR(Cannot find orted. Rmpi needs orted to run.) fi fi if test "$MPITYPE" = "LAM" ; then echo "Try to find liblam.so ..." if test -f ${MPI_ROOT}/lib/liblam.so; then echo "Found liblam in ${MPI_ROOT}/lib" MPI_LIBPATH="${MPI_ROOT}/lib" elif test -f ${MPI_ROOT}/lib/lam/liblam.so; then echo "Found liblam in ${MPI_ROOT}/lib/lam" MPI_LIBPATH="${MPI_ROOT}/lib/lam" elif test -f ${MPI_ROOT}/lib64/lam/liblam.so; then echo "Found liblam in ${MPI_ROOT}/lib64/lam" MPI_LIBPATH="${MPI_ROOT}/lib64/lam" else AC_CHECK_LIB(lam, main, [] [ echo "liblam not found. Probably not LAM-MPI"] ) fi fi fi dnl end of 'paths not specified' ## 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" = "INTELMPI" -o "$MPITYPE" = "CRAY"; 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}" ;; MPICH) PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" ;; MPICH2) PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" ;; INTELMPI) PKG_LIBS="-Wl,-rpath,${MPI_LIBPATH} -L${MPI_LIBPATH} -lmpich -lmpigf -lmpigi ${MPI_LIBS}" ;; CRAY) PKG_LIBS="-L${MPI_LIBPATH} -lmpich_cray_default64 -lmpl -lopa ${MPI_LIBS}" ;; *) AC_MSG_ERROR([Unknown type of mpi: use --with-Rmpi-type or RMPI_TYPE to specify it]) ;; esac AC_SUBST(PKG_CPPFLAGS) AC_SUBST(PKG_LIBS) AC_OUTPUT(src/Makevars) Rmpi/src/0000755000176000001440000000000012336662051012004 5ustar ripleyusersRmpi/src/Rmpi.c0000644000176000001440000013455312336662142013073 0ustar ripleyusers/* Copyright (C) 2002 Hao Yu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Rmpi.h" #ifdef OPENMPI #include #endif static MPI_Comm *comm; static MPI_Status *status; static MPI_Datatype *datatype; static MPI_Info *info; static MPI_Request *request; static int COMM_MAXSIZE=10; static int STATUS_MAXSIZE=2000; static int REQUEST_MAXSIZE=2000; static MPI_Datatype *xdouble; #ifndef XLENGTH #define XLENGTH LENGTH #endif SEXP mpidist(){ int i=0; #ifdef OPENMPI i=1; #endif #ifdef LAM i=2; #endif #ifdef MPICH i=3; #endif #if defined(MPICH2) || defined(INTELMPI) i=4; #endif return AsInt(i); } SEXP mpi_initialize(){ int i,flag; MPI_Initialized(&flag); #ifndef MPI2 static int fake_argc = 1; char *fake_argv[1]; char *fake_argv0 = "R"; #endif if (flag) return AsInt(1); else { #ifndef __APPLE__ #ifdef OPENMPI if (!dlopen("libmpi.so.1", RTLD_GLOBAL | RTLD_LAZY) && !dlopen("libmpi.so.0", RTLD_GLOBAL | RTLD_LAZY) && !dlopen("libmpi.so", RTLD_GLOBAL | RTLD_LAZY)) { Rprintf("%s\n",dlerror()); return AsInt(0); } #endif #endif #ifndef MPI2 fake_argv[0] = (char *)&fake_argv0; MPI_Init(&fake_argc, (char ***)(void*)&fake_argv); #else MPI_Init((void *)0,(void *)0); #endif MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN); MPI_Comm_set_errhandler(MPI_COMM_SELF, MPI_ERRORS_RETURN); comm=(MPI_Comm *)Calloc(COMM_MAXSIZE, MPI_Comm); status=(MPI_Status *)Calloc(STATUS_MAXSIZE, MPI_Status); datatype=(MPI_Datatype *)Calloc(1, MPI_Datatype); xdouble=(MPI_Datatype *)Calloc(1, MPI_Datatype); info=(MPI_Info *)Calloc(1, MPI_Info); info[0]=MPI_INFO_NULL; request=(MPI_Request *)Calloc(REQUEST_MAXSIZE, MPI_Request); for (i=0; i< REQUEST_MAXSIZE; request[i++]=MPI_REQUEST_NULL); comm[0]=MPI_COMM_WORLD; for (i=1;i < COMM_MAXSIZE; comm[i++]=MPI_COMM_NULL); return AsInt(1); } } SEXP mpi_finalize(){ MPI_Finalize(); Free(comm); Free(status); Free(request); Free(datatype); Free(xdouble); Free(info); return AsInt(1); } SEXP mpi_get_processor_name (){ int resultlen; char *name; SEXP sexp_name; PROTECT (sexp_name = allocVector (STRSXP, 1)); name = (char *)Calloc(MPI_MAX_PROCESSOR_NAME, char); MPI_Get_processor_name(name, &resultlen); SET_STRING_ELT(sexp_name, 0, mkChar(name)); UNPROTECT(1); Free(name); return sexp_name; } /* SEXP bin_nchar(SEXP sexp_data){ return AsInt(LENGTH(STRING_ELT(sexp_data,0))); } */ #ifdef MPI2 SEXP mpi_universe_size(){ int *MPI_Universe_Size; int univ_flag; MPI_Comm_get_attr(comm[0], MPI_UNIVERSE_SIZE, &MPI_Universe_Size, &univ_flag); if (univ_flag) return AsInt(*MPI_Universe_Size); else return AsInt(0); } #endif SEXP mpi_any_source(){ return AsInt(MPI_ANY_SOURCE); } SEXP mpi_any_tag(){ return AsInt(MPI_ANY_TAG); } SEXP mpi_undefined(){ return AsInt(MPI_UNDEFINED); } SEXP mpi_proc_null(){ return AsInt(MPI_PROC_NULL); } SEXP mpi_info_create(SEXP sexp_info){ return AsInt(erreturn(mpi_errhandler(MPI_Info_create( &info[INTEGER(sexp_info)[0]])))); } SEXP mpi_info_set(SEXP sexp_info, SEXP sexp_key, SEXP sexp_value){ return AsInt(erreturn(mpi_errhandler(MPI_Info_set(info[INTEGER(sexp_info)[0]], CHAR2( STRING_ELT (sexp_key,0)), CHAR2(STRING_ELT(sexp_value,0)))))); } SEXP mpi_info_get(SEXP sexp_info, SEXP sexp_key, SEXP sexp_valuelen){ int flag; char *value; SEXP sexp_value; PROTECT (sexp_value = allocVector (STRSXP, 1)); value = (char *)Calloc(INTEGER(sexp_valuelen)[0], char); mpi_errhandler(MPI_Info_get(info[INTEGER(sexp_info)[0]], CHAR2( STRING_ELT (sexp_key,0)), INTEGER(sexp_valuelen)[0], value, &flag)); SET_STRING_ELT(sexp_value, 0, mkChar(value)); UNPROTECT(1); Free(value); return sexp_value; } SEXP mpi_info_free(SEXP sexp_info){ return AsInt(erreturn(mpi_errhandler(MPI_Info_free( &info[INTEGER(sexp_info)[0]])))); } SEXP mpi_realloc_comm(SEXP sexp_newncomm){ int i, newcomm=INTEGER(sexp_newncomm)[0]; if (newcomm > COMM_MAXSIZE){ comm=(MPI_Comm *)Realloc(comm, newcomm, MPI_Comm); for (i=COMM_MAXSIZE; i < newcomm; comm[i++]=MPI_COMM_NULL); COMM_MAXSIZE=newcomm; } return AsInt(1); } SEXP mpi_comm_maxsize(){ return AsInt(COMM_MAXSIZE); } SEXP mpi_realloc_status(SEXP sexp_newnstatus){ int newsize=INTEGER(sexp_newnstatus)[0]; if (newsize > STATUS_MAXSIZE){ status=(MPI_Status *)Realloc(status, newsize, MPI_Status); STATUS_MAXSIZE=newsize; } return AsInt(1); } SEXP mpi_status_maxsize(){ return AsInt(STATUS_MAXSIZE); } SEXP mpi_realloc_request(SEXP sexp_newnrequest){ int i, newsize=INTEGER(sexp_newnrequest)[0]; if (newsize > REQUEST_MAXSIZE){ request=(MPI_Request *)Realloc(request, newsize , MPI_Request); for (i=REQUEST_MAXSIZE; i< newsize; request[i++]=MPI_REQUEST_NULL); REQUEST_MAXSIZE=newsize; } return AsInt(1); } SEXP mpi_request_maxsize(){ return AsInt(REQUEST_MAXSIZE); } SEXP mpi_realloc_datatype(SEXP sexp_newndatatype){ datatype=(MPI_Datatype *)Realloc(datatype, INTEGER(sexp_newndatatype)[0], MPI_Datatype); return AsInt(1); } /******************** Collective ***************************************/ SEXP mpi_gather(SEXP sexp_sdata, SEXP sexp_type, SEXP sexp_rdata, SEXP sexp_root, SEXP sexp_comm){ int len, rlen, commn=INTEGER(sexp_comm)[0], root=INTEGER(sexp_root)[0]; char *rdata; SEXP sexp_rdata2 = NULL; switch (INTEGER(sexp_type)[0]){ case 1: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Gather(INTEGER(sexp_sdata), len, MPI_INT, INTEGER(sexp_rdata), len, MPI_INT, root, comm[commn])); break; case 2: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Gather(REAL(sexp_sdata), len, MPI_DOUBLE, REAL(sexp_rdata), len, MPI_DOUBLE, root, comm[commn])); break; case 3: len=LENGTH(STRING_ELT(sexp_sdata,0)); rlen=LENGTH(STRING_ELT(sexp_rdata,0)); PROTECT (sexp_rdata2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(rlen, char); MPI_Gather(CHAR2 (STRING_ELT ((sexp_sdata),0)), len, MPI_CHAR, rdata, len, MPI_CHAR, root, comm[commn]); SET_STRING_ELT(sexp_rdata2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Gather(RAW(sexp_sdata), len, MPI_BYTE, RAW(sexp_rdata), len, MPI_BYTE, root, comm[commn])); break; default: PROTECT(sexp_sdata=AS_NUMERIC(sexp_sdata)); mpi_errhandler(MPI_Bcast(REAL(sexp_sdata), 1, datatype[0], root, comm[commn])); UNPROTECT(1); break; } if (INTEGER(sexp_type)[0]==3) return sexp_rdata2; else return sexp_rdata; } SEXP mpi_gatherv(SEXP sexp_sdata, SEXP sexp_type, SEXP sexp_rdata, SEXP sexp_recvcounts, SEXP sexp_root, SEXP sexp_comm){ int len, rlen, commn=INTEGER(sexp_comm)[0], root=INTEGER(sexp_root)[0]; int *displs=NULL, gsize, rank, i; char *rdata; SEXP sexp_rdata2 = NULL; MPI_Comm_size(comm[commn], &gsize); MPI_Comm_rank(comm[commn], &rank); if (rank==root){ displs=(int *)Calloc(gsize, int); displs[0]=0; for (i=1; i < gsize; i++) displs[i]=displs[i-1]+INTEGER(sexp_recvcounts)[i-1]; } switch (INTEGER(sexp_type)[0]){ case 1: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Gatherv(INTEGER(sexp_sdata), len, MPI_INT, INTEGER(sexp_rdata), INTEGER(sexp_recvcounts), displs, MPI_INT, root, comm[commn])); break; case 2: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Gatherv(REAL(sexp_sdata), len, MPI_DOUBLE, REAL(sexp_rdata), INTEGER(sexp_recvcounts), displs, MPI_DOUBLE, root, comm[commn])); break; case 3: len=LENGTH(STRING_ELT(sexp_sdata,0)); rlen=LENGTH(STRING_ELT(sexp_rdata,0)); PROTECT (sexp_rdata2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(rlen, char); MPI_Gatherv(CHAR2 (STRING_ELT ((sexp_sdata),0)),len,MPI_CHAR, rdata, INTEGER(sexp_recvcounts), displs, MPI_CHAR, root, comm[commn]); SET_STRING_ELT(sexp_rdata2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Gatherv(RAW(sexp_sdata), len, MPI_BYTE, RAW(sexp_rdata), INTEGER(sexp_recvcounts), displs, MPI_BYTE, root, comm[commn])); break; default: PROTECT(sexp_sdata=AS_NUMERIC(sexp_sdata)); mpi_errhandler(MPI_Bcast(REAL(sexp_sdata), 1, datatype[0], rank, comm[commn])); UNPROTECT(1); break; } if (rank == root) Free(displs); if (INTEGER(sexp_type)[0]==3) return sexp_rdata2; else return sexp_rdata; } SEXP mpi_scatter(SEXP sexp_sdata, SEXP sexp_type, SEXP sexp_rdata, SEXP sexp_root, SEXP sexp_comm){ int len, rlen; int commn=INTEGER(sexp_comm)[0], root=INTEGER(sexp_root)[0]; char *rdata; SEXP sexp_rdata2 = NULL; switch (INTEGER(sexp_type)[0]){ case 1: len=LENGTH(sexp_rdata); mpi_errhandler(MPI_Scatter(INTEGER(sexp_sdata), len, MPI_INT, INTEGER(sexp_rdata), len, MPI_INT, root, comm[commn])); break; case 2: len=LENGTH(sexp_rdata); mpi_errhandler(MPI_Scatter(REAL(sexp_sdata), len, MPI_DOUBLE, REAL(sexp_rdata), len, MPI_DOUBLE, root, comm[commn])); break; case 3: len=LENGTH(STRING_ELT(sexp_rdata,0)); rlen=LENGTH(STRING_ELT(sexp_rdata,0)); PROTECT (sexp_rdata2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(rlen, char); MPI_Scatter(CHAR2(STRING_ELT ((sexp_sdata),0)), len, MPI_CHAR, rdata, len, MPI_CHAR, root, comm[commn]); SET_STRING_ELT(sexp_rdata2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: len=LENGTH(sexp_rdata); mpi_errhandler(MPI_Scatter(RAW(sexp_sdata), len, MPI_BYTE, RAW(sexp_rdata), len, MPI_BYTE, root, comm[commn])); break; default: PROTECT(sexp_sdata=AS_NUMERIC(sexp_sdata)); mpi_errhandler(MPI_Bcast(REAL(sexp_sdata), 1, datatype[0], root, comm[commn])); UNPROTECT(1); break; } if (INTEGER(sexp_type)[0]==3) return sexp_rdata2; else return sexp_rdata; } SEXP mpi_scatterv(SEXP sexp_sdata, SEXP sexp_sendcounts, SEXP sexp_type, SEXP sexp_rdata, SEXP sexp_root, SEXP sexp_comm){ int len, rlen, commn=INTEGER(sexp_comm)[0], root=INTEGER(sexp_root)[0]; int gsize,rank,i,*displs=NULL; char *rdata; SEXP sexp_rdata2 = NULL; MPI_Comm_size(comm[commn], &gsize); MPI_Comm_rank(comm[commn], &rank); if (rank==root){ displs=(int *)Calloc(gsize, int); displs[0]=0; for (i=1; i < gsize; i++) displs[i]=displs[i-1]+INTEGER(sexp_sendcounts)[i-1]; } switch (INTEGER(sexp_type)[0]){ case 1: len=LENGTH(sexp_rdata); mpi_errhandler(MPI_Scatterv(INTEGER(sexp_sdata), INTEGER(sexp_sendcounts), displs, MPI_INT, INTEGER(sexp_rdata), len, MPI_INT, root, comm[commn])); break; case 2: len=LENGTH(sexp_rdata); mpi_errhandler(MPI_Scatterv(REAL(sexp_sdata), INTEGER(sexp_sendcounts), displs, MPI_DOUBLE, REAL(sexp_rdata), len, MPI_DOUBLE, root, comm[commn])); break; case 3: len=LENGTH(STRING_ELT(sexp_rdata,0)); rlen=LENGTH(STRING_ELT(sexp_rdata,0)); PROTECT (sexp_rdata2 = allocVector (STRSXP, 1)); // rdata = (char *)R_alloc(rlen, sizeof(char)); rdata = (char *)Calloc(rlen, char); MPI_Scatterv(CHAR2 (STRING_ELT ((sexp_sdata),0)), INTEGER(sexp_sendcounts),displs, MPI_CHAR,rdata, len, MPI_CHAR, root, comm[commn]); SET_STRING_ELT(sexp_rdata2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: len=LENGTH(sexp_rdata); mpi_errhandler(MPI_Scatterv(RAW(sexp_sdata), INTEGER(sexp_sendcounts), displs, MPI_BYTE, RAW(sexp_rdata), len, MPI_BYTE, root, comm[commn])); break; default: PROTECT(sexp_sdata=AS_NUMERIC(sexp_sdata)); mpi_errhandler(MPI_Bcast(REAL(sexp_sdata), 1, datatype[0], rank, comm[commn])); UNPROTECT(1); break; } if (rank == root) Free(displs); if (INTEGER(sexp_type)[0]==3) return sexp_rdata2; else return sexp_rdata; } SEXP mpi_allgather(SEXP sexp_sdata, SEXP sexp_type, SEXP sexp_rdata, SEXP sexp_comm){ int len, rlen, commn=INTEGER(sexp_comm)[0]; char *rdata; SEXP sexp_rdata2 = NULL; switch (INTEGER(sexp_type)[0]){ case 1: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Allgather(INTEGER(sexp_sdata), len, MPI_INT, INTEGER(sexp_rdata), len, MPI_INT, comm[commn])); break; case 2: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Allgather(REAL(sexp_sdata), len, MPI_DOUBLE, REAL(sexp_rdata), len, MPI_DOUBLE, comm[commn])); break; case 3: len=LENGTH(STRING_ELT(sexp_sdata,0)); rlen=LENGTH(STRING_ELT(sexp_rdata,0)); PROTECT (sexp_rdata2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(rlen, char); MPI_Allgather(CHAR2 (STRING_ELT ((sexp_sdata),0)),len, MPI_CHAR,rdata, len, MPI_CHAR, comm[commn]); SET_STRING_ELT(sexp_rdata2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Allgather(RAW(sexp_sdata), len, MPI_BYTE, RAW(sexp_rdata), len, MPI_BYTE, comm[commn])); break; default: PROTECT(sexp_sdata=AS_NUMERIC(sexp_sdata)); mpi_errhandler(MPI_Bcast(REAL(sexp_sdata), 1, datatype[0], 0, comm[commn])); UNPROTECT(1); break; } if (INTEGER(sexp_type)[0]==3) return sexp_rdata2; else return sexp_rdata; } SEXP mpi_allgatherv(SEXP sexp_sdata, SEXP sexp_type, SEXP sexp_rdata, SEXP sexp_recvcounts, SEXP sexp_comm){ int len, rlen, commn=INTEGER(sexp_comm)[0], *displs, gsize, i; char *rdata; SEXP sexp_rdata2 = NULL; MPI_Comm_size(comm[commn], &gsize); displs=(int *)Calloc(gsize, int); displs[0]=0; for (i=1; i < gsize; i++) displs[i]=displs[i-1]+INTEGER(sexp_recvcounts)[i-1]; switch (INTEGER(sexp_type)[0]){ case 1: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Allgatherv(INTEGER(sexp_sdata), len, MPI_INT, INTEGER(sexp_rdata), INTEGER(sexp_recvcounts), displs, MPI_INT,comm[commn])); break; case 2: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Allgatherv(REAL(sexp_sdata), len, MPI_DOUBLE, REAL(sexp_rdata), INTEGER(sexp_recvcounts), displs, MPI_DOUBLE, comm[commn])); break; case 3: len=LENGTH(STRING_ELT(sexp_sdata,0)); rlen=LENGTH(STRING_ELT(sexp_rdata,0)); PROTECT (sexp_rdata2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(rlen, char); MPI_Allgatherv(CHAR2 (STRING_ELT ((sexp_sdata),0)),len, MPI_CHAR, rdata, INTEGER(sexp_recvcounts), displs, MPI_CHAR, comm[commn]); SET_STRING_ELT(sexp_rdata2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: len=LENGTH(sexp_sdata); mpi_errhandler(MPI_Allgatherv(RAW(sexp_sdata), len, MPI_BYTE, RAW(sexp_rdata), INTEGER(sexp_recvcounts), displs, MPI_BYTE, comm[commn])); break; default: PROTECT(sexp_sdata=AS_NUMERIC(sexp_sdata)); mpi_errhandler(MPI_Bcast(REAL(sexp_sdata), 1, datatype[0], 0, comm[commn])); UNPROTECT(1); break; } Free(displs); if (INTEGER(sexp_type)[0]==3) return sexp_rdata2; else return sexp_rdata; } SEXP mpi_bcast(SEXP sexp_data, SEXP sexp_type, SEXP sexp_rank, SEXP sexp_comm, SEXP sexp_buffunit){ int len=LENGTH(sexp_data), type=INTEGER(sexp_type)[0]; int rank=INTEGER(sexp_rank)[0], root, commn=INTEGER(sexp_comm)[0],slen; int buffunit=INTEGER(sexp_buffunit)[0],errcode=0; char *rdata; SEXP sexp_data2 = NULL; //MPI_Datatype xdouble; R_xlen_t xlen=XLENGTH(sexp_data); switch (type){ case 1: errcode=MPI_Bcast(INTEGER(sexp_data), len, MPI_INT, rank, comm[commn]); break; case 2: mpi_errhandler(MPI_Bcast(REAL(sexp_data), len, MPI_DOUBLE, rank, comm[commn])); break; case 3: MPI_Comm_rank(comm[commn], &root); slen=LENGTH(STRING_ELT (sexp_data,0)); if (rank==root) MPI_Bcast(CHAR2 (STRING_ELT (sexp_data,0)), slen, MPI_CHAR, rank, comm[commn]); else { PROTECT (sexp_data2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(slen, char); MPI_Bcast(rdata, slen, MPI_CHAR, rank, comm[commn]); SET_STRING_ELT(sexp_data2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); } break; case 4: errcode=MPI_Bcast(RAW(sexp_data), len, MPI_BYTE, rank, comm[commn]); break; case 5: MPI_Type_contiguous(buffunit, MPI_DOUBLE, xdouble); MPI_Type_commit(xdouble); if ((xlen % buffunit) > 0) len=1+(xlen/buffunit); else len=xlen/buffunit; mpi_errhandler(MPI_Bcast(REAL(sexp_data), len, xdouble[0], rank, comm[commn])); MPI_Type_free(xdouble); break; default: PROTECT(sexp_data=AS_NUMERIC(sexp_data)); mpi_errhandler(MPI_Bcast(REAL(sexp_data), 1, datatype[0], rank, comm[commn])); UNPROTECT(1); break; } if (errcode!=MPI_SUCCESS){ int errmsglen; char errmsg[MPI_MAX_ERROR_STRING]; MPI_Error_string(errcode, errmsg, &errmsglen); Rprintf("%s\n",errmsg); return mkString("error"); } else { if ((INTEGER(sexp_type)[0]==3) && (rank!=root)) return sexp_data2; else return sexp_data; } } SEXP mpi_send(SEXP sexp_data, SEXP sexp_type, SEXP sexp_dest, SEXP sexp_tag, SEXP sexp_comm){ int slen,len=LENGTH(sexp_data),type=INTEGER(sexp_type)[0], dest=INTEGER(sexp_dest)[0]; int commn=INTEGER(sexp_comm)[0], tag=INTEGER(sexp_tag)[0]; switch (type){ case 1: mpi_errhandler(MPI_Send(INTEGER(sexp_data), len, MPI_INT, dest, tag, comm[commn])); break; case 2: mpi_errhandler(MPI_Send(REAL(sexp_data), len, MPI_DOUBLE, dest, tag, comm[commn])); break; case 3: slen=LENGTH(STRING_ELT(sexp_data,0)); MPI_Send(CHAR2(STRING_ELT(sexp_data,0)),slen, MPI_CHAR, dest, tag, comm[commn]); break; case 4: MPI_Send(RAW(sexp_data),len, MPI_BYTE, dest, tag, comm[commn]); break; default: PROTECT(sexp_data=AS_NUMERIC(sexp_data)); mpi_errhandler(MPI_Send(REAL(sexp_data), 1, datatype[0], dest, tag, comm[commn])); UNPROTECT(1); break; } return R_NilValue; } SEXP mpi_recv(SEXP sexp_data, SEXP sexp_type, SEXP sexp_source, SEXP sexp_tag, SEXP sexp_comm, SEXP sexp_status){ int len=LENGTH(sexp_data), type=INTEGER(sexp_type)[0], source=INTEGER(sexp_source)[0]; int tag=INTEGER(sexp_tag)[0],commn=INTEGER(sexp_comm)[0], statusn=INTEGER(sexp_status)[0]; int slen; char *rdata; SEXP sexp_data2 = NULL; switch (type){ case 1: mpi_errhandler(MPI_Recv(INTEGER(sexp_data), len, MPI_INT, source, tag, comm[commn], &status[statusn])); break; case 2: mpi_errhandler(MPI_Recv(REAL(sexp_data), len, MPI_DOUBLE, source, tag, comm[commn], &status[statusn])); break; case 3: slen=LENGTH(STRING_ELT(sexp_data,0)); PROTECT (sexp_data2 = allocVector (STRSXP, 1)); rdata = (char *)Calloc(slen, char); MPI_Recv(rdata, slen,MPI_CHAR,source,tag, comm[commn],&status[statusn]); SET_STRING_ELT(sexp_data2, 0, mkChar(rdata)); UNPROTECT(1); Free(rdata); break; case 4: mpi_errhandler(MPI_Recv(RAW(sexp_data), len, MPI_BYTE, source, tag, comm[commn], &status[statusn])); break; default: PROTECT(sexp_data=AS_NUMERIC(sexp_data)); mpi_errhandler(MPI_Recv(REAL(sexp_data), 1, datatype[0], source, tag, comm[commn], &status[statusn])); UNPROTECT(1); break; } if (INTEGER(sexp_type)[0]==3) return sexp_data2; else return sexp_data; } SEXP mpi_reduce(SEXP sexp_send, SEXP sexp_type, SEXP sexp_op, SEXP sexp_dest, SEXP sexp_comm){ int len=LENGTH(sexp_send), type=INTEGER(sexp_type)[0], dest=INTEGER(sexp_dest)[0]; int commn=INTEGER(sexp_comm)[0], intop = INTEGER(sexp_op)[0]; MPI_Op op= MPI_SUM; SEXP sexp_recv = NULL; switch(intop){ case 1: op=MPI_SUM; break; case 2: op=MPI_PROD; break; case 3: op=MPI_MAX; break; case 4: op=MPI_MIN; break; case 5: op=MPI_MAXLOC; break; case 6: op=MPI_MINLOC; break; } switch(type){ case 1: if (intop < 5){ PROTECT (sexp_recv = allocVector(INTSXP, len)); mpi_errhandler(MPI_Reduce(INTEGER(sexp_send), INTEGER(sexp_recv), len, MPI_INT, op, dest, comm[commn])); break; } else{ int *send, rank, i; MPI_Comm_rank(comm[commn], &rank); send = (int *)Calloc(2*len, int); for (i=0; i < len; i++){ send[2*i] = INTEGER(sexp_send)[i]; send[2*i+1] = rank; } PROTECT (sexp_recv = allocVector(INTSXP, 2*len)); mpi_errhandler(MPI_Reduce(send, INTEGER(sexp_recv), len, MPI_2INT, op, dest, comm[commn])); Free(send); break; } case 2: if (intop < 5){ PROTECT (sexp_recv = allocVector(REALSXP, len)); mpi_errhandler(MPI_Reduce(REAL(sexp_send), REAL(sexp_recv), len, MPI_DOUBLE, op, dest, comm[commn])); break; } else { int i, rank; struct Dblint *send, *recv; send=(struct Dblint *)Calloc(len, struct Dblint); recv=(struct Dblint *)Calloc(len, struct Dblint); MPI_Comm_rank(comm[commn], &rank); for (i=0;i #include SEXP AsInt (int x) { SEXP sexp_x; PROTECT (sexp_x = allocVector (INTSXP, 1)); INTEGER (sexp_x)[0] = x; UNPROTECT (1); return sexp_x; } SEXP pid(){ return AsInt(getpid()); } SEXP mkstr(SEXP sexp_charlen){ int i, charlen = INTEGER(sexp_charlen)[0]; char *tmp, spchar[1]=" "; SEXP new_strvec; tmp = (char *) R_alloc (charlen, sizeof(char)); for (i=0; i < charlen; tmp[i++]=spchar[0]); PROTECT (new_strvec = allocVector (STRSXP, 1)); SET_STRING_ELT(new_strvec, 0, COPY_TO_USER_STRING(tmp)); UNPROTECT(1); return new_strvec; } /* SEXP stringslink(SEXP sexp_strings,SEXP new_string){ int i, sum=0,stringlen = LENGTH(sexp_strings); int sublen[stringlen]; for(i=0;i #include #include #include #include #include #define CHAR2(x) ((char *)CHAR(x)) /* #define COMM_MAXSIZE 10 */ int mpi_errhandler(int errcode); int erreturn(int errcode); MPI_Datatype mpitype(SEXP sexp_type); // void mystrcpy(char *new_str, char *old_str, int size); SEXP AsInt (int n); struct Dblint { double x; int rank; }; // char *acopy_string2(const char *in); // char *charsxp2char(SEXP x); // #define CallocCharBuf2(n) (char *) R_chk_calloc2((size_t) ((n)+1), sizeof(char)) // extern void *R_chk_calloc2(size_t, size_t); Rmpi/src/internal.c0000644000176000001440000000430312336662142013765 0ustar ripleyusers/* Copyright (C) 2002 Hao Yu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Rmpi.h" int mpi_errhandler(int errcode) { int errmsglen; char errmsg[MPI_MAX_ERROR_STRING]; if (errcode != MPI_SUCCESS) { MPI_Error_string(errcode, errmsg, &errmsglen); error(errmsg); } return errcode; } int erreturn(int errcode){ if (errcode==MPI_SUCCESS) return 1; else return 0; } MPI_Datatype mpitype(SEXP sexp_type){ MPI_Datatype datatype = MPI_DATATYPE_NULL; switch(INTEGER(sexp_type)[0]){ case 1: datatype=MPI_INT; break; case 2: datatype=MPI_DOUBLE; break; case 3: datatype=MPI_CHAR; break; case 4: datatype=MPI_BYTE; break; } return datatype; } /* void mystrcpy(char *new_str, char *old_str, int size) { int i; for (i=0; i< size; new_str[i]=old_str[i++]); } */ /* Return a copy of a string using memory from R_alloc */ /* char *acopy_string2(const char *in) { char *out; int len = strlen(in); if (len > 0) { out = (char *) R_alloc(strlen(in), sizeof(char)); strcpy(out, in); } else out = ""; return out; } char *charsxp2char(SEXP x) { return acopy_string2(CHAR(x)); } */ /* void *R_chk_calloc2(size_t nelem, size_t elsize) { void *p; #ifndef HAVE_WORKING_CALLOC if(nelem == 0) return(NULL); #endif p = calloc(nelem, elsize); if(!p) error(_("Calloc could not allocate (%d of %d) memory"), nelem, elsize); return(p); } */ Rmpi/src/msmpi.def0000644000176000001440000013106512277363312013621 0ustar ripleyusersLIBRARY "msmpi.dll" EXPORTS MPIPRIV1 DATA MPIPRIV2 DATA MPIPRIVC DATA MPIR_Comm_errhandler_set_proxy MPIR_Dup_fn MPIR_Error MPIR_File_errhandler_set_proxy MPIR_Free MPIR_Grequest_set_proxy MPIR_Keyval_set_proxy MPIR_Malloc MPIR_Op_set_proxy MPIR_Win_errhandler_set_proxy MPI_ABORT MPI_ACCUMULATE MPI_ADDRESS MPI_ADD_ERROR_CLASS MPI_ADD_ERROR_CODE MPI_ADD_ERROR_STRING MPI_ALLGATHER MPI_ALLGATHERV MPI_ALLOC_MEM MPI_ALLREDUCE MPI_ALLTOALL MPI_ALLTOALLV MPI_ALLTOALLW MPI_ATTR_DELETE MPI_ATTR_GET MPI_ATTR_PUT MPI_Abort MPI_Accumulate MPI_Add_error_class MPI_Add_error_code MPI_Add_error_string MPI_Address MPI_Allgather MPI_Allgatherv MPI_Alloc_mem MPI_Allreduce MPI_Alltoall MPI_Alltoallv MPI_Alltoallw MPI_Attr_delete MPI_Attr_get MPI_Attr_put MPI_BARRIER MPI_BCAST MPI_BSEND MPI_BSEND_INIT MPI_BUFFER_ATTACH MPI_BUFFER_DETACH MPI_Barrier MPI_Bcast MPI_Bsend MPI_Bsend_init MPI_Buffer_attach MPI_Buffer_detach MPI_CANCEL MPI_CARTDIM_GET MPI_CART_COORDS MPI_CART_CREATE MPI_CART_GET MPI_CART_MAP MPI_CART_RANK MPI_CART_SHIFT MPI_CART_SUB MPI_CLOSE_PORT MPI_COMM_ACCEPT MPI_COMM_CALL_ERRHANDLER MPI_COMM_COMPARE MPI_COMM_CONNECT MPI_COMM_CREATE MPI_COMM_CREATE_ERRHANDLER MPI_COMM_CREATE_KEYVAL MPI_COMM_DELETE_ATTR MPI_COMM_DISCONNECT MPI_COMM_DUP MPI_COMM_DUP_FN MPI_COMM_FREE MPI_COMM_FREE_KEYVAL MPI_COMM_GET_ATTR MPI_COMM_GET_ERRHANDLER MPI_COMM_GET_NAME MPI_COMM_GET_PARENT MPI_COMM_GROUP MPI_COMM_JOIN MPI_COMM_NULL_COPY_FN MPI_COMM_NULL_DELETE_FN MPI_COMM_RANK MPI_COMM_REMOTE_GROUP MPI_COMM_REMOTE_SIZE MPI_COMM_SET_ATTR MPI_COMM_SET_ERRHANDLER MPI_COMM_SET_NAME MPI_COMM_SIZE MPI_COMM_SPAWN MPI_COMM_SPAWN_MULTIPLE MPI_COMM_SPLIT MPI_COMM_TEST_INTER MPI_CONVERSION_FN_NULL MPI_Cancel MPI_Cart_coords MPI_Cart_create MPI_Cart_get MPI_Cart_map MPI_Cart_rank MPI_Cart_shift MPI_Cart_sub MPI_Cartdim_get MPI_Close_port MPI_Comm_accept MPI_Comm_call_errhandler MPI_Comm_compare MPI_Comm_connect MPI_Comm_create MPI_Comm_create_errhandler MPI_Comm_create_keyval MPI_Comm_delete_attr MPI_Comm_disconnect MPI_Comm_dup MPI_Comm_free MPI_Comm_free_keyval MPI_Comm_get_attr MPI_Comm_get_errhandler MPI_Comm_get_name MPI_Comm_get_parent MPI_Comm_group MPI_Comm_join MPI_Comm_rank MPI_Comm_remote_group MPI_Comm_remote_size MPI_Comm_set_attr MPI_Comm_set_errhandler MPI_Comm_set_name MPI_Comm_size MPI_Comm_spawn MPI_Comm_spawn_multiple MPI_Comm_split MPI_Comm_test_inter MPI_DIMS_CREATE MPI_DUP_FN MPI_Dims_create MPI_ERRHANDLER_CREATE MPI_ERRHANDLER_FREE MPI_ERRHANDLER_GET MPI_ERRHANDLER_SET MPI_ERROR_CLASS MPI_ERROR_STRING MPI_EXSCAN MPI_Errhandler_create MPI_Errhandler_free MPI_Errhandler_get MPI_Errhandler_set MPI_Error_class MPI_Error_string MPI_Exscan MPI_FILE_CALL_ERRHANDLER MPI_FILE_CLOSE MPI_FILE_CREATE_ERRHANDLER MPI_FILE_DELETE MPI_FILE_GET_AMODE MPI_FILE_GET_ATOMICITY MPI_FILE_GET_BYTE_OFFSET MPI_FILE_GET_ERRHANDLER MPI_FILE_GET_GROUP MPI_FILE_GET_INFO MPI_FILE_GET_POSITION MPI_FILE_GET_POSITION_SHARED MPI_FILE_GET_SIZE MPI_FILE_GET_TYPE_EXTENT MPI_FILE_GET_VIEW MPI_FILE_IREAD MPI_FILE_IREAD_AT MPI_FILE_IREAD_SHARED MPI_FILE_IWRITE MPI_FILE_IWRITE_AT MPI_FILE_IWRITE_SHARED MPI_FILE_OPEN MPI_FILE_PREALLOCATE MPI_FILE_READ MPI_FILE_READ_ALL MPI_FILE_READ_ALL_BEGIN MPI_FILE_READ_ALL_END MPI_FILE_READ_AT MPI_FILE_READ_AT_ALL MPI_FILE_READ_AT_ALL_BEGIN MPI_FILE_READ_AT_ALL_END MPI_FILE_READ_ORDERED MPI_FILE_READ_ORDERED_BEGIN MPI_FILE_READ_ORDERED_END MPI_FILE_READ_SHARED MPI_FILE_SEEK MPI_FILE_SEEK_SHARED MPI_FILE_SET_ATOMICITY MPI_FILE_SET_ERRHANDLER MPI_FILE_SET_INFO MPI_FILE_SET_SIZE MPI_FILE_SET_VIEW MPI_FILE_SYNC MPI_FILE_WRITE MPI_FILE_WRITE_ALL MPI_FILE_WRITE_ALL_BEGIN MPI_FILE_WRITE_ALL_END MPI_FILE_WRITE_AT MPI_FILE_WRITE_AT_ALL MPI_FILE_WRITE_AT_ALL_BEGIN MPI_FILE_WRITE_AT_ALL_END MPI_FILE_WRITE_ORDERED MPI_FILE_WRITE_ORDERED_BEGIN MPI_FILE_WRITE_ORDERED_END MPI_FILE_WRITE_SHARED MPI_FINALIZE MPI_FINALIZED MPI_FREE_MEM MPI_F_STATUSES_IGNORE DATA MPI_F_STATUS_IGNORE DATA MPI_File_c2f MPI_File_call_errhandler MPI_File_close MPI_File_create_errhandler MPI_File_delete MPI_File_f2c MPI_File_get_amode MPI_File_get_atomicity MPI_File_get_byte_offset MPI_File_get_errhandler MPI_File_get_group MPI_File_get_info MPI_File_get_position MPI_File_get_position_shared MPI_File_get_size MPI_File_get_type_extent MPI_File_get_view MPI_File_iread MPI_File_iread_at MPI_File_iread_shared MPI_File_iwrite MPI_File_iwrite_at MPI_File_iwrite_shared MPI_File_open MPI_File_preallocate MPI_File_read MPI_File_read_all MPI_File_read_all_begin MPI_File_read_all_end MPI_File_read_at MPI_File_read_at_all MPI_File_read_at_all_begin MPI_File_read_at_all_end MPI_File_read_ordered MPI_File_read_ordered_begin MPI_File_read_ordered_end MPI_File_read_shared MPI_File_seek MPI_File_seek_shared MPI_File_set_atomicity MPI_File_set_errhandler MPI_File_set_info MPI_File_set_size MPI_File_set_view MPI_File_sync MPI_File_write MPI_File_write_all MPI_File_write_all_begin MPI_File_write_all_end MPI_File_write_at MPI_File_write_at_all MPI_File_write_at_all_begin MPI_File_write_at_all_end MPI_File_write_ordered MPI_File_write_ordered_begin MPI_File_write_ordered_end MPI_File_write_shared MPI_Finalize MPI_Finalized MPI_Free_mem MPI_GATHER MPI_GATHERV MPI_GET MPI_GET_ADDRESS MPI_GET_COUNT MPI_GET_ELEMENTS MPI_GET_PROCESSOR_NAME MPI_GET_VERSION MPI_GRAPHDIMS_GET MPI_GRAPH_CREATE MPI_GRAPH_GET MPI_GRAPH_MAP MPI_GRAPH_NEIGHBORS MPI_GRAPH_NEIGHBORS_COUNT MPI_GREQUEST_COMPLETE MPI_GREQUEST_START MPI_GROUP_COMPARE MPI_GROUP_DIFFERENCE MPI_GROUP_EXCL MPI_GROUP_FREE MPI_GROUP_INCL MPI_GROUP_INTERSECTION MPI_GROUP_RANGE_EXCL MPI_GROUP_RANGE_INCL MPI_GROUP_RANK MPI_GROUP_SIZE MPI_GROUP_TRANSLATE_RANKS MPI_GROUP_UNION MPI_Gather MPI_Gatherv MPI_Get MPI_Get_address MPI_Get_count MPI_Get_elements MPI_Get_processor_name MPI_Get_version MPI_Graph_create MPI_Graph_get MPI_Graph_map MPI_Graph_neighbors MPI_Graph_neighbors_count MPI_Graphdims_get MPI_Grequest_complete MPI_Grequest_start MPI_Group_compare MPI_Group_difference MPI_Group_excl MPI_Group_free MPI_Group_incl MPI_Group_intersection MPI_Group_range_excl MPI_Group_range_incl MPI_Group_rank MPI_Group_size MPI_Group_translate_ranks MPI_Group_union MPI_IBSEND MPI_INFO_CREATE MPI_INFO_DELETE MPI_INFO_DUP MPI_INFO_FREE MPI_INFO_GET MPI_INFO_GET_NKEYS MPI_INFO_GET_NTHKEY MPI_INFO_GET_VALUELEN MPI_INFO_SET MPI_INIT MPI_INITIALIZED MPI_INIT_THREAD MPI_INTERCOMM_CREATE MPI_INTERCOMM_MERGE MPI_IPROBE MPI_IRECV MPI_IRSEND MPI_ISEND MPI_ISSEND MPI_IS_THREAD_MAIN MPI_Ibsend MPI_Info_create MPI_Info_delete MPI_Info_dup MPI_Info_free MPI_Info_get MPI_Info_get_nkeys MPI_Info_get_nthkey MPI_Info_get_valuelen MPI_Info_set MPI_Init MPI_Init_thread MPI_Initialized MPI_Intercomm_create MPI_Intercomm_merge MPI_Iprobe MPI_Irecv MPI_Irsend MPI_Is_thread_main MPI_Isend MPI_Issend MPI_KEYVAL_CREATE MPI_KEYVAL_FREE MPI_Keyval_create MPI_Keyval_free MPI_LOOKUP_NAME MPI_Lookup_name MPI_NULL_COPY_FN MPI_NULL_DELETE_FN MPI_OPEN_PORT MPI_OP_CREATE MPI_OP_FREE MPI_Op_create MPI_Op_free MPI_Open_port MPI_PACK MPI_PACK_EXTERNAL MPI_PACK_EXTERNAL_SIZE MPI_PACK_SIZE MPI_PCONTROL MPI_PROBE MPI_PUBLISH_NAME MPI_PUT MPI_Pack MPI_Pack_external MPI_Pack_external_size MPI_Pack_size MPI_Pcontrol MPI_Probe MPI_Publish_name MPI_Put MPI_QUERY_THREAD MPI_Query_thread MPI_RECV MPI_RECV_INIT MPI_REDUCE MPI_REDUCE_SCATTER MPI_REGISTER_DATAREP MPI_REQUEST_FREE MPI_REQUEST_GET_STATUS MPI_RSEND MPI_RSEND_INIT MPI_Recv MPI_Recv_init MPI_Reduce MPI_Reduce_local MPI_Reduce_scatter MPI_Register_datarep MPI_Request_free MPI_Request_get_status MPI_Rsend MPI_Rsend_init MPI_SCAN MPI_SCATTER MPI_SCATTERV MPI_SEND MPI_SENDRECV MPI_SENDRECV_REPLACE MPI_SEND_INIT MPI_SSEND MPI_SSEND_INIT MPI_START MPI_STARTALL MPI_STATUS_SET_CANCELLED MPI_STATUS_SET_ELEMENTS MPI_Scan MPI_Scatter MPI_Scatterv MPI_Send MPI_Send_init MPI_Sendrecv MPI_Sendrecv_replace MPI_Ssend MPI_Ssend_init MPI_Start MPI_Startall MPI_Status_c2f MPI_Status_f2c MPI_Status_set_cancelled MPI_Status_set_elements MPI_TEST MPI_TESTALL MPI_TESTANY MPI_TESTSOME MPI_TEST_CANCELLED MPI_TOPO_TEST MPI_TYPE_COMMIT MPI_TYPE_CONTIGUOUS MPI_TYPE_CREATE_DARRAY MPI_TYPE_CREATE_HINDEXED MPI_TYPE_CREATE_HVECTOR MPI_TYPE_CREATE_INDEXED_BLOCK MPI_TYPE_CREATE_KEYVAL MPI_TYPE_CREATE_RESIZED MPI_TYPE_CREATE_STRUCT MPI_TYPE_CREATE_SUBARRAY MPI_TYPE_DELETE_ATTR MPI_TYPE_DUP MPI_TYPE_DUP_FN MPI_TYPE_EXTENT MPI_TYPE_FREE MPI_TYPE_FREE_KEYVAL MPI_TYPE_GET_ATTR MPI_TYPE_GET_CONTENTS MPI_TYPE_GET_ENVELOPE MPI_TYPE_GET_EXTENT MPI_TYPE_GET_NAME MPI_TYPE_GET_TRUE_EXTENT MPI_TYPE_HINDEXED MPI_TYPE_HVECTOR MPI_TYPE_INDEXED MPI_TYPE_LB MPI_TYPE_MATCH_SIZE MPI_TYPE_NULL_COPY_FN MPI_TYPE_NULL_DELETE_FN MPI_TYPE_SET_ATTR MPI_TYPE_SET_NAME MPI_TYPE_SIZE MPI_TYPE_STRUCT MPI_TYPE_UB MPI_TYPE_VECTOR MPI_Test MPI_Test_cancelled MPI_Testall MPI_Testany MPI_Testsome MPI_Topo_test MPI_Type_commit MPI_Type_contiguous MPI_Type_create_darray MPI_Type_create_hindexed MPI_Type_create_hvector MPI_Type_create_indexed_block MPI_Type_create_keyval MPI_Type_create_resized MPI_Type_create_struct MPI_Type_create_subarray MPI_Type_delete_attr MPI_Type_dup MPI_Type_extent MPI_Type_free MPI_Type_free_keyval MPI_Type_get_attr MPI_Type_get_contents MPI_Type_get_envelope MPI_Type_get_extent MPI_Type_get_name MPI_Type_get_true_extent MPI_Type_hindexed MPI_Type_hvector MPI_Type_indexed MPI_Type_lb MPI_Type_match_size MPI_Type_set_attr MPI_Type_set_name MPI_Type_size MPI_Type_struct MPI_Type_ub MPI_Type_vector MPI_UNPACK MPI_UNPACK_EXTERNAL MPI_UNPUBLISH_NAME MPI_Unpack MPI_Unpack_external MPI_Unpublish_name MPI_WAIT MPI_WAITALL MPI_WAITANY MPI_WAITSOME MPI_WIN_CALL_ERRHANDLER MPI_WIN_COMPLETE MPI_WIN_CREATE MPI_WIN_CREATE_ERRHANDLER MPI_WIN_CREATE_KEYVAL MPI_WIN_DELETE_ATTR MPI_WIN_DUP_FN MPI_WIN_FENCE MPI_WIN_FREE MPI_WIN_FREE_KEYVAL MPI_WIN_GET_ATTR MPI_WIN_GET_ERRHANDLER MPI_WIN_GET_GROUP MPI_WIN_GET_NAME MPI_WIN_LOCK MPI_WIN_NULL_COPY_FN MPI_WIN_NULL_DELETE_FN MPI_WIN_POST MPI_WIN_SET_ATTR MPI_WIN_SET_ERRHANDLER MPI_WIN_SET_NAME MPI_WIN_START MPI_WIN_TEST MPI_WIN_UNLOCK MPI_WIN_WAIT MPI_WTICK MPI_WTIME MPI_Wait MPI_Waitall MPI_Waitany MPI_Waitsome MPI_Win_call_errhandler MPI_Win_complete MPI_Win_create MPI_Win_create_errhandler MPI_Win_create_keyval MPI_Win_delete_attr MPI_Win_fence MPI_Win_free MPI_Win_free_keyval MPI_Win_get_attr MPI_Win_get_errhandler MPI_Win_get_group MPI_Win_get_name MPI_Win_lock MPI_Win_post MPI_Win_set_attr MPI_Win_set_errhandler MPI_Win_set_name MPI_Win_start MPI_Win_test MPI_Win_unlock MPI_Win_wait MPI_Wtick MPI_Wtime MSMPI_Get_bsend_overhead MSMPI_Get_version MSMPI_Queuelock_acquire MSMPI_Queuelock_release MSMPI_Request_set_apc MSMPI_Waitsome_interruptible PMPI_ABORT PMPI_ACCUMULATE PMPI_ADDRESS PMPI_ADD_ERROR_CLASS PMPI_ADD_ERROR_CODE PMPI_ADD_ERROR_STRING PMPI_ALLGATHER PMPI_ALLGATHERV PMPI_ALLOC_MEM PMPI_ALLREDUCE PMPI_ALLTOALL PMPI_ALLTOALLV PMPI_ALLTOALLW PMPI_ATTR_DELETE PMPI_ATTR_GET PMPI_ATTR_PUT PMPI_Abort PMPI_Accumulate PMPI_Add_error_class PMPI_Add_error_code PMPI_Add_error_string PMPI_Address PMPI_Allgather PMPI_Allgatherv PMPI_Alloc_mem PMPI_Allreduce PMPI_Alltoall PMPI_Alltoallv PMPI_Alltoallw PMPI_Attr_delete PMPI_Attr_get PMPI_Attr_put PMPI_BARRIER PMPI_BCAST PMPI_BSEND PMPI_BSEND_INIT PMPI_BUFFER_ATTACH PMPI_BUFFER_DETACH PMPI_Barrier PMPI_Bcast PMPI_Bsend PMPI_Bsend_init PMPI_Buffer_attach PMPI_Buffer_detach PMPI_CANCEL PMPI_CARTDIM_GET PMPI_CART_COORDS PMPI_CART_CREATE PMPI_CART_GET PMPI_CART_MAP PMPI_CART_RANK PMPI_CART_SHIFT PMPI_CART_SUB PMPI_CLOSE_PORT PMPI_COMM_ACCEPT PMPI_COMM_CALL_ERRHANDLER PMPI_COMM_COMPARE PMPI_COMM_CONNECT PMPI_COMM_CREATE PMPI_COMM_CREATE_ERRHANDLER PMPI_COMM_CREATE_KEYVAL PMPI_COMM_DELETE_ATTR PMPI_COMM_DISCONNECT PMPI_COMM_DUP PMPI_COMM_DUP_FN PMPI_COMM_FREE PMPI_COMM_FREE_KEYVAL PMPI_COMM_GET_ATTR PMPI_COMM_GET_ERRHANDLER PMPI_COMM_GET_NAME PMPI_COMM_GET_PARENT PMPI_COMM_GROUP PMPI_COMM_JOIN PMPI_COMM_NULL_COPY_FN PMPI_COMM_NULL_DELETE_FN PMPI_COMM_RANK PMPI_COMM_REMOTE_GROUP PMPI_COMM_REMOTE_SIZE PMPI_COMM_SET_ATTR PMPI_COMM_SET_ERRHANDLER PMPI_COMM_SET_NAME PMPI_COMM_SIZE PMPI_COMM_SPAWN PMPI_COMM_SPAWN_MULTIPLE PMPI_COMM_SPLIT PMPI_COMM_TEST_INTER PMPI_Cancel PMPI_Cart_coords PMPI_Cart_create PMPI_Cart_get PMPI_Cart_map PMPI_Cart_rank PMPI_Cart_shift PMPI_Cart_sub PMPI_Cartdim_get PMPI_Close_port PMPI_Comm_accept PMPI_Comm_call_errhandler PMPI_Comm_compare PMPI_Comm_connect PMPI_Comm_create PMPI_Comm_create_errhandler PMPI_Comm_create_keyval PMPI_Comm_delete_attr PMPI_Comm_disconnect PMPI_Comm_dup PMPI_Comm_free PMPI_Comm_free_keyval PMPI_Comm_get_attr PMPI_Comm_get_errhandler PMPI_Comm_get_name PMPI_Comm_get_parent PMPI_Comm_group PMPI_Comm_join PMPI_Comm_rank PMPI_Comm_remote_group PMPI_Comm_remote_size PMPI_Comm_set_attr PMPI_Comm_set_errhandler PMPI_Comm_set_name PMPI_Comm_size PMPI_Comm_spawn PMPI_Comm_spawn_multiple PMPI_Comm_split PMPI_Comm_test_inter PMPI_DIMS_CREATE PMPI_DUP_FN PMPI_Dims_create PMPI_ERRHANDLER_CREATE PMPI_ERRHANDLER_FREE PMPI_ERRHANDLER_GET PMPI_ERRHANDLER_SET PMPI_ERROR_CLASS PMPI_ERROR_STRING PMPI_EXSCAN PMPI_Errhandler_create PMPI_Errhandler_free PMPI_Errhandler_get PMPI_Errhandler_set PMPI_Error_class PMPI_Error_string PMPI_Exscan PMPI_FILE_CALL_ERRHANDLER PMPI_FILE_CLOSE PMPI_FILE_CREATE_ERRHANDLER PMPI_FILE_DELETE PMPI_FILE_GET_AMODE PMPI_FILE_GET_ATOMICITY PMPI_FILE_GET_BYTE_OFFSET PMPI_FILE_GET_ERRHANDLER PMPI_FILE_GET_GROUP PMPI_FILE_GET_INFO PMPI_FILE_GET_POSITION PMPI_FILE_GET_POSITION_SHARED PMPI_FILE_GET_SIZE PMPI_FILE_GET_TYPE_EXTENT PMPI_FILE_GET_VIEW PMPI_FILE_IREAD PMPI_FILE_IREAD_AT PMPI_FILE_IREAD_SHARED PMPI_FILE_IWRITE PMPI_FILE_IWRITE_AT PMPI_FILE_IWRITE_SHARED PMPI_FILE_OPEN PMPI_FILE_PREALLOCATE PMPI_FILE_READ PMPI_FILE_READ_ALL PMPI_FILE_READ_ALL_BEGIN PMPI_FILE_READ_ALL_END PMPI_FILE_READ_AT PMPI_FILE_READ_AT_ALL PMPI_FILE_READ_AT_ALL_BEGIN PMPI_FILE_READ_AT_ALL_END PMPI_FILE_READ_ORDERED PMPI_FILE_READ_ORDERED_BEGIN PMPI_FILE_READ_ORDERED_END PMPI_FILE_READ_SHARED PMPI_FILE_SEEK PMPI_FILE_SEEK_SHARED PMPI_FILE_SET_ATOMICITY PMPI_FILE_SET_ERRHANDLER PMPI_FILE_SET_INFO PMPI_FILE_SET_SIZE PMPI_FILE_SET_VIEW PMPI_FILE_SYNC PMPI_FILE_WRITE PMPI_FILE_WRITE_ALL PMPI_FILE_WRITE_ALL_BEGIN PMPI_FILE_WRITE_ALL_END PMPI_FILE_WRITE_AT PMPI_FILE_WRITE_AT_ALL PMPI_FILE_WRITE_AT_ALL_BEGIN PMPI_FILE_WRITE_AT_ALL_END PMPI_FILE_WRITE_ORDERED PMPI_FILE_WRITE_ORDERED_BEGIN PMPI_FILE_WRITE_ORDERED_END PMPI_FILE_WRITE_SHARED PMPI_FINALIZE PMPI_FINALIZED PMPI_FREE_MEM PMPI_File_c2f PMPI_File_call_errhandler PMPI_File_close PMPI_File_create_errhandler PMPI_File_delete PMPI_File_f2c PMPI_File_get_amode PMPI_File_get_atomicity PMPI_File_get_byte_offset PMPI_File_get_errhandler PMPI_File_get_group PMPI_File_get_info PMPI_File_get_position PMPI_File_get_position_shared PMPI_File_get_size PMPI_File_get_type_extent PMPI_File_get_view PMPI_File_iread PMPI_File_iread_at PMPI_File_iread_shared PMPI_File_iwrite PMPI_File_iwrite_at PMPI_File_iwrite_shared PMPI_File_open PMPI_File_preallocate PMPI_File_read PMPI_File_read_all PMPI_File_read_all_begin PMPI_File_read_all_end PMPI_File_read_at PMPI_File_read_at_all PMPI_File_read_at_all_begin PMPI_File_read_at_all_end PMPI_File_read_ordered PMPI_File_read_ordered_begin PMPI_File_read_ordered_end PMPI_File_read_shared PMPI_File_seek PMPI_File_seek_shared PMPI_File_set_atomicity PMPI_File_set_errhandler PMPI_File_set_info PMPI_File_set_size PMPI_File_set_view PMPI_File_sync PMPI_File_write PMPI_File_write_all PMPI_File_write_all_begin PMPI_File_write_all_end PMPI_File_write_at PMPI_File_write_at_all PMPI_File_write_at_all_begin PMPI_File_write_at_all_end PMPI_File_write_ordered PMPI_File_write_ordered_begin PMPI_File_write_ordered_end PMPI_File_write_shared PMPI_Finalize PMPI_Finalized PMPI_Free_mem PMPI_GATHER PMPI_GATHERV PMPI_GET PMPI_GET_ADDRESS PMPI_GET_COUNT PMPI_GET_ELEMENTS PMPI_GET_PROCESSOR_NAME PMPI_GET_VERSION PMPI_GRAPHDIMS_GET PMPI_GRAPH_CREATE PMPI_GRAPH_GET PMPI_GRAPH_MAP PMPI_GRAPH_NEIGHBORS PMPI_GRAPH_NEIGHBORS_COUNT PMPI_GREQUEST_COMPLETE PMPI_GREQUEST_START PMPI_GROUP_COMPARE PMPI_GROUP_DIFFERENCE PMPI_GROUP_EXCL PMPI_GROUP_FREE PMPI_GROUP_INCL PMPI_GROUP_INTERSECTION PMPI_GROUP_RANGE_EXCL PMPI_GROUP_RANGE_INCL PMPI_GROUP_RANK PMPI_GROUP_SIZE PMPI_GROUP_TRANSLATE_RANKS PMPI_GROUP_UNION PMPI_Gather PMPI_Gatherv PMPI_Get PMPI_Get_address PMPI_Get_count PMPI_Get_elements PMPI_Get_processor_name PMPI_Get_version PMPI_Graph_create PMPI_Graph_get PMPI_Graph_map PMPI_Graph_neighbors PMPI_Graph_neighbors_count PMPI_Graphdims_get PMPI_Grequest_complete PMPI_Grequest_start PMPI_Group_compare PMPI_Group_difference PMPI_Group_excl PMPI_Group_free PMPI_Group_incl PMPI_Group_intersection PMPI_Group_range_excl PMPI_Group_range_incl PMPI_Group_rank PMPI_Group_size PMPI_Group_translate_ranks PMPI_Group_union PMPI_IBSEND PMPI_INFO_CREATE PMPI_INFO_DELETE PMPI_INFO_DUP PMPI_INFO_FREE PMPI_INFO_GET PMPI_INFO_GET_NKEYS PMPI_INFO_GET_NTHKEY PMPI_INFO_GET_VALUELEN PMPI_INFO_SET PMPI_INIT PMPI_INITIALIZED PMPI_INIT_THREAD PMPI_INTERCOMM_CREATE PMPI_INTERCOMM_MERGE PMPI_IPROBE PMPI_IRECV PMPI_IRSEND PMPI_ISEND PMPI_ISSEND PMPI_IS_THREAD_MAIN PMPI_Ibsend PMPI_Info_create PMPI_Info_delete PMPI_Info_dup PMPI_Info_free PMPI_Info_get PMPI_Info_get_nkeys PMPI_Info_get_nthkey PMPI_Info_get_valuelen PMPI_Info_set PMPI_Init PMPI_Init_thread PMPI_Initialized PMPI_Intercomm_create PMPI_Intercomm_merge PMPI_Iprobe PMPI_Irecv PMPI_Irsend PMPI_Is_thread_main PMPI_Isend PMPI_Issend PMPI_KEYVAL_CREATE PMPI_KEYVAL_FREE PMPI_Keyval_create PMPI_Keyval_free PMPI_LOOKUP_NAME PMPI_Lookup_name PMPI_NULL_COPY_FN PMPI_NULL_DELETE_FN PMPI_OPEN_PORT PMPI_OP_CREATE PMPI_OP_FREE PMPI_Op_create PMPI_Op_free PMPI_Open_port PMPI_PACK PMPI_PACK_EXTERNAL PMPI_PACK_EXTERNAL_SIZE PMPI_PACK_SIZE PMPI_PCONTROL PMPI_PROBE PMPI_PUBLISH_NAME PMPI_PUT PMPI_Pack PMPI_Pack_external PMPI_Pack_external_size PMPI_Pack_size PMPI_Pcontrol PMPI_Probe PMPI_Publish_name PMPI_Put PMPI_QUERY_THREAD PMPI_Query_thread PMPI_RECV PMPI_RECV_INIT PMPI_REDUCE PMPI_REDUCE_SCATTER PMPI_REGISTER_DATAREP PMPI_REQUEST_FREE PMPI_REQUEST_GET_STATUS PMPI_RSEND PMPI_RSEND_INIT PMPI_Recv PMPI_Recv_init PMPI_Reduce PMPI_Reduce_local PMPI_Reduce_scatter PMPI_Register_datarep PMPI_Request_free PMPI_Request_get_status PMPI_Rsend PMPI_Rsend_init PMPI_SCAN PMPI_SCATTER PMPI_SCATTERV PMPI_SEND PMPI_SENDRECV PMPI_SENDRECV_REPLACE PMPI_SEND_INIT PMPI_SSEND PMPI_SSEND_INIT PMPI_START PMPI_STARTALL PMPI_STATUS_SET_CANCELLED PMPI_STATUS_SET_ELEMENTS PMPI_Scan PMPI_Scatter PMPI_Scatterv PMPI_Send PMPI_Send_init PMPI_Sendrecv PMPI_Sendrecv_replace PMPI_Ssend PMPI_Ssend_init PMPI_Start PMPI_Startall PMPI_Status_c2f PMPI_Status_f2c PMPI_Status_set_cancelled PMPI_Status_set_elements PMPI_TEST PMPI_TESTALL PMPI_TESTANY PMPI_TESTSOME PMPI_TEST_CANCELLED PMPI_TOPO_TEST PMPI_TYPE_COMMIT PMPI_TYPE_CONTIGUOUS PMPI_TYPE_CREATE_DARRAY PMPI_TYPE_CREATE_HINDEXED PMPI_TYPE_CREATE_HVECTOR PMPI_TYPE_CREATE_INDEXED_BLOCK PMPI_TYPE_CREATE_KEYVAL PMPI_TYPE_CREATE_RESIZED PMPI_TYPE_CREATE_STRUCT PMPI_TYPE_CREATE_SUBARRAY PMPI_TYPE_DELETE_ATTR PMPI_TYPE_DUP PMPI_TYPE_DUP_FN PMPI_TYPE_EXTENT PMPI_TYPE_FREE PMPI_TYPE_FREE_KEYVAL PMPI_TYPE_GET_ATTR PMPI_TYPE_GET_CONTENTS PMPI_TYPE_GET_ENVELOPE PMPI_TYPE_GET_EXTENT PMPI_TYPE_GET_NAME PMPI_TYPE_GET_TRUE_EXTENT PMPI_TYPE_HINDEXED PMPI_TYPE_HVECTOR PMPI_TYPE_INDEXED PMPI_TYPE_LB PMPI_TYPE_MATCH_SIZE PMPI_TYPE_NULL_COPY_FN PMPI_TYPE_NULL_DELETE_FN PMPI_TYPE_SET_ATTR PMPI_TYPE_SET_NAME PMPI_TYPE_SIZE PMPI_TYPE_STRUCT PMPI_TYPE_UB PMPI_TYPE_VECTOR PMPI_Test PMPI_Test_cancelled PMPI_Testall PMPI_Testany PMPI_Testsome PMPI_Topo_test PMPI_Type_commit PMPI_Type_contiguous PMPI_Type_create_darray PMPI_Type_create_hindexed PMPI_Type_create_hvector PMPI_Type_create_indexed_block PMPI_Type_create_keyval PMPI_Type_create_resized PMPI_Type_create_struct PMPI_Type_create_subarray PMPI_Type_delete_attr PMPI_Type_dup PMPI_Type_extent PMPI_Type_free PMPI_Type_free_keyval PMPI_Type_get_attr PMPI_Type_get_contents PMPI_Type_get_envelope PMPI_Type_get_extent PMPI_Type_get_name PMPI_Type_get_true_extent PMPI_Type_hindexed PMPI_Type_hvector PMPI_Type_indexed PMPI_Type_lb PMPI_Type_match_size PMPI_Type_set_attr PMPI_Type_set_name PMPI_Type_size PMPI_Type_struct PMPI_Type_ub PMPI_Type_vector PMPI_UNPACK PMPI_UNPACK_EXTERNAL PMPI_UNPUBLISH_NAME PMPI_Unpack PMPI_Unpack_external PMPI_Unpublish_name PMPI_WAIT PMPI_WAITALL PMPI_WAITANY PMPI_WAITSOME PMPI_WIN_CALL_ERRHANDLER PMPI_WIN_COMPLETE PMPI_WIN_CREATE PMPI_WIN_CREATE_ERRHANDLER PMPI_WIN_CREATE_KEYVAL PMPI_WIN_DELETE_ATTR PMPI_WIN_DUP_FN PMPI_WIN_FENCE PMPI_WIN_FREE PMPI_WIN_FREE_KEYVAL PMPI_WIN_GET_ATTR PMPI_WIN_GET_ERRHANDLER PMPI_WIN_GET_GROUP PMPI_WIN_GET_NAME PMPI_WIN_LOCK PMPI_WIN_NULL_COPY_FN PMPI_WIN_NULL_DELETE_FN PMPI_WIN_POST PMPI_WIN_SET_ATTR PMPI_WIN_SET_ERRHANDLER PMPI_WIN_SET_NAME PMPI_WIN_START PMPI_WIN_TEST PMPI_WIN_UNLOCK PMPI_WIN_WAIT PMPI_WTICK PMPI_WTIME PMPI_Wait PMPI_Waitall PMPI_Waitany PMPI_Waitsome PMPI_Win_call_errhandler PMPI_Win_complete PMPI_Win_create PMPI_Win_create_errhandler PMPI_Win_create_keyval PMPI_Win_delete_attr PMPI_Win_fence PMPI_Win_free PMPI_Win_free_keyval PMPI_Win_get_attr PMPI_Win_get_errhandler PMPI_Win_get_group PMPI_Win_get_name PMPI_Win_lock PMPI_Win_post PMPI_Win_set_attr PMPI_Win_set_errhandler PMPI_Win_set_name PMPI_Win_start PMPI_Win_test PMPI_Win_unlock PMPI_Win_wait PMPI_Wtick PMPI_Wtime PMSMPI_Get_bsend_overhead PMSMPI_Get_version _MPIPRIV1 DATA _MPIPRIV2 DATA _MPIPRIVC DATA _mpipriv1 DATA _mpipriv1_ DATA _mpipriv2 DATA _mpipriv2_ DATA _mpiprivc DATA _mpiprivc_ DATA mpi_abort mpi_abort_ mpi_accumulate mpi_accumulate_ mpi_add_error_class mpi_add_error_class_ mpi_add_error_code mpi_add_error_code_ mpi_add_error_string mpi_add_error_string_ mpi_address mpi_address_ mpi_allgather mpi_allgather_ mpi_allgatherv mpi_allgatherv_ mpi_alloc_mem mpi_alloc_mem_ mpi_allreduce mpi_allreduce_ mpi_alltoall mpi_alltoall_ mpi_alltoallv mpi_alltoallv_ mpi_alltoallw mpi_alltoallw_ mpi_attr_delete mpi_attr_delete_ mpi_attr_get mpi_attr_get_ mpi_attr_put mpi_attr_put_ mpi_barrier mpi_barrier_ mpi_bcast mpi_bcast_ mpi_bsend mpi_bsend_ mpi_bsend_init mpi_bsend_init_ mpi_buffer_attach mpi_buffer_attach_ mpi_buffer_detach mpi_buffer_detach_ mpi_cancel mpi_cancel_ mpi_cart_coords mpi_cart_coords_ mpi_cart_create mpi_cart_create_ mpi_cart_get mpi_cart_get_ mpi_cart_map mpi_cart_map_ mpi_cart_rank mpi_cart_rank_ mpi_cart_shift mpi_cart_shift_ mpi_cart_sub mpi_cart_sub_ mpi_cartdim_get mpi_cartdim_get_ mpi_close_port mpi_close_port_ mpi_comm_accept mpi_comm_accept_ mpi_comm_call_errhandler mpi_comm_call_errhandler_ mpi_comm_compare mpi_comm_compare_ mpi_comm_connect mpi_comm_connect_ mpi_comm_create mpi_comm_create_ mpi_comm_create_errhandler mpi_comm_create_errhandler_ mpi_comm_create_keyval mpi_comm_create_keyval_ mpi_comm_delete_attr mpi_comm_delete_attr_ mpi_comm_disconnect mpi_comm_disconnect_ mpi_comm_dup mpi_comm_dup_ mpi_comm_dup_fn mpi_comm_dup_fn_ mpi_comm_free mpi_comm_free_ mpi_comm_free_keyval mpi_comm_free_keyval_ mpi_comm_get_attr mpi_comm_get_attr_ mpi_comm_get_errhandler mpi_comm_get_errhandler_ mpi_comm_get_name mpi_comm_get_name_ mpi_comm_get_parent mpi_comm_get_parent_ mpi_comm_group mpi_comm_group_ mpi_comm_join mpi_comm_join_ mpi_comm_null_copy_fn mpi_comm_null_copy_fn_ mpi_comm_null_delete_fn mpi_comm_null_delete_fn_ mpi_comm_rank mpi_comm_rank_ mpi_comm_remote_group mpi_comm_remote_group_ mpi_comm_remote_size mpi_comm_remote_size_ mpi_comm_set_attr mpi_comm_set_attr_ mpi_comm_set_errhandler mpi_comm_set_errhandler_ mpi_comm_set_name mpi_comm_set_name_ mpi_comm_size mpi_comm_size_ mpi_comm_spawn mpi_comm_spawn_ mpi_comm_spawn_multiple mpi_comm_spawn_multiple_ mpi_comm_split mpi_comm_split_ mpi_comm_test_inter mpi_comm_test_inter_ mpi_conversion_fn_null mpi_conversion_fn_null_ mpi_dims_create mpi_dims_create_ mpi_dup_fn mpi_dup_fn_ mpi_errhandler_create mpi_errhandler_create_ mpi_errhandler_free mpi_errhandler_free_ mpi_errhandler_get mpi_errhandler_get_ mpi_errhandler_set mpi_errhandler_set_ mpi_error_class mpi_error_class_ mpi_error_string mpi_error_string_ mpi_exscan mpi_exscan_ mpi_file_call_errhandler mpi_file_call_errhandler_ mpi_file_close mpi_file_close_ mpi_file_create_errhandler mpi_file_create_errhandler_ mpi_file_delete mpi_file_delete_ mpi_file_get_amode mpi_file_get_amode_ mpi_file_get_atomicity mpi_file_get_atomicity_ mpi_file_get_byte_offset mpi_file_get_byte_offset_ mpi_file_get_errhandler mpi_file_get_errhandler_ mpi_file_get_group mpi_file_get_group_ mpi_file_get_info mpi_file_get_info_ mpi_file_get_position mpi_file_get_position_ mpi_file_get_position_shared mpi_file_get_position_shared_ mpi_file_get_size mpi_file_get_size_ mpi_file_get_type_extent mpi_file_get_type_extent_ mpi_file_get_view mpi_file_get_view_ mpi_file_iread mpi_file_iread_ mpi_file_iread_at mpi_file_iread_at_ mpi_file_iread_shared mpi_file_iread_shared_ mpi_file_iwrite mpi_file_iwrite_ mpi_file_iwrite_at mpi_file_iwrite_at_ mpi_file_iwrite_shared mpi_file_iwrite_shared_ mpi_file_open mpi_file_open_ mpi_file_preallocate mpi_file_preallocate_ mpi_file_read mpi_file_read_ mpi_file_read_all mpi_file_read_all_ mpi_file_read_all_begin mpi_file_read_all_begin_ mpi_file_read_all_end mpi_file_read_all_end_ mpi_file_read_at mpi_file_read_at_ mpi_file_read_at_all mpi_file_read_at_all_ mpi_file_read_at_all_begin mpi_file_read_at_all_begin_ mpi_file_read_at_all_end mpi_file_read_at_all_end_ mpi_file_read_ordered mpi_file_read_ordered_ mpi_file_read_ordered_begin mpi_file_read_ordered_begin_ mpi_file_read_ordered_end mpi_file_read_ordered_end_ mpi_file_read_shared mpi_file_read_shared_ mpi_file_seek mpi_file_seek_ mpi_file_seek_shared mpi_file_seek_shared_ mpi_file_set_atomicity mpi_file_set_atomicity_ mpi_file_set_errhandler mpi_file_set_errhandler_ mpi_file_set_info mpi_file_set_info_ mpi_file_set_size mpi_file_set_size_ mpi_file_set_view mpi_file_set_view_ mpi_file_sync mpi_file_sync_ mpi_file_write mpi_file_write_ mpi_file_write_all mpi_file_write_all_ mpi_file_write_all_begin mpi_file_write_all_begin_ mpi_file_write_all_end mpi_file_write_all_end_ mpi_file_write_at mpi_file_write_at_ mpi_file_write_at_all mpi_file_write_at_all_ mpi_file_write_at_all_begin mpi_file_write_at_all_begin_ mpi_file_write_at_all_end mpi_file_write_at_all_end_ mpi_file_write_ordered mpi_file_write_ordered_ mpi_file_write_ordered_begin mpi_file_write_ordered_begin_ mpi_file_write_ordered_end mpi_file_write_ordered_end_ mpi_file_write_shared mpi_file_write_shared_ mpi_finalize mpi_finalize_ mpi_finalized mpi_finalized_ mpi_free_mem mpi_free_mem_ mpi_gather mpi_gather_ mpi_gatherv mpi_gatherv_ mpi_get mpi_get_ mpi_get_address mpi_get_address_ mpi_get_count mpi_get_count_ mpi_get_elements mpi_get_elements_ mpi_get_processor_name mpi_get_processor_name_ mpi_get_version mpi_get_version_ mpi_graph_create mpi_graph_create_ mpi_graph_get mpi_graph_get_ mpi_graph_map mpi_graph_map_ mpi_graph_neighbors mpi_graph_neighbors_ mpi_graph_neighbors_count mpi_graph_neighbors_count_ mpi_graphdims_get mpi_graphdims_get_ mpi_grequest_complete mpi_grequest_complete_ mpi_grequest_start mpi_grequest_start_ mpi_group_compare mpi_group_compare_ mpi_group_difference mpi_group_difference_ mpi_group_excl mpi_group_excl_ mpi_group_free mpi_group_free_ mpi_group_incl mpi_group_incl_ mpi_group_intersection mpi_group_intersection_ mpi_group_range_excl mpi_group_range_excl_ mpi_group_range_incl mpi_group_range_incl_ mpi_group_rank mpi_group_rank_ mpi_group_size mpi_group_size_ mpi_group_translate_ranks mpi_group_translate_ranks_ mpi_group_union mpi_group_union_ mpi_ibsend mpi_ibsend_ mpi_info_create mpi_info_create_ mpi_info_delete mpi_info_delete_ mpi_info_dup mpi_info_dup_ mpi_info_free mpi_info_free_ mpi_info_get mpi_info_get_ mpi_info_get_nkeys mpi_info_get_nkeys_ mpi_info_get_nthkey mpi_info_get_nthkey_ mpi_info_get_valuelen mpi_info_get_valuelen_ mpi_info_set mpi_info_set_ mpi_init mpi_init_ mpi_init_thread mpi_init_thread_ mpi_initialized mpi_initialized_ mpi_intercomm_create mpi_intercomm_create_ mpi_intercomm_merge mpi_intercomm_merge_ mpi_iprobe mpi_iprobe_ mpi_irecv mpi_irecv_ mpi_irsend mpi_irsend_ mpi_is_thread_main mpi_is_thread_main_ mpi_isend mpi_isend_ mpi_issend mpi_issend_ mpi_keyval_create mpi_keyval_create_ mpi_keyval_free mpi_keyval_free_ mpi_lookup_name mpi_lookup_name_ mpi_null_copy_fn mpi_null_copy_fn_ mpi_null_delete_fn mpi_null_delete_fn_ mpi_op_create mpi_op_create_ mpi_op_free mpi_op_free_ mpi_open_port mpi_open_port_ mpi_pack mpi_pack_ mpi_pack_external mpi_pack_external_ mpi_pack_external_size mpi_pack_external_size_ mpi_pack_size mpi_pack_size_ mpi_pcontrol mpi_pcontrol_ mpi_probe mpi_probe_ mpi_publish_name mpi_publish_name_ mpi_put mpi_put_ mpi_query_thread mpi_query_thread_ mpi_recv mpi_recv_ mpi_recv_init mpi_recv_init_ mpi_reduce mpi_reduce_ mpi_reduce_scatter mpi_reduce_scatter_ mpi_register_datarep mpi_register_datarep_ mpi_request_free mpi_request_free_ mpi_request_get_status mpi_request_get_status_ mpi_rsend mpi_rsend_ mpi_rsend_init mpi_rsend_init_ mpi_scan mpi_scan_ mpi_scatter mpi_scatter_ mpi_scatterv mpi_scatterv_ mpi_send mpi_send_ mpi_send_init mpi_send_init_ mpi_sendrecv mpi_sendrecv_ mpi_sendrecv_replace mpi_sendrecv_replace_ mpi_ssend mpi_ssend_ mpi_ssend_init mpi_ssend_init_ mpi_start mpi_start_ mpi_startall mpi_startall_ mpi_status_set_cancelled mpi_status_set_cancelled_ mpi_status_set_elements mpi_status_set_elements_ mpi_test mpi_test_ mpi_test_cancelled mpi_test_cancelled_ mpi_testall mpi_testall_ mpi_testany mpi_testany_ mpi_testsome mpi_testsome_ mpi_topo_test mpi_topo_test_ mpi_type_commit mpi_type_commit_ mpi_type_contiguous mpi_type_contiguous_ mpi_type_create_darray mpi_type_create_darray_ mpi_type_create_hindexed mpi_type_create_hindexed_ mpi_type_create_hvector mpi_type_create_hvector_ mpi_type_create_indexed_block mpi_type_create_indexed_block_ mpi_type_create_keyval mpi_type_create_keyval_ mpi_type_create_resized mpi_type_create_resized_ mpi_type_create_struct mpi_type_create_struct_ mpi_type_create_subarray mpi_type_create_subarray_ mpi_type_delete_attr mpi_type_delete_attr_ mpi_type_dup mpi_type_dup_ mpi_type_dup_fn mpi_type_dup_fn_ mpi_type_extent mpi_type_extent_ mpi_type_free mpi_type_free_ mpi_type_free_keyval mpi_type_free_keyval_ mpi_type_get_attr mpi_type_get_attr_ mpi_type_get_contents mpi_type_get_contents_ mpi_type_get_envelope mpi_type_get_envelope_ mpi_type_get_extent mpi_type_get_extent_ mpi_type_get_name mpi_type_get_name_ mpi_type_get_true_extent mpi_type_get_true_extent_ mpi_type_hindexed mpi_type_hindexed_ mpi_type_hvector mpi_type_hvector_ mpi_type_indexed mpi_type_indexed_ mpi_type_lb mpi_type_lb_ mpi_type_match_size mpi_type_match_size_ mpi_type_null_copy_fn mpi_type_null_copy_fn_ mpi_type_null_delete_fn mpi_type_null_delete_fn_ mpi_type_set_attr mpi_type_set_attr_ mpi_type_set_name mpi_type_set_name_ mpi_type_size mpi_type_size_ mpi_type_struct mpi_type_struct_ mpi_type_ub mpi_type_ub_ mpi_type_vector mpi_type_vector_ mpi_unpack mpi_unpack_ mpi_unpack_external mpi_unpack_external_ mpi_unpublish_name mpi_unpublish_name_ mpi_wait mpi_wait_ mpi_waitall mpi_waitall_ mpi_waitany mpi_waitany_ mpi_waitsome mpi_waitsome_ mpi_win_call_errhandler mpi_win_call_errhandler_ mpi_win_complete mpi_win_complete_ mpi_win_create mpi_win_create_ mpi_win_create_errhandler mpi_win_create_errhandler_ mpi_win_create_keyval mpi_win_create_keyval_ mpi_win_delete_attr mpi_win_delete_attr_ mpi_win_dup_fn mpi_win_dup_fn_ mpi_win_fence mpi_win_fence_ mpi_win_free mpi_win_free_ mpi_win_free_keyval mpi_win_free_keyval_ mpi_win_get_attr mpi_win_get_attr_ mpi_win_get_errhandler mpi_win_get_errhandler_ mpi_win_get_group mpi_win_get_group_ mpi_win_get_name mpi_win_get_name_ mpi_win_lock mpi_win_lock_ mpi_win_null_copy_fn mpi_win_null_copy_fn_ mpi_win_null_delete_fn mpi_win_null_delete_fn_ mpi_win_post mpi_win_post_ mpi_win_set_attr mpi_win_set_attr_ mpi_win_set_errhandler mpi_win_set_errhandler_ mpi_win_set_name mpi_win_set_name_ mpi_win_start mpi_win_start_ mpi_win_test mpi_win_test_ mpi_win_unlock mpi_win_unlock_ mpi_win_wait mpi_win_wait_ mpi_wtick mpi_wtick_ mpi_wtime mpi_wtime_ mpipriv1 DATA mpipriv1_ DATA mpipriv2 DATA mpipriv2_ DATA mpiprivc DATA mpiprivc_ DATA pmpi_abort pmpi_abort_ pmpi_accumulate pmpi_accumulate_ pmpi_add_error_class pmpi_add_error_class_ pmpi_add_error_code pmpi_add_error_code_ pmpi_add_error_string pmpi_add_error_string_ pmpi_address pmpi_address_ pmpi_allgather pmpi_allgather_ pmpi_allgatherv pmpi_allgatherv_ pmpi_alloc_mem pmpi_alloc_mem_ pmpi_allreduce pmpi_allreduce_ pmpi_alltoall pmpi_alltoall_ pmpi_alltoallv pmpi_alltoallv_ pmpi_alltoallw pmpi_alltoallw_ pmpi_attr_delete pmpi_attr_delete_ pmpi_attr_get pmpi_attr_get_ pmpi_attr_put pmpi_attr_put_ pmpi_barrier pmpi_barrier_ pmpi_bcast pmpi_bcast_ pmpi_bsend pmpi_bsend_ pmpi_bsend_init pmpi_bsend_init_ pmpi_buffer_attach pmpi_buffer_attach_ pmpi_buffer_detach pmpi_buffer_detach_ pmpi_cancel pmpi_cancel_ pmpi_cart_coords pmpi_cart_coords_ pmpi_cart_create pmpi_cart_create_ pmpi_cart_get pmpi_cart_get_ pmpi_cart_map pmpi_cart_map_ pmpi_cart_rank pmpi_cart_rank_ pmpi_cart_shift pmpi_cart_shift_ pmpi_cart_sub pmpi_cart_sub_ pmpi_cartdim_get pmpi_cartdim_get_ pmpi_close_port pmpi_close_port_ pmpi_comm_accept pmpi_comm_accept_ pmpi_comm_call_errhandler pmpi_comm_call_errhandler_ pmpi_comm_compare pmpi_comm_compare_ pmpi_comm_connect pmpi_comm_connect_ pmpi_comm_create pmpi_comm_create_ pmpi_comm_create_errhandler pmpi_comm_create_errhandler_ pmpi_comm_create_keyval pmpi_comm_create_keyval_ pmpi_comm_delete_attr pmpi_comm_delete_attr_ pmpi_comm_disconnect pmpi_comm_disconnect_ pmpi_comm_dup pmpi_comm_dup_ pmpi_comm_dup_fn pmpi_comm_dup_fn_ pmpi_comm_free pmpi_comm_free_ pmpi_comm_free_keyval pmpi_comm_free_keyval_ pmpi_comm_get_attr pmpi_comm_get_attr_ pmpi_comm_get_errhandler pmpi_comm_get_errhandler_ pmpi_comm_get_name pmpi_comm_get_name_ pmpi_comm_get_parent pmpi_comm_get_parent_ pmpi_comm_group pmpi_comm_group_ pmpi_comm_join pmpi_comm_join_ pmpi_comm_null_copy_fn pmpi_comm_null_copy_fn_ pmpi_comm_null_delete_fn pmpi_comm_null_delete_fn_ pmpi_comm_rank pmpi_comm_rank_ pmpi_comm_remote_group pmpi_comm_remote_group_ pmpi_comm_remote_size pmpi_comm_remote_size_ pmpi_comm_set_attr pmpi_comm_set_attr_ pmpi_comm_set_errhandler pmpi_comm_set_errhandler_ pmpi_comm_set_name pmpi_comm_set_name_ pmpi_comm_size pmpi_comm_size_ pmpi_comm_spawn pmpi_comm_spawn_ pmpi_comm_spawn_multiple pmpi_comm_spawn_multiple_ pmpi_comm_split pmpi_comm_split_ pmpi_comm_test_inter pmpi_comm_test_inter_ pmpi_dims_create pmpi_dims_create_ pmpi_dup_fn pmpi_dup_fn_ pmpi_errhandler_create pmpi_errhandler_create_ pmpi_errhandler_free pmpi_errhandler_free_ pmpi_errhandler_get pmpi_errhandler_get_ pmpi_errhandler_set pmpi_errhandler_set_ pmpi_error_class pmpi_error_class_ pmpi_error_string pmpi_error_string_ pmpi_exscan pmpi_exscan_ pmpi_file_call_errhandler pmpi_file_call_errhandler_ pmpi_file_close pmpi_file_close_ pmpi_file_create_errhandler pmpi_file_create_errhandler_ pmpi_file_delete pmpi_file_delete_ pmpi_file_get_amode pmpi_file_get_amode_ pmpi_file_get_atomicity pmpi_file_get_atomicity_ pmpi_file_get_byte_offset pmpi_file_get_byte_offset_ pmpi_file_get_errhandler pmpi_file_get_errhandler_ pmpi_file_get_group pmpi_file_get_group_ pmpi_file_get_info pmpi_file_get_info_ pmpi_file_get_position pmpi_file_get_position_ pmpi_file_get_position_shared pmpi_file_get_position_shared_ pmpi_file_get_size pmpi_file_get_size_ pmpi_file_get_type_extent pmpi_file_get_type_extent_ pmpi_file_get_view pmpi_file_get_view_ pmpi_file_iread pmpi_file_iread_ pmpi_file_iread_at pmpi_file_iread_at_ pmpi_file_iread_shared pmpi_file_iread_shared_ pmpi_file_iwrite pmpi_file_iwrite_ pmpi_file_iwrite_at pmpi_file_iwrite_at_ pmpi_file_iwrite_shared pmpi_file_iwrite_shared_ pmpi_file_open pmpi_file_open_ pmpi_file_preallocate pmpi_file_preallocate_ pmpi_file_read pmpi_file_read_ pmpi_file_read_all pmpi_file_read_all_ pmpi_file_read_all_begin pmpi_file_read_all_begin_ pmpi_file_read_all_end pmpi_file_read_all_end_ pmpi_file_read_at pmpi_file_read_at_ pmpi_file_read_at_all pmpi_file_read_at_all_ pmpi_file_read_at_all_begin pmpi_file_read_at_all_begin_ pmpi_file_read_at_all_end pmpi_file_read_at_all_end_ pmpi_file_read_ordered pmpi_file_read_ordered_ pmpi_file_read_ordered_begin pmpi_file_read_ordered_begin_ pmpi_file_read_ordered_end pmpi_file_read_ordered_end_ pmpi_file_read_shared pmpi_file_read_shared_ pmpi_file_seek pmpi_file_seek_ pmpi_file_seek_shared pmpi_file_seek_shared_ pmpi_file_set_atomicity pmpi_file_set_atomicity_ pmpi_file_set_errhandler pmpi_file_set_errhandler_ pmpi_file_set_info pmpi_file_set_info_ pmpi_file_set_size pmpi_file_set_size_ pmpi_file_set_view pmpi_file_set_view_ pmpi_file_sync pmpi_file_sync_ pmpi_file_write pmpi_file_write_ pmpi_file_write_all pmpi_file_write_all_ pmpi_file_write_all_begin pmpi_file_write_all_begin_ pmpi_file_write_all_end pmpi_file_write_all_end_ pmpi_file_write_at pmpi_file_write_at_ pmpi_file_write_at_all pmpi_file_write_at_all_ pmpi_file_write_at_all_begin pmpi_file_write_at_all_begin_ pmpi_file_write_at_all_end pmpi_file_write_at_all_end_ pmpi_file_write_ordered pmpi_file_write_ordered_ pmpi_file_write_ordered_begin pmpi_file_write_ordered_begin_ pmpi_file_write_ordered_end pmpi_file_write_ordered_end_ pmpi_file_write_shared pmpi_file_write_shared_ pmpi_finalize pmpi_finalize_ pmpi_finalized pmpi_finalized_ pmpi_free_mem pmpi_free_mem_ pmpi_gather pmpi_gather_ pmpi_gatherv pmpi_gatherv_ pmpi_get pmpi_get_ pmpi_get_address pmpi_get_address_ pmpi_get_count pmpi_get_count_ pmpi_get_elements pmpi_get_elements_ pmpi_get_processor_name pmpi_get_processor_name_ pmpi_get_version pmpi_get_version_ pmpi_graph_create pmpi_graph_create_ pmpi_graph_get pmpi_graph_get_ pmpi_graph_map pmpi_graph_map_ pmpi_graph_neighbors pmpi_graph_neighbors_ pmpi_graph_neighbors_count pmpi_graph_neighbors_count_ pmpi_graphdims_get pmpi_graphdims_get_ pmpi_grequest_complete pmpi_grequest_complete_ pmpi_grequest_start pmpi_grequest_start_ pmpi_group_compare pmpi_group_compare_ pmpi_group_difference pmpi_group_difference_ pmpi_group_excl pmpi_group_excl_ pmpi_group_free pmpi_group_free_ pmpi_group_incl pmpi_group_incl_ pmpi_group_intersection pmpi_group_intersection_ pmpi_group_range_excl pmpi_group_range_excl_ pmpi_group_range_incl pmpi_group_range_incl_ pmpi_group_rank pmpi_group_rank_ pmpi_group_size pmpi_group_size_ pmpi_group_translate_ranks pmpi_group_translate_ranks_ pmpi_group_union pmpi_group_union_ pmpi_ibsend pmpi_ibsend_ pmpi_info_create pmpi_info_create_ pmpi_info_delete pmpi_info_delete_ pmpi_info_dup pmpi_info_dup_ pmpi_info_free pmpi_info_free_ pmpi_info_get pmpi_info_get_ pmpi_info_get_nkeys pmpi_info_get_nkeys_ pmpi_info_get_nthkey pmpi_info_get_nthkey_ pmpi_info_get_valuelen pmpi_info_get_valuelen_ pmpi_info_set pmpi_info_set_ pmpi_init pmpi_init_ pmpi_init_thread pmpi_init_thread_ pmpi_initialized pmpi_initialized_ pmpi_intercomm_create pmpi_intercomm_create_ pmpi_intercomm_merge pmpi_intercomm_merge_ pmpi_iprobe pmpi_iprobe_ pmpi_irecv pmpi_irecv_ pmpi_irsend pmpi_irsend_ pmpi_is_thread_main pmpi_is_thread_main_ pmpi_isend pmpi_isend_ pmpi_issend pmpi_issend_ pmpi_keyval_create pmpi_keyval_create_ pmpi_keyval_free pmpi_keyval_free_ pmpi_lookup_name pmpi_lookup_name_ pmpi_null_copy_fn pmpi_null_copy_fn_ pmpi_null_delete_fn pmpi_null_delete_fn_ pmpi_op_create pmpi_op_create_ pmpi_op_free pmpi_op_free_ pmpi_open_port pmpi_open_port_ pmpi_pack pmpi_pack_ pmpi_pack_external pmpi_pack_external_ pmpi_pack_external_size pmpi_pack_external_size_ pmpi_pack_size pmpi_pack_size_ pmpi_pcontrol pmpi_pcontrol_ pmpi_probe pmpi_probe_ pmpi_publish_name pmpi_publish_name_ pmpi_put pmpi_put_ pmpi_query_thread pmpi_query_thread_ pmpi_recv pmpi_recv_ pmpi_recv_init pmpi_recv_init_ pmpi_reduce pmpi_reduce_ pmpi_reduce_scatter pmpi_reduce_scatter_ pmpi_register_datarep pmpi_register_datarep_ pmpi_request_free pmpi_request_free_ pmpi_request_get_status pmpi_request_get_status_ pmpi_rsend pmpi_rsend_ pmpi_rsend_init pmpi_rsend_init_ pmpi_scan pmpi_scan_ pmpi_scatter pmpi_scatter_ pmpi_scatterv pmpi_scatterv_ pmpi_send pmpi_send_ pmpi_send_init pmpi_send_init_ pmpi_sendrecv pmpi_sendrecv_ pmpi_sendrecv_replace pmpi_sendrecv_replace_ pmpi_ssend pmpi_ssend_ pmpi_ssend_init pmpi_ssend_init_ pmpi_start pmpi_start_ pmpi_startall pmpi_startall_ pmpi_status_set_cancelled pmpi_status_set_cancelled_ pmpi_status_set_elements pmpi_status_set_elements_ pmpi_test pmpi_test_ pmpi_test_cancelled pmpi_test_cancelled_ pmpi_testall pmpi_testall_ pmpi_testany pmpi_testany_ pmpi_testsome pmpi_testsome_ pmpi_topo_test pmpi_topo_test_ pmpi_type_commit pmpi_type_commit_ pmpi_type_contiguous pmpi_type_contiguous_ pmpi_type_create_darray pmpi_type_create_darray_ pmpi_type_create_hindexed pmpi_type_create_hindexed_ pmpi_type_create_hvector pmpi_type_create_hvector_ pmpi_type_create_indexed_block pmpi_type_create_indexed_block_ pmpi_type_create_keyval pmpi_type_create_keyval_ pmpi_type_create_resized pmpi_type_create_resized_ pmpi_type_create_struct pmpi_type_create_struct_ pmpi_type_create_subarray pmpi_type_create_subarray_ pmpi_type_delete_attr pmpi_type_delete_attr_ pmpi_type_dup pmpi_type_dup_ pmpi_type_dup_fn pmpi_type_dup_fn_ pmpi_type_extent pmpi_type_extent_ pmpi_type_free pmpi_type_free_ pmpi_type_free_keyval pmpi_type_free_keyval_ pmpi_type_get_attr pmpi_type_get_attr_ pmpi_type_get_contents pmpi_type_get_contents_ pmpi_type_get_envelope pmpi_type_get_envelope_ pmpi_type_get_extent pmpi_type_get_extent_ pmpi_type_get_name pmpi_type_get_name_ pmpi_type_get_true_extent pmpi_type_get_true_extent_ pmpi_type_hindexed pmpi_type_hindexed_ pmpi_type_hvector pmpi_type_hvector_ pmpi_type_indexed pmpi_type_indexed_ pmpi_type_lb pmpi_type_lb_ pmpi_type_match_size pmpi_type_match_size_ pmpi_type_null_copy_fn pmpi_type_null_copy_fn_ pmpi_type_null_delete_fn pmpi_type_null_delete_fn_ pmpi_type_set_attr pmpi_type_set_attr_ pmpi_type_set_name pmpi_type_set_name_ pmpi_type_size pmpi_type_size_ pmpi_type_struct pmpi_type_struct_ pmpi_type_ub pmpi_type_ub_ pmpi_type_vector pmpi_type_vector_ pmpi_unpack pmpi_unpack_ pmpi_unpack_external pmpi_unpack_external_ pmpi_unpublish_name pmpi_unpublish_name_ pmpi_wait pmpi_wait_ pmpi_waitall pmpi_waitall_ pmpi_waitany pmpi_waitany_ pmpi_waitsome pmpi_waitsome_ pmpi_win_call_errhandler pmpi_win_call_errhandler_ pmpi_win_complete pmpi_win_complete_ pmpi_win_create pmpi_win_create_ pmpi_win_create_errhandler pmpi_win_create_errhandler_ pmpi_win_create_keyval pmpi_win_create_keyval_ pmpi_win_delete_attr pmpi_win_delete_attr_ pmpi_win_dup_fn pmpi_win_dup_fn_ pmpi_win_fence pmpi_win_fence_ pmpi_win_free pmpi_win_free_ pmpi_win_free_keyval pmpi_win_free_keyval_ pmpi_win_get_attr pmpi_win_get_attr_ pmpi_win_get_errhandler pmpi_win_get_errhandler_ pmpi_win_get_group pmpi_win_get_group_ pmpi_win_get_name pmpi_win_get_name_ pmpi_win_lock pmpi_win_lock_ pmpi_win_null_copy_fn pmpi_win_null_copy_fn_ pmpi_win_null_delete_fn pmpi_win_null_delete_fn_ pmpi_win_post pmpi_win_post_ pmpi_win_set_attr pmpi_win_set_attr_ pmpi_win_set_errhandler pmpi_win_set_errhandler_ pmpi_win_set_name pmpi_win_set_name_ pmpi_win_start pmpi_win_start_ pmpi_win_test pmpi_win_test_ pmpi_win_unlock pmpi_win_unlock_ pmpi_win_wait pmpi_win_wait_ pmpi_wtick pmpi_wtick_ pmpi_wtime pmpi_wtime_ Rmpi/src/Makevars.win0000644000176000001440000000070612335423133014272 0ustar ripleyusers# -*- Makefile -*- vim : ft = make ifeq "$(MPI_HOME)" "" MPI_HOME = c:/Program Files/Microsoft MPI endif PKG_CPPFLAGS = -I"$(MPI_HOME)/Inc" -DMPI2 -DWin32 all: $(SHLIB) ifeq "$(WIN)" "64" PKG_LIBS = -L. -lmsmpi64 $(SHLIB): libmsmpi64.a else PKG_LIBS = "$(MPI_HOME)/Lib/i386/msmpi.lib" endif ##msmpi.def: ## gendef -r c:/Windows/System32/msmpi.dll libmsmpi64.a: msmpi.def $(DLLTOOL) -k -d msmpi.def -l libmsmpi64.a -D msmpi.dll $(DT_ARCH) Rmpi/NAMESPACE0000644000176000001440000000017112010237761012426 0ustar ripleyusers# Default NAMESPACE created by R # Remove the previous line if you edit this file # Export all names exportPattern(".") Rmpi/demo/0000755000176000001440000000000012006262731012134 5ustar ripleyusersRmpi/demo/masterslavePI.R0000644000176000001440000000146010677112670015047 0ustar ripleyuserslibrary(Rmpi) mpi.comm.get.parent(2) if (!mpi.comm.is.null(2)) mpi.intercomm.merge(2,1,1) #master job master <- function(){ if (mpi.comm.size(1) > 0) stop("There are some slaves running on comm 1") slave<-system.file("Rslaves.sh",package="Rmpi") Rscript <- system.file("demo","masterslavePI.R",package="Rmpi") tmp <- paste(Sys.getpid(), "+", 1, sep="") arg <- c(Rscript, tmp, "nolog", R.home()) mpi.comm.spawn(slave=slave,slavearg=arg ) mpi.intercomm.merge(2,0,1) out <- mpi.reduce(0) mpi.comm.free() out } #slave jobs slave <- function(n){ totalcpu <- mpi.comm.size(0) id <- mpi.comm.rank(0)+1 mypi <- 4*sum(1/(1+((seq(id,n,totalcpu)-.5)/n)^2))/n mpi.reduce(mypi) mpi.comm.free() mpi.exit() } #real code n<- 10000 if (mpi.is.master()){ master() } else { slave(n) } Rmpi/demo/slave1PI.R0000644000176000001440000000412107465752207013720 0ustar ripleyusersslave1 <- function (){ n <- mpi.bcast(integer(1),1,comm=.comm) request <-1 job <-2 anysrc <- mpi.any.source() anytag <- mpi.any.tag() id <- mpi.comm.rank(.comm) tsize <- mpi.comm.size(.comm) if (id == tsize-1){ #the server that collects results mypi <- 0 done <- 0 while (done < tsize-2){ mypi <- mpi.recv(double(1), type=2, source=anysrc, tag=anytag,comm=.comm)+mypi tag <- mpi.get.sourcetag()[2] done <- done+(tag==0) } #send the final result to master mpi.send(mypi,2,dest=0,tag=3,comm=.comm) } else { # the workers that do the real jobs while (1) { #send master a request mpi.send(integer(1),type=1,dest=0,tag=request,comm=.comm) jobrange<-mpi.recv(integer(2),type=1,source=0, tag=anytag,comm=.comm) tag <- mpi.get.sourcetag()[2] if (tag==job){ mypi <- 4*sum(1/(1+((seq(jobrange[1],jobrange[2])-.5)/n)^2))/n mpi.send(mypi, 2, dest=tsize-1, tag=job,comm=.comm) } else { #tag=0 means stop mpi.send(0, 2, dest=tsize-1, tag=0,comm=.comm) break } } } } master1PI <- function (n,maxjoblen,comm=1) { tsize <- mpi.comm.size(comm) if (tsize <3) stop("Need at least 2 slaves") #send the function slave1 to all slaves mpi.bcast.Robj2slave(slave1, comm=comm) #let slave run the function slave1 mpi.bcast.cmd(slave1(), comm=comm) #send n to all slaves mpi.bcast(as.integer(n),type=1,comm=comm) count <- 0 request <- 1 job <- 2 anysrc <- mpi.any.source() while (count < n){ mpi.recv(integer(1), type=1, source=anysrc, tag=request, comm=comm) src <- mpi.get.sourcetag()[1] jobrange <- c(count+1, min(count+maxjoblen, n)) mpi.send(as.integer(jobrange),type=1,dest=src,tag=job,comm=comm) count <- count+maxjoblen } #tell workers to stop with tag=0 for (i in 1:(tsize-2)){ mpi.recv(integer(1),type=1,source=anysrc,tag=request,comm=comm) src <- mpi.get.sourcetag()[1] mpi.send(integer(1),type=1,dest=src,tag=0,comm=comm) } mpi.recv(double(1), type=2, source=tsize-1, tag=3, comm=comm) } Rmpi/demo/simPI.R0000644000176000001440000000451612010345650013303 0ustar ripleyusers simslave <- function (){ request <-1 result <-2 chunksize <- 1000 #job size for slaves anytag <- mpi.any.tag() while (1) { #slaves do their jobs first and waiting instructions from master x <- runif(chunksize) y <- runif(chunksize) incirvec <- (x-.5)^2 + (y-.5)^2 < .25 xy <- c(x[incirvec],y[incirvec]) #send the result to master mpi.send(xy, 2, dest=0, tag=result,comm=.comm) #receive instructions from master mpi.recv(integer(1),type=1,source=0,tag=anytag,comm=.comm) tag <- mpi.get.sourcetag()[2] if (tag!=request) break } } simPI <- function (n,epsilon=1e-4,comm=1) { tsize <- mpi.comm.size(comm) if (tsize < 2) stop("It seems no slaves running") #send the function simslave to all slaves mpi.bcast.Robj2slave(simslave, comm=comm) #let slaves run the function simslave mpi.bcast.cmd(simslave(), comm=comm) chunksize <- 1000 request <-1 result <- 2 count <- 0 totalincir <- 0 anysrc <- mpi.any.source() #prepare an empty plot plot(c(0,0),xlim=c(0,1),ylim=c(0,1), ylab="",type="n") while (1) { #receive done job from slaves xy<-mpi.recv(double(2*chunksize),type=2,source=anysrc, tag=result,comm=comm) #receive buffer is biger than actual data. So need to get real length incir <-mpi.get.count(2)/2 src <- mpi.get.sourcetag()[1] totalincir <- incir + totalincir count <- count+chunksize mypi <- 4*totalincir/count x <- xy[1:incir] y<- xy[(incir+1):(2*incir)] #add incircle points to the plot points(x,y,pch=".",cex=.2,col=src) err <- abs(mypi-pi) if (err > epsilon && count < n) mpi.send(integer(1),type=1,dest=src,tag=request,comm=comm) else { #tell slaves to stop with tag=0 mpi.send(integer(1),type=1,dest=src,tag=0,comm=comm) break } } #only one slave is stopped. So have to others to stop as well if (tsize > 2){ for (i in 1:(tsize-2)){ #continue receiving other slaves jobs xy<-mpi.recv(double(2*chunksize),type=2,source=anysrc, tag=result,comm=comm) incir <-mpi.get.count(2)/2 src <- mpi.get.sourcetag()[1] totalincir <- incir + totalincir count <- count+chunksize mypi <- 4*totalincir/count x <- xy[1:incir] y<- xy[(incir+1):(2*incir)] points(x,y,pch=".",cex=.2,col=src) #tell other slaves to stop mpi.send(integer(1),type=1,dest=src,tag=0,comm=comm) } } mypi } Rmpi/demo/00Index0000644000176000001440000000133112010345743013264 0ustar ripleyuserscslavePI R function to use external C program cslavePI. Copy cslavePI.c in Rmpi library directory to your working directory and compile as "mpicc -o cslavePI cslavePI.c" masterslavePI R script to compute PI=4*\int_0^1 1/(1+x^2) dx. simPI Use Monto Carlo simulation to compute PI (with plot). Use simPI to run the program. Run mpi.setup.rngstream to setup a parallel RNG. simplePI R function to compute PI using slavedaemon.R. slave1PI R functions to compute PI using slavedaemon.R (load balancing with a server and workers). Use master1PI to run the program. slave2PI R functions to compute PI using slavedaemon.R (load balancing with workers only). Use master2PI to run the program. Rmpi/demo/cslavePI.R0000644000176000001440000000041607475755403014007 0ustar ripleyuserscslavePI <- function (n) { if (mpi.comm.size(1) > 1) stop ("It seems some slaves running on comm 1.") mpi.comm.spawn("cslavePI") mpi.intercomm.merge(2,0,1) mpi.bcast(as.integer(n),1) out <-mpi.reduce(0) mpi.comm.free() out } Rmpi/demo/slave2PI.R0000644000176000001440000000274407475755336013741 0ustar ripleyusersslave2 <- function (){ n <- mpi.bcast(integer(1),type=1,rank=0,comm=.comm) request <-1 job <-2 anytag <- mpi.any.tag() mypi <- 0 while (1) { #send master a request mpi.send(integer(1),type=1,dest=0,tag=request,comm=.comm) jobrange<-mpi.recv(integer(2),type=1,source=0,tag=anytag,comm=.comm) tag <- mpi.get.sourcetag()[2] if (tag==job) mypi <- 4*sum(1/(1+((seq(jobrange[1],jobrange[2])-.5)/n)^2))/n +mypi else break #tag=0 means stop } mpi.reduce(mypi,comm=.comm) } master2PI <- function (n,maxjoblen,comm=1) { tsize <- mpi.comm.size(comm) if (tsize < 2) stop("Need at least 1 slave") #send the function slave2 to all slaves mpi.bcast.Robj2slave(slave2, comm=comm) #let slave run the function slave2 mpi.bcast.cmd(slave2(), comm=comm) #send n to all slaves mpi.bcast(as.integer(n),type=1,comm=comm) count <- 0 request <- 1 job <- 2 anysrc <- mpi.any.source() while (count < n){ mpi.recv(integer(1), type=1, source=anysrc, tag=request, comm=comm) src <- mpi.get.sourcetag()[1] jobrange <- c(count+1, min(count+maxjoblen, n)) mpi.send(as.integer(jobrange),type=1,dest=src,tag=job,comm=comm) count <- count+maxjoblen } #tell workers to stop with tag=0 for (i in 1:(tsize-1)){ mpi.recv(integer(1),type=1,source=anysrc,tag=request,comm=comm) src <- mpi.get.sourcetag()[1] mpi.send(integer(1),type=1,dest=src,tag=0,comm=comm) } mpi.reduce(0, comm=comm) } Rmpi/demo/simplePI.R0000644000176000001440000000131207465752122014011 0ustar ripleyuserssimple.pi <- function (n, comm=1) { #let slaves ready receive n mpi.bcast.cmd(n <- mpi.bcast(integer(1), type=1, comm=.comm), comm=comm) #send n to all slaves mpi.bcast(as.integer(n), type=1, comm=comm) #let each slave find its own id(rank) and total number of slaves mpi.bcast.cmd(id <- mpi.comm.rank(.comm), comm=comm) mpi.bcast.cmd(nslaves <- mpi.comm.size(.comm)-1, comm=comm) #let each slave compute corresponding PI value mpi.bcast.cmd(mypi <- 4*sum(1/(1+((seq(id,n,nslaves)-.5)/n)^2))/n, comm=comm) #send computed values to master and sum together mpi.bcast.cmd(mpi.reduce(mypi,comm=.comm), comm=comm) #master must sum together as well so it adds 0 to it mpi.reduce(0,comm=comm) } Rmpi/R/0000755000176000001440000000000012336655704011425 5ustar ripleyusersRmpi/R/Rparutilities.R0000644000176000001440000010475712334733277014426 0ustar ripleyusers### Copyright (C) 2002 Hao Yu mpi.hostinfo <- function(comm=1){ if (mpi.comm.size(comm)==0){ err <-paste("It seems no members running on comm", comm) stop(err) } hostname <- mpi.get.processor.name() rk <- mpi.comm.rank(comm=comm) size <- mpi.comm.size(comm=comm) cat("\tHost:",hostname,"\tRank(ID):",rk, "\tof Size:", size, "on comm", comm, "\n") } slave.hostinfo <- function(comm=1, short=TRUE){ #if (!mpi.is.master()) if (mpi.comm.rank(comm)!=0) stop("cannot run slavehostinfo on slaves") size <- mpi.comm.size(comm) if (size==0){ err <-paste("It seems no slaves running on comm", comm) stop(err) } if (size == 1) mpi.hostinfo(comm) else { master <-mpi.get.processor.name() slavehost <- unlist(mpi.remote.exec(mpi.get.processor.name(),comm=comm)) slavecomm <- 1 #as.integer(mpi.remote.exec(.comm,comm=comm)) ranks <- 1:(size-1) commm <- paste(comm, ")",sep="") if (size > 10){ rank0 <- paste("master (rank 0 , comm", commm) ranks <- c(paste(ranks[1:9]," ",sep=""), ranks[10:(size-1)]) } else rank0 <- paste("master (rank 0, comm", commm) cat(rank0, "of size", size, "is running on:",master, "\n") slavename <- paste("slave", ranks,sep="") ranks <- paste("(rank ",ranks, ", comm ",slavecomm,")", sep="") if (short && size > 8){ for (i in 1:3) { cat(slavename[i], ranks[i], "of size",size, "is running on:",slavehost[i], "\n") } cat("... ... ...\n") for (i in (size-2):(size-1)){ cat(slavename[i], ranks[i], "of size",size, "is running on:",slavehost[i], "\n") } } else { for (i in 1:(size-1)){ cat(slavename[i], ranks[i], "of size",size, "is running on:",slavehost[i], "\n") } } } } lamhosts <- function(){ hosts <- system("lamnodes C -c -n", TRUE) base <-character(0) for (host in hosts) base <- c(base, unlist(strsplit(host, "\\."))[1]) nn <- 0:(length(hosts)-1) names(nn) <- base nn } mpi.spawn.Rslaves <- function(Rscript=system.file("slavedaemon.R", package="Rmpi"), nslaves=mpi.universe.size(), root=0, intercomm=2, comm=1, hosts=NULL, needlog=TRUE, mapdrive=TRUE, quiet=FALSE, nonblock=TRUE, sleep=0.1) { if (!is.loaded("mpi_comm_spawn")) stop("You cannot use MPI_Comm_spawn API") if (mpi.comm.size(comm) > 0){ err <-paste("It seems there are some slaves running on comm ", comm) stop(err) } if (.Platform$OS=="windows"){ stop("Spawning is not implemented. Please use mpiexec with Rprofile.") workdrive <- unlist(strsplit(getwd(),":"))[1] workdir <- unlist(strsplit(getwd(),"/")) if (length(workdir) > 1) workdir <-paste(workdir, collapse="\\") else workdir <- paste(workdir,"\\") localhost <- Sys.getenv("COMPUTERNAME") networkdrive <-NULL #.Call("RegQuery", as.integer(2),paste("NETWORK\\",workdrive,sep=""), #PACKAGE="Rmpi") remotepath <-networkdrive[which(networkdrive=="RemotePath")+1] mapdrive <- as.logical(mapdrive && !is.null(remotepath)) arg <- c(Rscript, R.home(), workdrive, workdir, localhost, mapdrive, remotepath) if (.Platform$r_arch == "i386") realns <- mpi.comm.spawn(slave = system.file("Rslaves32.cmd", package = "Rmpi"), slavearg = arg, nslaves = nslaves, info = 0, root = root, intercomm = intercomm, quiet = quiet) else realns <- mpi.comm.spawn(slave = system.file("Rslaves64.cmd", package = "Rmpi"), slavearg = arg, nslaves = nslaves, info = 0, root = root, intercomm = intercomm, quiet = quiet) } else{ tmp <- paste(Sys.getpid(), "+", comm, sep="") if (needlog) arg <- c(Rscript, tmp, "needlog", R.home()) else arg <- c(Rscript, tmp , "nolog", R.home()) if (!is.null(hosts)){ hosts <- as.integer(hosts) if (any(is.na(hosts))) stop("hosts argument contains non-integer object(s).") if (max(hosts) > mpi.universe.size() -1 ||min(hosts) < 0){ tmp1 <- paste("hosts number should be within 0 to", mpi.universe.size()-1) stop(tmp1) } nslaves <- length(hosts) tmpfile <-paste(tmp, "appschema", sep="") fileobj <- file(tmpfile,"w") cat("c", paste(hosts, collapse=","), sep="", file=fileobj) cat(" ", system.file("Rslaves.sh", package="Rmpi"), file=fileobj) cat(" ", paste(arg, collapse=" "), file=fileobj) close(fileobj) mpi.info.create(0) mpi.info.set(0,"file",tmpfile) } if (length(unlist(strsplit(.Platform$pkgType,"mac"))) ==2 && .Platform$r_arch =="x86_64") realns<-mpi.comm.spawn(slave=system.file("MacR64slaves.sh", package="Rmpi"), slavearg=arg, nslaves=nslaves, info=0, root=root, intercomm=intercomm, quiet = quiet) else realns<-mpi.comm.spawn(slave=system.file("Rslaves.sh", package="Rmpi"), slavearg=arg, nslaves=nslaves, info=0, root=root, intercomm=intercomm, quiet = quiet) } if (!is.null(hosts)){ unlink(tmpfile) mpi.info.free(0) } if (realns==0) stop("It seems no single slave spawned.") if (mpi.intercomm.merge(intercomm,0,comm)) { mpi.comm.set.errhandler(comm) mpi.comm.disconnect(intercomm) mpi.bcast(nonblock,type=1, rank=0, comm=comm) mpi.bcast(sleep,type=2, rank=0, comm=comm) if (!quiet) slave.hostinfo(comm) } else stop("Fail to merge the comm for master and slaves.") } mpi.remote.exec <- function(cmd, ..., simplify=TRUE, comm=1, ret=TRUE){ if (mpi.comm.size(comm) < 2) stop("It seems no slaves running.") tag <- floor(runif(1,20000,30000)) scmd <- substitute(cmd) arg <-list(...) #if (length(arg) > 0) # deparse(arg) #tag.ret <- c(tag, ret, simplify) mpi.bcast.cmd(.mpi.worker.exec, tag=tag, ret=ret, simplify=simplify, comm = comm) #mpi.bcast(as.integer(tag.ret), type=1, comm=comm) mpi.bcast.Robj(list(scmd=scmd, arg=arg), comm=comm) if (ret){ size <- mpi.comm.size(comm) allcode <- mpi.allgather(integer(2), 1, integer(2*size), comm) type <- allcode[seq(3,2*size,2)] len <- allcode[seq(4,2*size,2)] eqlen <- all(len==len[1]) if (all(type==1)){ if (eqlen && simplify){ out <- mpi.gather(integer(len[1]),1,integer(size*len[1]),0,comm) out <- out[(len[1]+1):(size*len[1])] dim(out) <- c(len[1], size-1) out <- data.frame(out) } else { out1<-mpi.gatherv(integer(1),1,integer(1+sum(len)),c(1,len),0,comm) uplen <- cumsum(len)+1 lowlen <-c(2, uplen[-(size-1)]+1) out <- as.list(integer(size-1)) names(out) <- paste("slave",1:(size-1), sep="") for (i in 1:(size-1)) out[[i]]<- out1[lowlen[i]:uplen[i]] } } else if (all(type==2)){ if (eqlen && simplify){ out <- mpi.gather(double(len[1]),2,double(size*len[1]),0,comm) out <- out[(len[1]+1):(size*len[1])] dim(out) <- c(len[1], size-1) out <- data.frame(out) } else { out1<-mpi.gatherv(double(1),2,double(1+sum(len)),c(1,len),0,comm) uplen <- cumsum(len)+1 lowlen <-c(2, uplen[-(size-1)]+1) out <- as.list(integer(size-1)) names(out) <- paste("slave",1:(size-1), sep="") for (i in 1:(size-1)) out[[i]]<- out1[lowlen[i]:uplen[i]] } } else if (all(type==4)){ if (eqlen && simplify){ out <- mpi.gather(raw(len[1]),4,raw(size*len[1]),0,comm) out <- out[(len[1]+1):(size*len[1])] dim(out) <- c(len[1], size-1) out <- data.frame(out) } else { out1<-mpi.gatherv(raw(1),4,raw(1+sum(len)),c(1,len),0,comm) uplen <- cumsum(len)+1 lowlen <-c(2, uplen[-(size-1)]+1) out <- as.list(integer(size-1)) names(out) <- paste("slave",1:(size-1), sep="") for (i in 1:(size-1)) out[[i]]<- out1[lowlen[i]:uplen[i]] } } else { out <- as.list(integer(size-1)) names(out) <- paste("slave",1:(size-1), sep="") for (i in 1:(size-1)){ tmp<- mpi.recv.Robj(mpi.any.source(),tag,comm) src <- mpi.get.sourcetag()[1] out[[src]]<- tmp } } out } } .typeindex <- function (x) { if(class(x)=="integer") as.integer(c(1,length(x))) else if (class(x)=="numeric") as.integer(c(2,length(x))) else if (class(x)=="raw") as.integer(c(4,length(x))) else as.integer(-1) } .mpi.worker.exec <- function(tag, ret, simplify){ #assign(".mpi.err", FALSE, envir = .GlobalEnv) assign(".mpi.err", FALSE) .comm <- 1 #tag.ret <- mpi.bcast(integer(3), type=1, comm=.comm) #tag <- tag.ret[1] #ret <- as.logical(tag.ret[2]) #simplify <- as.logical(tag.ret[3]) scmd.arg <- mpi.bcast.Robj(comm=.comm) if (ret){ size <- mpi.comm.size(.comm) myerrcode <- as.integer(0) if (length(scmd.arg$arg)>0) out <- try(do.call(as.character(scmd.arg$scmd), scmd.arg$arg, envir=.GlobalEnv),TRUE) else out <- try(eval(scmd.arg$scmd, envir=sys.parent()), TRUE) if (get(".mpi.err")){ print(geterrmessage()) type <- integer(2) } else { type <- .typeindex(out) if (is.na(type[2])) type[2] <- as.integer(0) } allcode <- mpi.allgather(type, 1, integer(2*size), .comm) type <- allcode[seq(3,2*size,2)] len <- allcode[seq(4,2*size,2)] eqlen <- all(len==len[1]) if (all(type==1)) { if (eqlen && simplify) mpi.gather(out, 1, integer(1), 0, .comm) else mpi.gatherv(out, 1, integer(1), integer(1), 0 ,.comm) } else if (all(type==2)) { if (eqlen && simplify) mpi.gather(out, 2, double(1), 0, .comm) else mpi.gatherv(out, 2, double(1), integer(1), 0, .comm) } else if (all(type==4)) { if (eqlen && simplify) mpi.gather(out, 4, raw(1), 0, .comm) else mpi.gatherv(out, 4, raw(1), integer(1), 0, .comm) } else { mpi.send.Robj(out,0,tag,.comm) } } else { if (length(scmd.arg$arg)>0) out <- try(do.call(as.character(scmd.arg$scmd), scmd.arg$arg)) else out <- try(eval(scmd.arg$scmd)) } } mpi.close.Rslaves <- function(dellog=TRUE, comm=1){ if (mpi.comm.size(comm) < 2){ err <-paste("It seems no slaves running on comm", comm) stop(err) } mpi.bcast.cmd(cmd=break, rank=0, comm=comm) if (.Platform$OS!="windows"){ if (dellog && mpi.comm.size(0) < mpi.comm.size(comm)){ tmp <- paste(Sys.getpid(),"+",comm,sep="") logfile <- paste("*.",tmp,".*.log", sep="") if (length(system(paste("ls", logfile),TRUE,ignore.stderr=TRUE) )>=1) system(paste("rm", logfile)) } } # mpi.barrier(comm) if (comm >0){ if (is.loaded("mpi_comm_disconnect")) mpi.comm.disconnect(comm) else mpi.comm.free(comm) } # mpi.comm.set.errhandler(0) } tailslave.log <- function(nlines=3,comm=1){ if (mpi.comm.size(comm)==0) stop ("It seems no slaves running") tmp <- paste(Sys.getpid(),"+",comm,sep="") logfile <- paste("*.",tmp,".*.log", sep="") if (length(system(paste("ls", logfile),TRUE,ignore.stderr=TRUE))==0) stop("It seems no slave log files.") system(paste("tail -",nlines," ", logfile,sep="")) } mpi.apply <- function(X, FUN, ..., comm=1){ n <- length(X) nslaves <- mpi.comm.size(comm)-1 if (nslaves < n) stop("data length must be at most total slave size") if (!is.function(FUN)) stop("FUN is not a function") length(list(...)) #test for any non existing R objects tag <- floor(runif(1,1,1000)) mpi.bcast.cmd(.mpi.worker.apply, n=n, tag=tag, comm=comm) #mpi.bcast(as.integer(c(tag,n)),type=1,comm=comm) mpi.bcast.Robj(list(FUN=FUN,dot.arg=list(...)),rank=0,comm=comm) if (n < nslaves) X=c(X,as.list(integer( nslaves-n))) mpi.scatter.Robj(c(list("master"),as.list(X)),root=0,comm=comm) out <- as.list(integer(n)) for (i in 1:n){ tmp<- mpi.recv.Robj(mpi.any.source(),tag,comm) src <- mpi.get.sourcetag()[1] out[[src]]<- tmp } out } .mpi.worker.apply <- function(n, tag){ #assign(".mpi.err", FALSE, envir = .GlobalEnv) .comm <- 1 #tag.n <- mpi.bcast(integer(2), type=1, comm=.comm) #tag <- tag.n[1] #n <- tag.n[2] tmpfunarg <- mpi.bcast.Robj(rank=0, comm=.comm) .tmpfun <- tmpfunarg$FUN dotarg <- tmpfunarg$dot.arg tmpdata.arg <- list(mpi.scatter.Robj(root=0,comm=.comm)) if (mpi.comm.rank(.comm) <= n){ out <- try(do.call(".tmpfun", c(tmpdata.arg, dotarg)),TRUE) mpi.send.Robj(out,0,tag,.comm) } } mpi.iapply <- function(X, FUN, ..., comm=1, sleep=0.01){ n <- length(X) nslaves <- mpi.comm.size(comm)-1 if (nslaves < n) stop("data length must be at most total slave size") if (!is.function(FUN)) stop("FUN is not a function") length(list(...)) #test for any non existing R objects tag <- floor(runif(1,1,1000)) mpi.bcast.cmd(.mpi.worker.apply, n=n, tag=tag,comm=comm) #mpi.bcast(as.integer(c(tag,n)),type=1,comm=comm) mpi.bcast.Robj(list(FUN=FUN,dot.arg=list(...)),rank=0,comm=comm) if (n < nslaves) X=c(X,as.list(integer( nslaves-n))) mpi.scatter.Robj(c(list("master"),as.list(X)),root=0,comm=comm) out <- as.list(integer(n)) done=0 anysource=mpi.any.source() repeat { if (mpi.iprobe(anysource,tag,comm)){ srctag <- mpi.get.sourcetag() charlen <- mpi.get.count(type=4) tmp <- unserialize(mpi.recv(x = raw(charlen), type = 4, srctag[1], srctag[2], comm)) out[[srctag[1]]]<- tmp done=done+1 } if (done < n) Sys.sleep(sleep) else break } gc() out } mpi.parSim <- function(n=100,rand.gen=rnorm, rand.arg=NULL, statistic, nsim=100, run=1, slaveinfo=FALSE, sim.seq=NULL, simplify=TRUE, comm=1, ...){ sim.seq=NULL if (mpi.comm.size(comm) < 2) stop("It seems no slaves running.") if (!is.function(rand.gen)) stop("rand.gen is not a function") if (!is.function(statistic)) stop("statistic is not a function") if (!is.null(rand.arg)) if (!is.list(rand.arg)) stop("rand.arg is not a list") if (length(list(...))>0) deparse(list(...)) slave.num <- mpi.comm.size(comm)-1 if (!is.null(sim.seq)) if (!is.integer(sim.seq)) stop("sim.seq is not an integer vector") else if (min(sim.seq)<1 && max(sim.seq)>slave.num && length(sim.seq)!=slave.num*run) stop("sim.seq is not in right order") mpi.bcast.cmd(.mpi.worker.sim, n=n, nsim=nsim, run=run, comm=comm) mpi.bcast.Robj(list(rand.gen=rand.gen, rand.arg=rand.arg, stat=statistic, stat.arg=list(...)), comm=comm) #nnr <- c(n,nsim,run) #mpi.bcast(as.integer(nnr),type=1, comm=comm) result <- as.list(integer(slave.num*run)) if (!is.null(sim.seq)){ for ( i in 1:(slave.num*run)){ result[[i]] <- mpi.recv.Robj(source=sim.seq[i], tag=8, comm=comm) mpi.send(as.integer(i), type=1, dest=sim.seq[i], tag=88, comm=comm) } return(.simplify(slave.num*run, result, simplify, nsim)) } i <- 0 anysrc <- mpi.any.source() anytag <- mpi.any.tag() mpi.parSim.tmp <- integer(slave.num*run) while (i < slave.num*run){ i <- i+1 result[[i]] <- mpi.recv.Robj(source=anysrc, tag=8, comm=comm) src <- mpi.get.sourcetag()[1] mpi.send(as.integer(i), type=1, dest=src, tag=88, comm=comm) mpi.parSim.tmp[i] <- src } if (slaveinfo){ slavename <- paste("slave",1:slave.num, sep="") cat("Finished slave jobs summary:\n") for (i in 1:slave.num){ if (i < 10) cat(slavename[i], " finished",sum(mpi.parSim==i), "job(s)\n") else cat(slavename[i], "finished",sum(mpi.parSim==i), "job(s)\n") } } #assign(".mpi.parSim", mpi.parSim.tmp, envir = .GlobalEnv) .simplify(slave.num*run, result, simplify, nsim) } .mpi.worker.sim <- function(n, nsim, run){ .comm <- 1 tmpdata <- mpi.bcast.Robj(comm=.comm) rand.arg <- tmpdata$rand.arg stat.arg <- tmpdata$stat.arg .tmp.rand.gen <- tmpdata$rand.gen .tmp.statistic <- tmpdata$stat #nnr <- mpi.bcast(integer(3), type=1, comm=.comm) #n <- nnr[1]; nsim <- nnr[2]; run <- nnr[3] i <- 0 slave.num <- mpi.comm.size(.comm)-1 while( i < slave.num*(run-1)+1){ out <- replicate(nsim, do.call(".tmp.statistic", c(list(do.call(".tmp.rand.gen", c(list(n),rand.arg))), stat.arg))) mpi.send.Robj(obj=out, dest=0, tag=8, comm=.comm) i <- mpi.recv(integer(1), type=1, source=0, tag=88, comm=.comm) } } #from snow .docall <- function(fun, args) { if ((is.character(fun) && length(fun) == 1) || is.name(fun)) fun <- get(as.character(fun), envir = .GlobalEnv, mode = "function") enquote <- function(x) as.call(list(as.name("quote"), x)) do.call("fun", lapply(args, enquote)) } .splitIndices <- function(nx, ncl) { #i <- 1:nx; #structure(split(i, cut(i, ncl)), names=NULL) x <- 1:nx r <- nx/ncl ii <- 0:(ncl - 1) * r if (nx < ncl) intv <- 0:ncl else intv <- c(x[round(1 + ii)]-1,nx) structure(split(x, cut(x, intv)), names = NULL) } mpi.parMM <- function(A, B, job.num=mpi.comm.size(comm)-1, comm=1){ splitRows <- function(x, ncl) lapply(.splitIndices(nrow(x), ncl), function(i) x[i,, drop=FALSE]) .docall(rbind, mpi.applyLB(splitRows(A, job.num), get("%*%"), B, comm=comm)) } mpi.iparMM <- function(A, B, comm=1, sleep=0.01){ splitRows <- function(x, ncl) lapply(.splitIndices(nrow(x), ncl), function(i) x[i,, drop=FALSE]) .docall(rbind, mpi.iapply(splitRows(A, mpi.comm.size(comm)-1), get("%*%"), B, comm=comm, sleep=sleep)) } mpi.applyLB <- function(X, FUN, ..., apply.seq=NULL, comm=1){ apply.seq=NULL n <- length(X) slave.num <- mpi.comm.size(comm)-1 if (slave.num < 1) stop("There are no slaves running") if (n <= slave.num) { if (exists(".mpi.applyLB")) rm(".mpi.applyLB", envir=.GlobalEnv) return (mpi.apply(X,FUN,...,comm=comm)) } if (!is.function(FUN)) stop("FUN is not a function") length(list(...)) if (!is.null(apply.seq)) if (!is.integer(apply.seq)) stop("apply.seq is not an integer vector") else if (min(apply.seq)<1 && max(apply.seq)>slave.num && length(apply.seq)!=n) stop("apply.seq is not in right order") mpi.bcast.cmd(.mpi.worker.applyLB, n=n, comm=comm) #mpi.bcast(as.integer(n),type=1,comm=comm) mpi.bcast.Robj(list(FUN=FUN,dot.arg=list(...)),rank=0,comm=comm) out <- as.list(integer(n)) mpi.anysource <- mpi.any.source() mpi.anytag <- mpi.any.tag() for (i in 1:slave.num) mpi.send.Robj(list(data.arg=list(X[[i]])), dest=i,tag=i, comm=comm) if (!is.null(apply.seq)){ for ( i in 1:n){ tmp <- mpi.recv.Robj(source=apply.seq[i], tag=mpi.anytag, comm=comm) tag <- mpi.get.sourcetag()[2] out[[tag]]<- tmp j <- i+slave.num if (j <= n) mpi.send.Robj(list(data.arg=list(X[[j]])), dest=apply.seq[i],tag=j, comm=comm) else mpi.send.Robj(as.integer(0),dest=apply.seq[i],tag=j,comm=comm) } return(out) } #.mpi.applyLB <<- integer(n) mpi.seq.tmp <- integer(n) for (i in 1:n){ tmp<- mpi.recv.Robj(mpi.anysource,mpi.anytag,comm) srctag <- mpi.get.sourcetag() out[[srctag[2]]]<- tmp mpi.seq.tmp[i] <- srctag[1] j <- i+slave.num if (j <= n) mpi.send.Robj(list(data.arg=list(X[[j]])), dest=srctag[1],tag=j, comm=comm) else mpi.send.Robj(as.integer(0),dest=srctag[1],tag=j,comm=comm) } #assign(".mpi.applyLB",mpi.seq.tmp, envir = .GlobalEnv) out } .mpi.worker.applyLB <- function(n){ #assign(".mpi.err", FALSE, envir = .GlobalEnv) .comm <- 1 #n <- mpi.bcast(integer(1), type=1, comm=.comm) tmpfunarg <- mpi.bcast.Robj(rank=0, comm=.comm) .tmpfun <- tmpfunarg$FUN dotarg <- tmpfunarg$dot.arg mpi.anytag <- mpi.any.tag() repeat { tmpdata.arg <- mpi.recv.Robj(source=0,tag=mpi.anytag, comm=.comm)$data.arg tag <- mpi.get.sourcetag()[2] if (tag > n) break out <- try(do.call(".tmpfun", c(tmpdata.arg, dotarg)),TRUE) #if (.mpi.err) # print(geterrmessage()) mpi.send.Robj(out,0,tag,.comm) } } mpi.iapplyLB <- function(X, FUN, ..., apply.seq=NULL, comm=1, sleep=0.01){ apply.seq=NULL n <- length(X) slave.num <- mpi.comm.size(comm)-1 if (slave.num < 1) stop("There are no slaves running") if (n <= slave.num) { if (exists(".mpi.applyLB")) rm(".mpi.applyLB", envir =.GlobalEnv) return (mpi.iapply(X,FUN,...,comm=comm,sleep=sleep)) } if (!is.function(FUN)) stop("FUN is not a function") if (slave.num > 2000) stop("Total slaves are more than nonblock send/receive can handle") length(list(...)) if (!is.null(apply.seq)) if (!is.integer(apply.seq)) stop("apply.seq is not an integer vector") else if (min(apply.seq)<1 && max(apply.seq)>slave.num && length(apply.seq)!=n) stop("apply.seq is not in right order") mpi.bcast.cmd(.mpi.worker.applyLB, n=n, comm=comm) #mpi.bcast(as.integer(n),type=1,comm=comm) mpi.bcast.Robj(list(FUN=FUN,dot.arg=list(...)),rank=0,comm=comm) out <- as.list(integer(n)) mpi.anysource <- mpi.any.source() mpi.anytag <- mpi.any.tag() for (i in 1:slave.num) mpi.send.Robj(list(data.arg=list(X[[i]])), dest=i,tag=i,comm=comm) #for (i in 1:slave.num) # mpi.waitany(slave.num) if (!is.null(apply.seq)){ i=0 repeat { if (mpi.iprobe(apply.seq[i+1],mpi.anytag,comm)){ i=i+1 j <- i+slave.num if ( j <= n) mpi.send.Robj(list(data.arg=list(X[[j]])), dest=apply.seq[i],tag=j, comm=comm) else mpi.send.Robj(as.integer(0),dest=apply.seq[i],tag=j,comm=comm) charlen <- mpi.get.count(type=4) tag <- mpi.get.sourcetag()[2] tmp <- unserialize(mpi.recv(x = raw(charlen), type = 4, apply.seq[i], tag, comm)) out[[tag]]<- tmp #mpi.wait(0) } if (i < n) Sys.sleep(sleep) else break } return(out) } mpi.seq.tmp <- integer(n) i=0 repeat { if (mpi.iprobe(mpi.anysource,mpi.anytag,comm)){ i=i+1 srctag <- mpi.get.sourcetag() src <- srctag[1] tag <- srctag[2] j <- i+slave.num if ( j <= n) mpi.send.Robj(list(data.arg=list(X[[j]])), dest=src,tag=j, comm=comm) else mpi.send.Robj(as.integer(0),dest=src,tag=j,comm=comm) charlen <- mpi.get.count(type=4) tmp <- unserialize(mpi.recv(x = raw(charlen), type = 4, src, tag, comm)) out[[tag]]<- tmp mpi.seq.tmp[i] <- src #mpi.wait(src-1) } if (i < n) Sys.sleep(sleep) else break } #assign(".mpi.applyLB",mpi.seq.tmp, envir = .GlobalEnv) gc() out } #.mpi.worker.iapplyLB <- function(){ # assign(".mpi.err", FALSE, envir = .GlobalEnv) # n <- mpi.bcast(integer(1), type=1, comm=.comm) # tmpfunarg <- mpi.bcast.Robj(rank=0, comm=.comm) # .tmpfun <- tmpfunarg$fun # dotarg <- tmpfunarg$dot.arg # mpi.anytag <- mpi.any.tag() # repeat { # tmpdata.arg <- mpi.recv.Robj(source=0,tag=mpi.anytag, comm=.comm)$data.arg # tag <- mpi.get.sourcetag()[2] # if (tag > n) # break # out <- try(do.call(".tmpfun", c(tmpdata.arg, dotarg)),TRUE) # #if (.mpi.err) # # print(geterrmessage()) # mpi.wait(0) # mpi.isend.Robj(out,0,tag,.comm) # } # mpi.wait(0) #} .simplify <- function(n, answer, simplify, len=1, recursive=FALSE){ if (simplify && length(answer)&&length(common.len <- unique(unlist(lapply(answer, length)))) == 1 ) { if (common.len == len) unlist(answer, recursive = recursive) else if (common.len > len) array(unlist(answer, recursive = recursive), dim = c(common.len/len, n*len), dimnames = list(names(answer[[1]]), names(answer))) else answer } else answer } mpi.parLapply <- function(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1){ if (job.num < 2) stop("job.num is at least 2.") splitList <- function(x, ncl) lapply(.splitIndices(length(X), ncl), function(i) X[i]) .docall(c, mpi.applyLB(splitList(X, job.num), lapply, FUN, ..., apply.seq=apply.seq, comm=comm)) } mpi.iparLapply <- function(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1, sleep=0.01){ if (job.num < 2) stop("job.num is at least 2.") splitList <- function(X, ncl) lapply(.splitIndices(length(X), ncl), function(i) X[i]) .docall(c, mpi.iapplyLB(splitList(X, job.num), lapply, FUN, ..., apply.seq=apply.seq, comm=comm, sleep=sleep)) } mpi.parSapply <- function (X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, USE.NAMES = TRUE, comm=1) { FUN <- match.fun(FUN) answer <- mpi.parLapply(as.list(X),FUN,...,job.num=job.num,apply.seq=apply.seq,comm=comm) if (USE.NAMES && is.character(X) && is.null(names(answer))) names(answer) <- X .simplify(length(X),answer, simplify) } mpi.iparSapply <- function (X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, USE.NAMES = TRUE, comm=1,sleep=0.01) { FUN <- match.fun(FUN) answer <- mpi.iparLapply(as.list(X),FUN,...,job.num=job.num,apply.seq=apply.seq,comm=comm,sleep=sleep) if (USE.NAMES && is.character(X) && is.null(names(answer))) names(answer) <- X .simplify(length(X),answer, simplify) } mpi.parReplicate <- function(n, expr, job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, comm=1){ mpi.parSapply(integer(n), eval.parent(substitute(function(...) expr)), job.num=job.num, apply.seq=apply.seq, simplify = simplify, comm=comm) } mpi.iparReplicate <- function(n, expr, job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, comm=1,sleep=0.01){ mpi.iparSapply(integer(n), eval.parent(substitute(function(...) expr)), job.num=job.num, apply.seq=apply.seq, simplify = simplify, comm=comm,sleep=sleep) } mpi.parRapply <- function(X,FUN,...,job.num=mpi.comm.size(comm)-1,apply.seq=NULL,comm=1){ if (job.num < 2) stop("job.num is at least 2.") splitRows <- function(X, ncl) lapply(.splitIndices(nrow(X), ncl), function(i) X[i,, drop=FALSE]) .docall(c, mpi.applyLB(splitRows(X,job.num), apply, 1, FUN, ..., apply.seq=apply.seq, comm=comm)) } mpi.iparRapply <- function(X,FUN,...,job.num=mpi.comm.size(comm)-1,apply.seq=NULL,comm=1,sleep=0.01){ if (job.num < 2) stop("job.num is at least 2.") splitRows <- function(X, ncl) lapply(.splitIndices(nrow(X), ncl), function(i) X[i,, drop=FALSE]) .docall(c, mpi.iapplyLB(splitRows(X,job.num), apply, 1, FUN, ..., apply.seq=apply.seq, comm=comm,sleep=sleep)) } mpi.parCapply <- function(X,FUN,...,job.num=mpi.comm.size(comm)-1,apply.seq=NULL,comm=1){ if (job.num < 2) stop("job.num is at least 2.") splitCols <- function(X, ncl) lapply(.splitIndices(ncol(X), ncl), function(i) X[,i, drop=FALSE]) .docall(c, mpi.applyLB(splitCols(X,job.num), apply, 2, FUN, ..., apply.seq=apply.seq, comm=comm)) } mpi.iparCapply <- function(X,FUN,...,job.num=mpi.comm.size(comm)-1,apply.seq=NULL,comm=1,sleep=0.01){ if (job.num < 2) stop("job.num is at least 2.") splitCols <- function(X, ncl) lapply(.splitIndices(ncol(X), ncl), function(i) X[,i, drop=FALSE]) .docall(c, mpi.iapplyLB(splitCols(X,job.num), apply, 2, FUN, ..., apply.seq=apply.seq, comm=comm,sleep=sleep)) } mpi.parApply <- function(X, MARGIN, FUN, ..., job.num = mpi.comm.size(comm)-1, apply.seq=NULL, comm=1) { FUN <- match.fun(FUN) d <- dim(X) dl <- length(d) if(dl == 0) stop("dim(X) must have a positive length") ds <- 1:dl if(length(oldClass(X)) > 0) X <- if(dl == 2) as.matrix(X) else as.array(X) dn <- dimnames(X) s.call <- ds[-MARGIN] s.ans <- ds[MARGIN] d.call <- d[-MARGIN] d.ans <- d[MARGIN] dn.call<- dn[-MARGIN] dn.ans <- dn[MARGIN] d2 <- prod(d.ans) if(d2 == 0) { newX <- array(vector(typeof(X), 1), dim = c(prod(d.call), 1)) ans <- FUN(if(length(d.call) < 2) newX[,1] else array(newX[,1], d.call, dn.call), ...) return(if(is.null(ans)) ans else if(length(d.call) < 2) ans[1][-1] else array(ans, d.ans, dn.ans)) } newX <- aperm(X, c(s.call, s.ans)) dim(newX) <- c(prod(d.call), d2) if(length(d.call) < 2) { if (length(dn.call)) dimnames(newX) <- c(dn.call, list(NULL)) ans <- mpi.parLapply(1:d2, function(i, ...) FUN(newX[,i], ...), ..., job.num = job.num, apply.seq=apply.seq, comm=comm ) } else ans <- mpi.parLapply(1:d2, function(i, ...) FUN(array(newX[,i], d.call, dn.call), ...), ..., job.num = job.num, apply.seq=apply.seq, comm=comm) ans.list <- is.recursive(ans[[1]]) l.ans <- length(ans[[1]]) ans.names <- names(ans[[1]]) if(!ans.list) ans.list <- any(unlist(lapply(ans, length)) != l.ans) if(!ans.list && length(ans.names)) { all.same <- sapply(ans, function(X) identical(names(X), ans.names)) if (!all(all.same)) ans.names <- NULL } len.a <- if(ans.list) d2 else length(ans <- unlist(ans, recursive = FALSE)) if(length(MARGIN) == 1 && len.a == d2) { names(ans) <- if(length(dn.ans[[1]])) dn.ans[[1]] return(ans) } if(len.a == d2) return(array(ans, d.ans, dn.ans)) if(len.a > 0 && len.a %% d2 == 0) return(array(ans, c(len.a %/% d2, d.ans), if(is.null(dn.ans)) { if(!is.null(ans.names)) list(ans.names,NULL) } else c(list(ans.names), dn.ans))) return(ans) } mpi.iparApply <- function(X, MARGIN, FUN, ..., job.num = mpi.comm.size(comm)-1, apply.seq=NULL, comm=1,sleep=0.01) { FUN <- match.fun(FUN) d <- dim(X) dl <- length(d) if(dl == 0) stop("dim(X) must have a positive length") ds <- 1:dl if(length(oldClass(X)) > 0) X <- if(dl == 2) as.matrix(X) else as.array(X) dn <- dimnames(X) s.call <- ds[-MARGIN] s.ans <- ds[MARGIN] d.call <- d[-MARGIN] d.ans <- d[MARGIN] dn.call<- dn[-MARGIN] dn.ans <- dn[MARGIN] d2 <- prod(d.ans) if(d2 == 0) { newX <- array(vector(typeof(X), 1), dim = c(prod(d.call), 1)) ans <- FUN(if(length(d.call) < 2) newX[,1] else array(newX[,1], d.call, dn.call), ...) return(if(is.null(ans)) ans else if(length(d.call) < 2) ans[1][-1] else array(ans, d.ans, dn.ans)) } newX <- aperm(X, c(s.call, s.ans)) dim(newX) <- c(prod(d.call), d2) if(length(d.call) < 2) { if (length(dn.call)) dimnames(newX) <- c(dn.call, list(NULL)) ans <- mpi.iparLapply(1:d2, function(i, ...) FUN(newX[,i], ...), ..., job.num = job.num, apply.seq=apply.seq, comm=comm, sleep=sleep ) } else ans <- mpi.iparLapply(1:d2, function(i, ...) FUN(array(newX[,i], d.call, dn.call), ...), ..., job.num = job.num, apply.seq=apply.seq, comm=comm, sleep=sleep) ans.list <- is.recursive(ans[[1]]) l.ans <- length(ans[[1]]) ans.names <- names(ans[[1]]) if(!ans.list) ans.list <- any(unlist(lapply(ans, length)) != l.ans) if(!ans.list && length(ans.names)) { all.same <- sapply(ans, function(X) identical(names(X), ans.names)) if (!all(all.same)) ans.names <- NULL } len.a <- if(ans.list) d2 else length(ans <- unlist(ans, recursive = FALSE)) if(length(MARGIN) == 1 && len.a == d2) { names(ans) <- if(length(dn.ans[[1]])) dn.ans[[1]] return(ans) } if(len.a == d2) return(array(ans, d.ans, dn.ans)) if(len.a > 0 && len.a %% d2 == 0) return(array(ans, c(len.a %/% d2, d.ans), if(is.null(dn.ans)) { if(!is.null(ans.names)) list(ans.names,NULL) } else c(list(ans.names), dn.ans))) return(ans) } #mpi.parallel.sim <- mpi.parSim Rmpi/R/Rng.R0000644000176000001440000000121012116401676012261 0ustar ripleyusersmpi.setup.rngstream <- function(iseed=NULL, comm = 1){ require(parallel) commsize <- mpi.comm.size(comm) if (commsize < 3) stop("There is no slave or only one slave") if (!mpi.is.master()) stop("Can be run only on master") RNGkind("L'Ecuyer-CMRG") if (!is.null(iseed)) set.seed(iseed) seeds <- vector("list", commsize) seeds[[1L]] <- .Random.seed for (i in seq_len(commsize - 1L)) seeds[[i + 1L]] <- nextRNGStream(seeds[[i]]) initRNGstreamNode <- function(seed){ RNGkind("L'Ecuyer-CMRG") .Random.seed <<- seed } invisible(mpi.apply(seeds[-1], initRNGstreamNode,comm=comm)) }Rmpi/R/Rcomm.R0000644000176000001440000000640512015164774012626 0ustar ripleyusers### Copyright (C) 2002 Hao Yu mpi.barrier <- function(comm=1){ .Call("mpi_barrier", as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.set.errhandler <- function(comm=1){ .Call("mpi_comm_set_errhandler", as.integer(comm), PACKAGE = "Rmpi") } mpi.comm.test.inter <- function(comm=2){ if(mpi.comm.is.null(comm)) stop("NULL communicator") .Call("mpi_comm_test_inter",as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.rank <- function(comm=1){ .Call("mpi_comm_rank", as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.size <- function(comm=1){ if (.Call("mpi_comm_is_null", as.integer(comm), PACKAGE = "Rmpi")==1) 0 else .Call("mpi_comm_size",as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.dup <- function(comm, newcomm){ .Call("mpi_comm_dup", as.integer(comm), as.integer(newcomm), PACKAGE = "Rmpi") } mpi.comm.remote.size <- function(comm=2){ .Call("mpi_comm_remote_size", as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.free <- function(comm=1){ if (mpi.comm.size(comm)==0){ tmp<-paste("It seems no members(slaves) associated with comm", comm) stop(tmp) } .Call("mpi_comm_free",as.integer(comm),PACKAGE = "Rmpi") } mpi.abort <- function(comm=1){ if (mpi.comm.size(comm)==0){ tmp<-paste("It seems no members(slaves) associated with comm", comm) stop(tmp) } .Call("mpi_abort",as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.disconnect <- function(comm=1){ if (mpi.comm.size(comm)==0){ tmp<-paste("It seems no members(slaves) associated with comm", comm) stop(tmp) } if (!is.loaded("mpi_comm_disconnect")) stop("MPI_Comm_disconnect is not supported.") .Call("mpi_comm_disconnect",as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.spawn <- function(slave, slavearg=character(0), nslaves=mpi.universe.size(), info=0, root=0, intercomm=2, quiet=FALSE){ if (!is.loaded("mpi_comm_spawn")) stop("MPI_Comm_spawn is not supported.") 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) # } else if (nslaves <= 0) stop("Choose a positive number of slaves.") .Call("mpi_comm_spawn", as.character(slave), as.character(slavearg), as.integer(nslaves), as.integer(info), as.integer(root), as.integer(intercomm), as.integer(quiet), PACKAGE = "Rmpi") } mpi.comm.get.parent <- function(comm=2){ if (!is.loaded("mpi_comm_get_parent")) stop("MPI_Comm_get_parent is not supported.") .Call("mpi_comm_get_parent", as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.is.null <- function(comm){ as.logical(.Call("mpi_comm_is_null", as.integer(comm), PACKAGE = "Rmpi")) } mpi.intercomm.merge <- function(intercomm=2,high=0,comm=1){ .Call("mpi_intercomm_merge", as.integer(intercomm), as.integer(high), as.integer(comm),PACKAGE = "Rmpi") } mpi.comm.c2f <- function(comm=1){ .Call("mpi_comm_c2f", as.integer(comm),PACKAGE = "Rmpi") } Rmpi/R/Rmpi.R0000644000176000001440000001113012324027352012440 0ustar ripleyusers### Copyright (C) 2002 Hao Yu mpi.finalize <- function(){ if(mpi.is.master()) print("Exiting Rmpi. Rmpi cannot be used unless relaunching R.") .Call("mpi_finalize",PACKAGE = "Rmpi") } mpi.exit <- function(){ if (mpi.is.master()) print("Detaching Rmpi. Rmpi cannot be used unless relaunching R.") .Call("mpi_finalize",PACKAGE = "Rmpi") detach(package:Rmpi) } mpi.quit <- function(save="no"){ .Call("mpi_finalize",PACKAGE = "Rmpi") q(save=save,runLast=FALSE) } mpi.is.master <- function () { if (is.loaded("mpi_comm_get_parent")) as.logical(.Call("mpi_is_master",PACKAGE = "Rmpi")) else { if (mpi.comm.size(1)>0) as.logical(mpi.comm.rank(1)==0) else as.logical(mpi.comm.rank(0)==0) } } mpi.any.source <- function(){ .Call("mpi_any_source",PACKAGE = "Rmpi") } mpi.any.tag <- function(){ .Call("mpi_any_tag",PACKAGE = "Rmpi") } mpi.proc.null <- function(){ .Call("mpi_proc_null",PACKAGE = "Rmpi") } string <- function(length){ if (as.integer(length) < 1) stop("need positive length") .Call("mkstr",as.integer(length),PACKAGE = "Rmpi") } mpi.info.create <- function(info=0){ .Call("mpi_info_create", as.integer(info),PACKAGE = "Rmpi") } mpi.info.set <- function(info=0, key, value){ .Call("mpi_info_set", as.integer(info), as.character(key), as.character(value),PACKAGE = "Rmpi") } mpi.info.get <- function(info=0, key, valuelen){ .Call("mpi_info_get",as.integer(info), as.character(key), as.integer(valuelen), as.integer(valuelen),PACKAGE = "Rmpi") } mpi.info.free <- function(info=0){ .Call("mpi_info_free", as.integer(info),PACKAGE = "Rmpi") } mpi.universe.size <- function(){ if (!is.loaded("mpi_universe_size")) stop("This function is not supported under MPI 1.2") out <-.Call("mpi_universe_size",PACKAGE = "Rmpi") if (out==0){ # if (exists(".mpi.universe.size")) #out<-.mpi.universe.size #else { if (.Platform$OS=="windows") { require(parallel) out <- detectCores() } #} } if (.Call("mpidist",PACKAGE="Rmpi") == 2) out <- out-length(grep("no_schedule",system("lamnodes",TRUE,ignore.stderr=TRUE))) if (.Call("mpidist",PACKAGE="Rmpi") == 1 && out == 1){ if (length(unlist(strsplit(.Platform$pkgType,"mac"))) ==2) out <- as.integer(unlist(strsplit(system("sysctl hw.ncpu",TRUE,ignore.stderr=TRUE),":"))[2]) } #if (.Call("mpidist",PACKAGE="Rmpi") == 1 && out > 1) # if (.Platform$OS!="windows") # out <- out-1 out } mpi.get.processor.name <- function(short=TRUE){ name <- .Call("mpi_get_processor_name",PACKAGE = "Rmpi") if (short) name <- unlist(strsplit(name, "\\."))[1] name } mpi.sendrecv <- function(senddata, sendtype, dest, sendtag, recvdata, recvtype, source, recvtag, comm = 1, status = 0) { .Call("mpi_sendrecv", senddata, as.integer(sendtype), as.integer(dest), as.integer(sendtag), recvdata, as.integer(recvtype), as.integer(source), as.integer(recvtag), as.integer(comm), as.integer(status), PACKAGE="Rmpi") } mpi.sendrecv.replace <- function(x, type, dest, sendtag, source, recvtag, comm = 1, status = 0) { .Call("mpi_sendrecv_replace", x, as.integer(type), as.integer(dest), as.integer(sendtag), as.integer(source), as.integer(recvtag), as.integer(comm), as.integer(status), PACKAGE="Rmpi") } mpi.cart.create <- function(commold=1, dims, periods, reorder=FALSE, commcart=3) { .Call("mpi_cart_create", as.integer(commold), as.integer(dims), as.integer(periods), as.integer(reorder), as.integer(commcart), PACKAGE="Rmpi") } mpi.cartdim.get <- function(comm=3) { .Call("mpi_cartdim_get",as.integer(comm), PACKAGE="Rmpi") } mpi.cart.get <- function(comm=3, maxdims) { out <- .Call("mpi_cart_get",as.integer(comm), as.integer(maxdims), PACKAGE="Rmpi") dims <- out[1:maxdims] periods <- out[(maxdims+1):(maxdims*2)] coords <- out[(maxdims*2 + 1):(maxdims*3)] list(dims=dims,periods=periods,coords=coords) } mpi.cart.rank <- function(comm=3, coords) { .Call("mpi_cart_rank",as.integer(comm), as.integer(coords), PACKAGE="Rmpi") } mpi.cart.coords <- function(comm=3, rank, maxdims) { .Call("mpi_cart_coords",as.integer(comm), as.integer(rank), as.integer(maxdims), PACKAGE="Rmpi") } mpi.cart.shift <- function(comm=3, direction, disp){ .Call("mpi_cart_shift", as.integer(comm), as.integer(direction-1), as.integer(disp), PACKAGE="Rmpi") } mpi.dims.create <- function(nnodes, ndims, dims=integer(ndims)){ .Call("mpi_dims_create",as.integer(nnodes),as.integer(ndims),as.integer(dims), PACKAGE="Rmpi") } Rmpi/R/Rcoll.R0000644000176000001440000004205712336651343012626 0ustar ripleyusers### Copyright (C) 2002 Hao Yu mpi.probe <- function(source, tag, comm=1, status=0){ .Call("mpi_probe", as.integer(source), as.integer(tag), as.integer(comm), as.integer(status), PACKAGE = "Rmpi") } mpi.get.count <- function(type, status = 0){ .Call("mpi_get_count",as.integer(status), as.integer(type),PACKAGE = "Rmpi") } mpi.get.sourcetag <- function(status=0){ .Call("mpi_get_sourcetag", as.integer(status),PACKAGE = "Rmpi") } mpi.gather <- function(x, type, rdata, root=0, comm=1){ .Call("mpi_gather",.force.type( x,type), as.integer(type), rdata, as.integer(root), as.integer(comm),PACKAGE = "Rmpi") } mpi.scatter <- function(x, type, rdata, root=0, comm=1){ .Call("mpi_scatter", .force.type(x,type), as.integer(type), rdata, as.integer(root), as.integer(comm),PACKAGE = "Rmpi") } mpi.gatherv <- function(x, type, rdata, rcounts, root=0, comm=1){ .Call("mpi_gatherv", x, as.integer(type),rdata, as.integer(rcounts), as.integer(root), as.integer(comm),PACKAGE = "Rmpi") } mpi.scatterv <- function(x, scounts, type, rdata, root=0, comm=1){ .Call("mpi_scatterv", .force.type(x,type), as.integer(scounts), as.integer(type), rdata, as.integer(root), as.integer(comm),PACKAGE = "Rmpi") } #strings.link<-function(manysts,newst){ #.Call("stringslink",as.character(manysts),as.character(newst),PACKAGE="Rmpi") #} #string.cut<-function(onest,newst){ #.Call("stringcut",as.character(onest),as.character(newst),PACKAGE="Rmpi") #} mpi.scatter.Robj <- function(obj=NULL, root=0, comm=1){ if (mpi.comm.rank(comm) == root){ size<-mpi.comm.size(comm) #subobj<-lapply(obj,serialize, connection=NULL) subobj<-lapply(1:size, function(i) serialize(obj[[i]], NULL)) sublen<-unlist(lapply(subobj,length)) #newsubobj<-strings.link(subobj,string(sum(sublen)+1)) newsubobj<-c(subobj,recursive=TRUE) strnum<-mpi.scatter(sublen,type=1,rdata=integer(1),root=root,comm=comm) outobj<-unserialize(mpi.scatterv(newsubobj,scounts=sublen,type= 4, rdata=raw(strnum),root=root, comm=comm)) } else { strnum<-mpi.scatter(integer(1),type=1,rdata=integer(1),root=root,comm=comm) outobj<-unserialize(mpi.scatterv(raw(strnum),scounts=0, type=4, rdata=raw(strnum), root=root, comm=comm)) } gc() return(outobj) } mpi.scatter.Robj2slave=function (obj, comm = 1) { if (!is.list(obj)) stop("Only list object is allowed to scatter to slaves.") if (length(obj) != (mpi.comm.size(comm)-1)) stop("Length of your list object is not the same as total number of slaves.") .tmpname <- list(objname=deparse(substitute(obj), width.cutoff = 500)) mpi.bcast.Robj2slave(.tmpname) mpi.bcast.cmd(cmd = .tmpRobj <- mpi.scatter.Robj(comm = 1), rank = 0, comm = comm) mpi.scatter.Robj(obj=c(list("master"),obj), root = 0, comm = comm) mpi.bcast.cmd(cmd = assign(.tmpname$objname, .tmpRobj), rank = 0, comm = comm) } mpi.gather.Robj <- function(obj=NULL, root=0, comm=1, ...){ biobj<-serialize(obj, NULL) bilen<-length(biobj) if (mpi.comm.rank(comm) == root){ size<-mpi.comm.size(comm=comm) rcounts<-mpi.gather(bilen,type=1,rdata=integer(size), root=root,comm=comm) allbiobj<-mpi.gatherv(biobj,type=4,rdata=raw(sum(rcounts)) ,rcounts=rcounts,root=root,comm=comm) pos=c(0,cumsum(rcounts)) cutobj=list() for(i in 1:size) cutobj[[i]]=allbiobj[(pos[i]+1):pos[i+1]] out <- sapply(cutobj,unserialize, ...) gc() out } else { mpi.gather(bilen,type=1,rdata=integer(1),root=root,comm=comm) out <- mpi.gatherv(biobj,type=4,rdata=raw(1),rcounts=0,root=root,comm=comm) gc() out } } mpi.allgather.Robj <- function(obj=NULL, comm=1){ biobj<-serialize(obj, NULL) bilen<-length(biobj) size<-mpi.comm.size(comm=comm) rcounts<-mpi.allgather(bilen,type=1,rdata=integer(size),comm=comm) allbiobj<-mpi.allgatherv(biobj,type=4,rdata=raw(sum(rcounts)) ,rcounts=rcounts,comm=comm) pos=c(0,cumsum(rcounts)) cutobj=list() for(i in 1:size) cutobj[[i]]=allbiobj[(pos[i]+1):pos[i+1]] out <- sapply(cutobj,unserialize) gc() out # bistrcut<-sapply(rcounts,string) # bistr<-string.cut(allbiobj,bistrcut) # lapply(bistr,unserialize) } mpi.allgather <- function(x, type, rdata, comm=1){ .Call("mpi_allgather", x, as.integer(type), rdata, as.integer(comm), PACKAGE = "Rmpi") } mpi.allgatherv <- function(x, type, rdata, rcounts, comm=1){ .Call("mpi_allgatherv", x, as.integer(type), rdata, as.integer(rcounts), as.integer(comm),PACKAGE = "Rmpi") } mpi.bcast <- function (x, type, rank = 0, comm = 1, buffunit=100) { .Call("mpi_bcast", .force.type(x,type), as.integer(type), as.integer(rank), as.integer(comm), as.integer(buffunit), PACKAGE = "Rmpi") } #bin.nchar <- function(x){ # if (!is.character(x)) # stop("Must be a (binary) character") # .Call("bin_nchar", x[1],PACKAGE = "Rmpi") #} mpi.bcast.cmd <- function (cmd=NULL, ..., rank=0, comm=1, nonblock=FALSE, sleep=0.1){ myrank=mpi.comm.rank(comm) if(myrank == rank){ #cmd <- deparse(substitute(cmd), width.cutoff=500) #cmd <- serialize(cmd, NULL) scmd <- substitute(cmd) arg <-list(...) commsize <- mpi.comm.size(comm=comm) scmd.arg <-serialize(list(scmd=scmd, arg=arg), NULL) #mpi.bcast(x=length(cmd), type=1, rank=rank, comm=comm) #invisible(mpi.bcast(x=cmd, type=4, rank=rank, comm=comm)) for (i in 0:commsize) { if (i != rank) invisible(mpi.send(x=scmd.arg, type=4, dest=i, tag=50000+i, comm=comm)) } } else { # charlen <- mpi.bcast(x=integer(1), type=1, rank=rank, comm=comm) #if (is.character(charlen)) #error # parse(text="break") #else { #out <- unserialize(mpi.bcast(x=raw(charlen), type=4, rank=rank, comm=comm)) #parse(text=out) #} if (!nonblock){ mpi.probe(mpi.any.source(), tag=50000+myrank, comm) srctag <- mpi.get.sourcetag(0) charlen <- mpi.get.count(type=4, 0) #out <- unserialize(mpi.recv(x=raw(charlen), type=4,srctag[1],srctag[2], comm)) scmd.arg <- unserialize(mpi.recv(x=raw(charlen), type=4,srctag[1],srctag[2], comm)) } else { repeat { if (mpi.iprobe(mpi.any.source(),tag=50000+myrank,comm)){ srctag <- mpi.get.sourcetag() charlen <- mpi.get.count(type=4) #out <- unserialize(mpi.recv(x = raw(charlen), type = 4, srctag[1],srctag[2], comm)) scmd.arg <- unserialize(mpi.recv(x = raw(charlen), type = 4, srctag[1],srctag[2], comm)) break } Sys.sleep(sleep) } } #parse(text=out) if (length(scmd.arg$arg)>0) enquote(do.call(as.character(scmd.arg$scmd), scmd.arg$arg, envir=.GlobalEnv)) else scmd.arg$scmd } } mpi.bcast.Robj <- function(obj=NULL, rank=0, comm=1){ if (mpi.comm.rank(comm) == rank){ tmp <- serialize(obj, NULL) mpi.bcast(as.integer(length(tmp)), 1, rank, comm) mpi.bcast(tmp, 4, rank, comm) invisible(gc()) } else { charlen <- mpi.bcast(integer(1), 1, rank, comm) out <- unserialize(mpi.bcast(raw(charlen), 4, rank, comm)) gc() out } } mpi.bcast.Robj2slave <- function(obj, comm=1, all=FALSE){ if (!all){ objname <- deparse(substitute(obj),width.cutoff=500) obj <- list(objname=objname,obj=obj) mpi.bcast.cmd(cmd=.tmpRobj <- mpi.bcast.Robj(comm=1), rank=0, comm=comm) mpi.bcast.Robj(obj, rank=0, comm=comm) mpi.bcast.cmd(cmd=assign(.tmpRobj$objname,.tmpRobj$obj), rank=0, comm=comm) #mpi.bcast.cmd(rm(.tmpRobj,envir = .GlobalEnv), rank=0, comm=comm) } else { master.objects <-objects(envir=.GlobalEnv) obj.num=length(master.objects) if (obj.num) for (i in 1:obj.num){ mpi.bcast.cmd(cmd=.tmpRobj <- mpi.bcast.Robj(comm=1), rank=0, comm=comm) mpi.bcast.Robj(list(objname=master.objects[i], obj=get(master.objects[i])), rank=0, comm=comm) mpi.bcast.cmd(cmd=assign(.tmpRobj$objname,.tmpRobj$obj), rank=0, comm=comm) } } } mpi.bcast.Rfun2slave <- function(comm=1){ master.fun <-objects(envir=.GlobalEnv) sync.index <- which(lapply(lapply(master.fun, get), is.function)==1) obj.num=length(sync.index) if (obj.num) for (i in sync.index){ mpi.bcast.cmd(cmd=.tmpRobj <- mpi.bcast.Robj(comm=1), rank=0, comm=comm) mpi.bcast.Robj(list(objname=master.fun[i], obj=get(master.fun[i])), rank=0, comm=comm) mpi.bcast.cmd(cmd=assign(.tmpRobj$objname,.tmpRobj$obj), rank=0, comm=comm) } } mpi.bcast.data2slave <- function(obj, comm=1, buffunit=100){ if (!is.numeric(obj) || (!is.vector(obj) && !is.matrix(obj))) return (mpi.bcast.Robj2slave(obj, comm=comm)) #stop ("Please use mpi.bcast.Robj2slave") objname <- serialize(deparse(substitute(obj),width.cutoff=500),NULL) obj.info = integer(4) obj.info[1]=length(objname) if (is.vector(obj)){ if (buffunit < 1 || buffunit >=2^31) stop("buffunit must be an integer between 1 and 2^31-1") obj.info[2]=buffunit obj.info[3]=length(obj)%/%buffunit obj.info[4]=length(obj)%%buffunit } if (is.matrix(obj)){ obj.dim <-dim(obj) obj.info[2]=obj.dim[1] obj.info[3]=obj.dim[2] obj.info[4]=0 } mpi.bcast.cmd(.tinfo <- mpi.bcast(integer(4),type=1),rank=0,comm=1) mpi.bcast(obj.info,type=1,rank=0,comm=comm) mpi.bcast.cmd(.tname<-unserialize(mpi.bcast(raw(.tinfo[1]),type=4)), rank=0, comm=comm) mpi.bcast(objname, type=4, rank=0, comm=comm) if (is.vector(obj)){ mpi.bcast.cmd(.tmp.obj <- mpi.bcast(double(.tinfo[2]*(.tinfo[3]+(.tinfo[4]>0))),type=5, buffunit=.tinfo[2]),rank=0,comm=comm) mpi.bcast(obj,type=5,rank=0,comm=comm,buffunit=buffunit) mpi.bcast.cmd(assign(.tname,.tmp.obj[1:(.tinfo[2]*.tinfo[3]+.tinfo[4])]), rank=0, comm=comm) mpi.bcast.cmd(rm(".tmp.obj")) mpi.bcast.cmd(gc()) } if (is.matrix(obj)){ mpi.bcast.cmd(.tmp.obj <- mpi.bcast(matrix(double(.tinfo[2]*.tinfo[3]), nrow=.tinfo[2]),type=5, buffunit=.tinfo[2]),rank=0,comm=comm) mpi.bcast(obj,type=5,rank=0,comm=comm,buffunit=obj.info[2]) mpi.bcast.cmd(assign(.tname,.tmp.obj), rank=0, comm=comm) mpi.bcast.cmd(gc()) } } mpi.send <- function (x, type, dest, tag, comm=1){ .Call("mpi_send", .force.type(x,type), as.integer(type), as.integer(dest), as.integer(tag), as.integer(comm),PACKAGE = "Rmpi") } mpi.recv <- function (x, type, source, tag, comm=1, status=0){ .Call("mpi_recv", x, as.integer(type), as.integer(source), as.integer(tag), as.integer(comm), as.integer(status), PACKAGE = "Rmpi") } mpi.send.Robj <- function(obj, dest, tag, comm=1){ mpi.send(x=serialize(obj, NULL), type=4, dest=dest, tag=tag, comm=comm) invisible(gc()) } mpi.recv.Robj <- function(source, tag, comm=1, status=0){ mpi.probe(source, tag, comm, status) srctag <- mpi.get.sourcetag(status) charlen <- mpi.get.count(type=4, status) out<-unserialize(mpi.recv(x=raw(charlen), type=4,srctag[1],srctag[2], comm, status)) #gc() out } mpi.reduce <- function(x, type=2, op=c("sum","prod","max","min","maxloc","minloc"), dest=0, comm=1){ # op <- switch(match.arg(op),sum=1,prod=2,max=3,min=4) op <- pmatch(match.arg(op), c("sum","prod","max","min","maxloc","minloc")) if (is.integer(x)){ if(type!=1) stop("data (integer) and type are not matched.") } else if (is.double(x)){ if(type!=2) stop("data (double) and type are not matched.") } else stop("Not implemented.") # if (op==5||op==6){ # n <- length(x) # x <- rep(x,rep(2,n)) # x[seq(2, 2*n, 2)] <- mpi.comm.rank(comm) # } .Call("mpi_reduce", x, as.integer(type), as.integer(op), as.integer(dest), as.integer(comm),PACKAGE = "Rmpi") } mpi.allreduce <- function(x,type=2, op=c("sum","prod","max","min","maxloc","minloc"), comm=1){ # op <- switch(match.arg(op),sum=1,prod=2,max=3,min=4) op <- pmatch(match.arg(op), c("sum","prod","max","min","maxloc","minloc")) if (is.integer(x)){ if(type!=1) stop("data (integer) and type are not matched.") } else if (is.double(x)){ if(type!=2) stop("data (double) and type are not matched.") } else stop("Not implemented.") .Call("mpi_allreduce", x, as.integer(type), as.integer(op), as.integer(comm),PACKAGE = "Rmpi") } mpi.isend <- function (x, type, dest, tag, comm=1, request=0){ #mpi.realloc.request(request+1) invisible(.Call("mpi_isend", .force.type(x,type), as.integer(type), as.integer(dest), as.integer(tag), as.integer(comm), as.integer(request), PACKAGE = "Rmpi")) } mpi.irecv <- function (x, type, source, tag, comm=1, request=0){ #mpi.realloc.request(request+1) if (type==3) stop ("Character receiver is not supported") invisible(.Call("mpi_irecv", x, as.integer(type), as.integer(source), as.integer(tag), as.integer(comm), as.integer(request), PACKAGE = "Rmpi")) } mpi.isend.Robj <- function(obj, dest, tag, comm=1,request=0){ mpi.isend(x=serialize(obj, NULL), type=4, dest=dest, tag=tag, comm=comm,request=request) #invisible(gc()) } mpi.wait <- function(request, status=0) invisible(.Call("mpi_wait", as.integer(request), as.integer(status), PACKAGE = "Rmpi")) mpi.waitany <- function(count, status=0){ #mpi.realloc.request(count) .Call("mpi_waitany", as.integer(count), as.integer(status), PACKAGE = "Rmpi") } mpi.waitall <- function(count){ #mpi.realloc.request(count) #mpi.realloc.status(count) invisible(.Call("mpi_waitall", as.integer(count), PACKAGE = "Rmpi")) } mpi.waitsome <- function(count){ #mpi.realloc.request(count) #mpi.realloc.status(count) tmp<-.Call("mpi_waitsome", as.integer(count), PACKAGE = "Rmpi") if (tmp[1] <0 || tmp[1] > count) return(list(count=tmp[1],indices=NULL)) else return(list(count=tmp[1],indices=tmp[2:(1+tmp[1])])) } mpi.test <- function(request, status=0) as.logical(.Call("mpi_test", as.integer(request), as.integer(status), PACKAGE = "Rmpi")) mpi.testany <- function(count, status=0){ #mpi.realloc.request(count) tmp <-.Call("mpi_testany", as.integer(count), as.integer(status), PACKAGE = "Rmpi") list(index=tmp[1], flag=as.logical(tmp[2])) } mpi.testall <- function(count){ #mpi.realloc.request(count) #mpi.realloc.status(count) as.logical(.Call("mpi_testall", as.integer(count), PACKAGE = "Rmpi")) } mpi.testsome <- function(count){ #mpi.realloc.request(count) #mpi.realloc.status(count) tmp<-.Call("mpi_testsome", as.integer(count), PACKAGE = "Rmpi") if (tmp[1] < 0 || tmp[1] > count) return(list(count=tmp[1],indices=NULL)) else return(list(count=tmp[1],indices=tmp[2:(1+tmp[1])])) } mpi.cancel <- function(request) invisible(.Call("mpi_cancel", as.integer(request), PACKAGE = "Rmpi")) mpi.test.cancelled <- function(status=0) as.logical(.Call("mpi_test_cancelled", as.integer(status), PACKAGE = "Rmpi")) mpi.iprobe <- function(source, tag, comm=1, status=0){ as.logical(.Call("mpi_iprobe", as.integer(source), as.integer(tag), as.integer(comm), as.integer(status), PACKAGE = "Rmpi")) } mpi.realloc.status <- function(newmaxsize) if (newmaxsize > mpi.status.maxsize()) invisible(.Call("mpi_realloc_status", as.integer(newmaxsize), PACKAGE = "Rmpi")) mpi.realloc.request <- function(newmaxsize) if (newmaxsize > mpi.request.maxsize()) invisible(.Call("mpi_realloc_request", as.integer(newmaxsize), PACKAGE = "Rmpi")) mpi.realloc.comm <- function(newmaxsize) if (newmaxsize > mpi.comm.maxsize()) invisible(.Call("mpi_realloc_comm", as.integer(newmaxsize), PACKAGE="Rmpi")) mpi.comm.maxsize <- function() .Call("mpi_comm_maxsize", PACKAGE="Rmpi") mpi.status.maxsize <- function() .Call("mpi_status_maxsize", PACKAGE="Rmpi") mpi.request.maxsize <- function() .Call("mpi_request_maxsize", PACKAGE="Rmpi") .mpi.undefined <- function() .Call("mpi_undefined", PACKAGE="Rmpi") .force.type <- function(x, type){ switch(type, as.integer(x), as.double(x), as.character(x), as.raw(x), as.double(x)) } #.mpi.serialize<- function(obj){ # trans_obj=serialize(obj,NULL) # if ( version$major > 2 || version$minor >= 4.0) # if (getRversion()>="2.4.0") # return(trans_obj) # else # return(charToRaw(trans_obj)) #} #.mpi.unserialize<- function(obj){ # #if ( version$major > 2 || version$minor >= 4.0) # if (getRversion()>="2.4.0") # return(unserialize(obj)) # else # return(unserialize(rawToChar(obj))) # } #mpi.request.get.status <- function(request, status=0){ # as.logical(.Call("mpi_request_get_status", as.integer(request), # as.integer(status), PACKAGE = "Rmpi")) #} Rmpi/R/zzz.R0000644000176000001440000000142212336655704012404 0ustar ripleyusers### Copyright (C) 2002 Hao Yu .onLoad <- function (lib, pkg) { library.dynam("Rmpi", pkg, lib) if (!TRUE) stop("Fail to load Rmpi dynamic library.") if (!is.loaded("mpi_initialize")) stop("Probably Rmpi has been detached. Please quit R.") if(.Call("mpidist",PACKAGE="Rmpi") == 2){ if (length(try(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(!.Call("mpi_initialize",PACKAGE = "Rmpi")) stop("Cannot start MPI_Init(). Exit") } .onUnload <- function(libpath){ if (mpi.comm.size(1)>0) mpi.close.Rslaves() mpi.finalize() library.dynam.unload("Rmpi", libpath) } Rmpi/MD50000644000176000001440000001035012337042621011520 0ustar ripleyusers02682eda4e1865d29d46fbf8be19a7bb *ChangeLog 1f61fab5d20c001d502e808f18ebd95b *DESCRIPTION 26cd4ba8a505043c41e6a157440c1f91 *INDEX 9fdfeb11f7ddba6f3aab9aaa6b1ac5dd *NAMESPACE 31958d10c5ef9ec943b5bb81230b5d73 *R/Rcoll.R 319a9fbcb89c7f079df90653a91906df *R/Rcomm.R 425a3b711818a9e80645fabf893fd408 *R/Rmpi.R 5cf7978e30135dfe0f02f4597b529543 *R/Rng.R 9d285de30e768ef7f03211304bfec8fa *R/Rparutilities.R 6ba239e81c4b8b50f395e74291a6ee3b *R/zzz.R 7b94376ee6365bb3a5d419dab065dd94 *README cb311b30ce8eb7b9a6805b8286eb0911 *cleanup 57d8d8641cbe4f5ed979f523e4174468 *configure 6bc30fc6585570f3916f2695970c0ac6 *configure.ac d41d8cd98f00b204e9800998ecf8427e *configure.win b3c69f9ab90e2beb0330e86a05ec1ba4 *demo/00Index b1afa3600c5de842e0eaba1a342a544f *demo/cslavePI.R dfd1daaaf76dfff565d6e217e53d43e2 *demo/masterslavePI.R d8b05a6bf25ba051cdff8850851d5b68 *demo/simPI.R 2c479f153bf3f3004604c483bec892cd *demo/simplePI.R a88040efd8871365286c242eb1038a73 *demo/slave1PI.R 8f744c42621ce97c2ea511f129a72270 *demo/slave2PI.R d95b48486605c0d1be5e8e310a77f9b1 *inst/CITATION 4569255257bf552a5acafd1151e14570 *inst/MacR64slaves.sh 7504244b7a13957016f01bc474e02b8f *inst/Rprofile cf25051b76102776342a3e9a2ebb78b7 *inst/Rslaves.sh 42926ded1dd77477a3925af67fa6d928 *inst/Rslaves32.cmd c1de4670770465fe025c0fba8129700b *inst/Rslaves64.cmd c684edd92cbfeaabd5906522eea4da8c *inst/cslavePI.c 773cd0867765ece36a135028a7008cc5 *inst/slavedaemon.R 43ff2c13d03967db36c0c89446d7cda8 *man/hosts.Rd cd35af8150da2f3d27b97b79ac1dad83 *man/internal.Rd 7a796415e18e633c11d8995d272cb26e *man/mpi.abort.Rd c9061d5e1d815b79f31b60ee76952bc4 *man/mpi.apply.Rd f9edc0b67e530da62b96aaee42bac1b3 *man/mpi.barrier.Rd a20cf1f92915e05fd76fbffff33225a6 *man/mpi.bcast.Rd 137142c7622f8a5bec4c9e400c4ca27f *man/mpi.bcast.Robj.Rd ffe20743ccac1a39d9678a746c387fc2 *man/mpi.bcast.cmd.Rd 6d96b6740ef6169935cbb20d9531c9e2 *man/mpi.cart.coords.Rd d876db124177b692c2f12e00daa8dfa6 *man/mpi.cart.create.Rd 5a51917023de79cb6ab18a3044d94500 *man/mpi.cart.get.Rd 85b92e081300beb29a21af69f4b5d3ee *man/mpi.cart.rank.Rd 35eef3ef50eb8c24efedfac1c642c5bd *man/mpi.cart.shift.Rd ee746fd7dcede38d1b665837d18326d4 *man/mpi.cartdim.get.Rd 8710837e1c8008d600dba3488e4ebff0 *man/mpi.comm.Rd 66feea7b2438c4d8f51012646258a1e3 *man/mpi.comm.disconnect.Rd c61e71249dabe237fc895f8e72b44073 *man/mpi.comm.free.Rd 16300cc6056e05ae09e611e507eae9d9 *man/mpi.comm.inter.Rd 53b88673748d746a77b2d22d362f58b6 *man/mpi.comm.set.errhandler.Rd 3992dd6768c8bd865c41f2a1b55db4c2 *man/mpi.comm.spawn.Rd a4d25873f286c66e5817e9a271fb0bc7 *man/mpi.const.Rd 2ae0215e1fce797b09d500cf7f323dee *man/mpi.dims.create.Rd e93e6b02a52a3c6bc3af2004bf10c27c *man/mpi.exit.Rd 4b7e136a75d1d8e7c66b1e27e5a0f2ec *man/mpi.finalize.Rd f01f9b78974ead89eb6dee7842b05952 *man/mpi.gather.Rd 33a9928af296fdc4e5eacbaed9da3d0c *man/mpi.gather.Robj.Rd 83d120db2bdb9c2311857978b2b9344d *man/mpi.get.count.Rd 0951c95335527760ebb945ecec113564 *man/mpi.get.processor.name.Rd e285ae6c8304757a2d6426bd33b85a44 *man/mpi.get.sourcetag.Rd 3951acabd9aec61ee37dcfba41261443 *man/mpi.iapply.Rd e0b0366b6118f69da6e70a34bc9b021c *man/mpi.info.Rd 33cb9c08651b12f0261e371cd070c1d7 *man/mpi.intercomm.merge.Rd 3d5619bbc37edb0ad705fdaaed08ea44 *man/mpi.parSim.Rd c6f3015d6ff2187b4041f14003301251 *man/mpi.parapply.Rd 407ac5a61d52ac701f11698487d2fe1d *man/mpi.probe.Rd 077445f2dbf19bda56b267251ce331d3 *man/mpi.realloc.Rd 03ed51fa2112c711c17849bbb175a280 *man/mpi.reduce.Rd be38e88b91a37a2567c24f9b396d8f03 *man/mpi.remote.exec.Rd fc87bc9a1f6c38264e4e834ec2dea20f *man/mpi.scatter.Rd 59b447971c8189a64880d4937b81347d *man/mpi.scatter.Robj.Rd 80b122fb5afc0f520115239feed46713 *man/mpi.send.Rd f1ced254a8365675a50f76f8199b40ae *man/mpi.send.Robj.Rd c303eea703e57b5564f3f02876ae9217 *man/mpi.sendrecv.Rd c1f9ee7a74e349500979a1513962a84d *man/mpi.setup.rng.Rd f4ad91406137910ac38820766d94c2c3 *man/mpi.spawn.Rslaves.Rd 5a1780b7d22a7e02463c843698b248b7 *man/mpi.universe.size.Rd c1574de5df7f60098fcfb0d6ca2a8d5f *man/mpi.wait.Rd 49b3b4f4c92b8436d2b9b218a76696d3 *src/Makevars.in 57ccdfd88ec3f0b075071f06ee5e90dc *src/Makevars.win 1d06c8bdead74ba978e1815c1870af93 *src/Rmpi.c 3ea2f33dd2534ea6ce75f2887e30220f *src/Rmpi.h ded21a3dfaa785898ff038db9b476020 *src/conversion.c 44d4d7a07215b4a1c302388e9b14e9dd *src/internal.c 91fc927781f9741498860e36db79d5d1 *src/msmpi.def Rmpi/README0000644000176000001440000000230012325505366012073 0ustar ripleyusersRmpi is an R package providing an interface to MPI (Message-Passing Interface) API calls with interactive R slave functionalities. Copyright (C) 2014 Hao Yu ****************************************************************************** Rmpi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ****************************************************************************** Rmpi requires R version 2.14.0 or higher, and a MPI distribution on unix platform, Microsoft MPI on windows platform, and OpenMPI on Mac OS. More information can be found at http://www.stats.uwo.ca/faculty/yu/Rmpi Rmpi/DESCRIPTION0000644000176000001440000000077012337042621012723 0ustar ripleyusersPackage: Rmpi Version: 0.6-5 Date: 2014-05-20 Title: Interface (Wrapper) to MPI (Message-Passing Interface) Author: Hao Yu Maintainer: Hao Yu Depends: R (>= 2.15.1) Suggests: parallel Description: Rmpi provides an interface (wrapper) to MPI APIs. It also provides interactive R slave environment. License: GPL (>= 2) URL: http://www.stats.uwo.ca/faculty/yu/Rmpi Packaged: 2014-05-20 14:19:14 UTC; hyu NeedsCompilation: yes Repository: CRAN Date/Publication: 2014-05-21 08:20:01 Rmpi/configure0000755000176000001440000043136512321017770013134 0ustar ripleyusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="DESCRIPTION" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS PKG_LIBS PKG_CPPFLAGS ORTED EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_Rmpi_include with_Rmpi_libpath with_Rmpi_type with_mpi ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. 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 do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --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] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-Rmpi-include=INCLUDE_PATH location of MPI header files --with-Rmpi-libpath=LIB_PATH location of MPI library files --with-Rmpi-type=MPI_TYPE the type of MPI: OPENMPI,LAM,MPICH,MPICH2, or CRAY --with-mpi=LIB_PATH location of top-level MPI directory Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ## One way is to specify both include and lib paths # Check whether --with-Rmpi-include was given. if test "${with_Rmpi_include+set}" = set; then : withval=$with_Rmpi_include; mpi_include_path=$withval fi if test -n "${mpi_include_path}" ; then MPI_INCLUDE_PATH="${mpi_include_path}" if test ! -f "${MPI_INCLUDE_PATH}/mpi.h"; then as_fn_error $? "Value of --with-Rmpi-include does not contain mpi.h" "$LINENO" 5 fi else if test -n "${RMPI_INCLUDE}" ; then MPI_INCLUDE_PATH="${RMPI_INCLUDE}" if test ! -f "${MPI_INCLUDE_PATH}/mpi.h"; then as_fn_error $? "Value of RMPI_INCLUDE does not contain mpi.h" "$LINENO" 5 fi echo "setting mpi include path from RMPI_INCLUDE" fi fi # Check whether --with-Rmpi-libpath was given. if test "${with_Rmpi_libpath+set}" = set; then : withval=$with_Rmpi_libpath; mpi_lib_path=$withval fi if test -n "${mpi_lib_path}" ; then MPI_LIBPATH="${mpi_lib_path}" else if test -n "${RMPI_LIB_PATH}" ; then MPI_LIBPATH="${RMPI_LIB_PATH}" echo "setting mpi lib path from RMPI_LIB_PATH" fi fi if test -n "${MPI_INCLUDE_PATH}" -a -z "${MPI_LIBPATH}" ; then as_fn_error $? "Must specify both the include and lib paths" "$LINENO" 5 fi if test -z "${MPI_INCLUDE_PATH}" -a -n "${MPI_LIBPATH}" ; then as_fn_error $? "Must specify both the include and lib paths" "$LINENO" 5 fi MPITYPE="UNKNOWN" # Check whether --with-Rmpi-type was given. if test "${with_Rmpi_type+set}" = set; then : withval=$with_Rmpi_type; mpi_type=$withval fi if test -n "${mpi_type}" ; then MPITYPE="${mpi_type}" else if test -n "${RMPI_TYPE}" ; then MPITYPE="${RMPI_TYPE}" fi fi if test -z "${MPI_INCLUDE_PATH}" ; then ## another way is to specify MPI_ROOT, perhaps via --with-mpi # Check whether --with-mpi was given. if test "${with_mpi+set}" = set; then : withval=$with_mpi; if test "${withval}" != "no"; then MPI_ROOT=${withval} MPI_INCLUDE_PATH="${MPI_ROOT}/include" LDFLAGS="$LDFLAGS -L${withval}/lib" CPPFLAGS="$CPPFLAGS -I${withval}/include" fi fi CC=`"${R_HOME}/bin/R" CMD config CC` CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; 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_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else 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_prog_CC="${ac_tool_prefix}gcc" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; 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_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else 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_prog_ac_ct_CC="gcc" $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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; 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_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else 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_prog_CC="${ac_tool_prefix}cc" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; 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_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no 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 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $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 if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; 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_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else 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_prog_CC="$ac_tool_prefix$ac_prog" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; 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_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else 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_prog_ac_ct_CC="$ac_prog" $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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "X$CC" = "X" ; then # Our best guess... CC="gcc -std=gnu99" fi if test -z "$MPI_ROOT" ; then for d in /opt/lib /usr/lib /usr /usr/local/lib /usr/local \ /usr/lib64/mpi/gcc/openmpi; do if test -f $d/include/mpi.h && test -d $d/lib/openmpi; then echo "I am here $d and it is 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" MPI_ROOT=$d MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include/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" MPI_ROOT=$d MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include/openmpi break elif test -f $d/openmpi/include/mpi.h && test -d $d/openmpi/lib; then echo "I am here $d/openmpi and it is OpenMPI" MPI_ROOT=$d/openmpi MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include/openmpi break elif test -f $d/include/mpi.h && test -d $d/lib64; then echo "I am here $d and it is OpenMPI" MPI_ROOT=$d MPITYPE="OPENMPI" MPI_INCLUDE_PATH=$d/include break elif test -f $d/lam/include/mpi.h && test -f $d/lam/lib/libmpi.so; then echo "I am here $d/lam and it is LAM" MPI_ROOT=$d/lam MPITYPE="LAM" MPI_INCLUDE_PATH=$d/include/lam break elif test -f $d/include/lam/mpi.h && test -f $d/lib/lam/libmpi.so; then echo "I am here $d and it is LAM" MPI_ROOT=$d MPITYPE="LAM" MPI_INCLUDE_PATH=$d/include/lam break elif test -f $d/include/lam/mpi.h && test -f $d/lib64/lam/libmpi.so; then echo "I am here $d and it is LAM" MPI_ROOT=$d MPITYPE="LAM" MPI_INCLUDE_PATH=$d/include/lam break elif test -f $d/mpich/include/mpi.h; then echo "I am here $d/mpich and it is MPICH" MPI_ROOT=$d/mpich MPITYPE="MPICH" MPI_INCLUDE_PATH=$d/mpich/include break elif test -f $d/mpi/include/mpi.h; then echo "I am here $d/mpi" MPI_ROOT=$d/mpi MPI_INCLUDE_PATH=$d/mpi/include break elif test -f $d/include/mpi.h; then echo "I am here $d" MPI_ROOT=$d break fi done fi if test -n "$MPI_ROOT"; then #guess MPITYPE if it is unknown and user supplies MPI_ROOT if test $MPITYPE = "UNKNOWN" ; then if test -d ${MPI_ROOT}/openmpi; then MPITYPE="OPENMPI" elif test -d ${MPI_ROOT}/lib/openmpi; then MPITYPE="OPENMPI" elif test -d ${MPI_ROOT}/lib64/openmpi; then MPITYPE="OPENMPI" elif test -f ${MPI_ROOT}/lib/liblam.so; then MPITYPE="LAM" elif test -d ${MPI_ROOT}/lib/lam; then MPITYPE="LAM" elif test -d ${MPI_ROOT}/lib64/lam; then MPITYPE="LAM" elif test -f ${MPI_ROOT}/lib/libmpich.a; then MPITYPE="MPICH" elif test -f ${MPI_ROOT}/lib64/libmpich.a; then MPITYPE="MPICH" fi fi echo "Trying to find mpi.h ..." if test -f ${MPI_ROOT}/include/mpi.h; then echo "Found in ${MPI_ROOT}/include" MPI_INCLUDE_PATH="${MPI_ROOT}/include" elif test -f ${MPI_ROOT}/include/openmpi/mpi.h; then echo "Found in ${MPI_ROOT}/include/openmpi" MPI_INCLUDE_PATH="${MPI_ROOT}/include/openmpi" elif test -f ${MPI_ROOT}/include/lam/mpi.h; then echo "Found in ${MPI_ROOT}/include/lam" MPI_INCLUDE_PATH="${MPI_ROOT}/include/lam" else echo "Cannot find mpi.h header file" echo "Please use --with-mpi=/path/to/mpi or specify the environment variable MPI_ROOT" exit 1 fi else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default" if test "x$ac_cv_header_mpi_h" = xyes; then : else as_fn_error $? "\"Cannot find mpi.h header file\"" "$LINENO" 5 fi fi echo "Trying to find libmpi.so or libmpich.a ..." if test -f ${MPI_ROOT}/lib/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib" MPI_LIBPATH="${MPI_ROOT}/lib" elif test -f ${MPI_ROOT}/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}" MPI_LIBPATH="${MPI_ROOT}" elif test -f ${MPI_ROOT}/lib/openmpi/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib/openmpi" MPI_LIBPATH="${MPI_ROOT}/lib/openmpi" elif test -f ${MPI_ROOT}/lib64/openmpi/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib64/openmpi" MPI_LIBPATH="${MPI_ROOT}/lib64/openmpi" elif test -f ${MPI_ROOT}/lib64/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib64" MPI_LIBPATH="${MPI_ROOT}/lib64" elif test -f ${MPI_ROOT}/lib/lam/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib/lam" MPI_LIBPATH="${MPI_ROOT}/lib/lam" MPI_INCL2="-I${MPI_INCLUDE_PATH}/32" elif test -f ${MPI_ROOT}/lib64/lam/libmpi.so; then echo "Found libmpi in ${MPI_ROOT}/lib64/lam" MPI_LIBPATH="${MPI_ROOT}/lib64/lam" MPI_INCL2="-I${MPI_INCLUDE_PATH}/64" elif test -f ${MPI_ROOT}/lib/libmpich.so; then echo "Found libmpich in ${MPI_ROOT}/lib" MPI_LIBPATH="${MPI_ROOT}/lib" ac_fn_c_check_decl "$LINENO" "MPICH2" "ac_cv_have_decl_MPICH2" "#include " if test "x$ac_cv_have_decl_MPICH2" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MPICH2 $ac_have_decl _ACEOF if test $ac_have_decl = 1; then : MPI_DEFS="-DMPI2" fi ac_fn_c_check_decl "$LINENO" "MPICH2" "ac_cv_have_decl_MPICH2" "#include " if test "x$ac_cv_have_decl_MPICH2" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MPICH2 $ac_have_decl _ACEOF if test $ac_have_decl = 1; then : MPI_DEFS="-DMPI2" fi elif test -f ${MPI_ROOT}/lib64/libmpich.a; then echo "Found libmpich in ${MPI_ROOT}/lib64" MPI_LIBPATH="${MPI_ROOT}/lib64" ac_fn_c_check_decl "$LINENO" "MPICH2" "ac_cv_have_decl_MPICH2" "#include " if test "x$ac_cv_have_decl_MPICH2" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MPICH2 $ac_have_decl _ACEOF if test $ac_have_decl = 1; then : MPI_DEFS="-DMPI2" fi ac_fn_c_check_decl "$LINENO" "MPICH2" "ac_cv_have_decl_MPICH2" "#include " if test "x$ac_cv_have_decl_MPICH2" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_MPICH2 $ac_have_decl _ACEOF if test $ac_have_decl = 1; then : MPI_DEFS="-DMPI2" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmpi" >&5 $as_echo_n "checking for main in -lmpi... " >&6; } if ${ac_cv_lib_mpi_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmpi $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mpi_main=yes else ac_cv_lib_mpi_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_main" >&5 $as_echo "$ac_cv_lib_mpi_main" >&6; } if test "x$ac_cv_lib_mpi_main" = xyes; then : MPI_LIBPATH="${MPI_ROOT}/lib" else echo "libmpi not found. exiting..." exit 1 fi fi if test "$MPITYPE" = "OPENMPI" ; then # Extract the first word of "orted", so it can be a program name with args. set dummy orted; 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_prog_ORTED+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ORTED"; then ac_cv_prog_ORTED="$ORTED" # Let the user override the test. else 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_prog_ORTED="yes" $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 test -z "$ac_cv_prog_ORTED" && ac_cv_prog_ORTED="no" fi fi ORTED=$ac_cv_prog_ORTED if test -n "$ORTED"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ORTED" >&5 $as_echo "$ORTED" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$ORTED" = no ; then as_fn_error $? "Cannot find orted. Rmpi needs orted to run." "$LINENO" 5 fi fi if test "$MPITYPE" = "LAM" ; then echo "Try to find liblam.so ..." if test -f ${MPI_ROOT}/lib/liblam.so; then echo "Found liblam in ${MPI_ROOT}/lib" MPI_LIBPATH="${MPI_ROOT}/lib" elif test -f ${MPI_ROOT}/lib/lam/liblam.so; then echo "Found liblam in ${MPI_ROOT}/lib/lam" MPI_LIBPATH="${MPI_ROOT}/lib/lam" elif test -f ${MPI_ROOT}/lib64/lam/liblam.so; then echo "Found liblam in ${MPI_ROOT}/lib64/lam" MPI_LIBPATH="${MPI_ROOT}/lib64/lam" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llam" >&5 $as_echo_n "checking for main in -llam... " >&6; } if ${ac_cv_lib_lam_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llam $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lam_main=yes else ac_cv_lib_lam_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lam_main" >&5 $as_echo "$ac_cv_lib_lam_main" >&6; } if test "x$ac_cv_lib_lam_main" = xyes; then : echo "liblam not found. Probably not LAM-MPI" fi fi fi fi ## now we have found the include and lib paths and may know the type { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } if ${ac_cv_lib_util_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char openpty (); int main () { return openpty (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_util_openpty=yes else ac_cv_lib_util_openpty=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } if test "x$ac_cv_lib_util_openpty" = xyes; then : MPI_LIBS="$MPI_LIBS -lutil" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpthread" >&5 $as_echo_n "checking for main in -lpthread... " >&6; } if ${ac_cv_lib_pthread_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_main=yes else ac_cv_lib_pthread_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_main" >&5 $as_echo "$ac_cv_lib_pthread_main" >&6; } if test "x$ac_cv_lib_pthread_main" = xyes; then : MPI_LIBS="$MPI_LIBS -lpthread" fi if test "$MPITYPE" = "OPENMPI" -o "$MPITYPE" = "LAM" -o "$MPITYPE" = "MPICH2" -o "$MPITYPE" = "INTELMPI" -o "$MPITYPE" = "CRAY"; 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}" ;; MPICH) PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" ;; MPICH2) PKG_LIBS="-L${MPI_LIBPATH} -lmpich -lmpl -lopa ${MPI_LIBS}" ;; INTELMPI) PKG_LIBS="-Wl,-rpath,${MPI_LIBPATH} -L${MPI_LIBPATH} -lmpich -lmpigf -lmpigi ${MPI_LIBS}" ;; CRAY) PKG_LIBS="-L${MPI_LIBPATH} -lmpich_cray_default64 -lmpl -lopa ${MPI_LIBS}" ;; *) as_fn_error $? "Unknown type of mpi: use --with-Rmpi-type or RMPI_TYPE to specify it" "$LINENO" 5 ;; esac ac_config_files="$ac_config_files src/Makevars" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi Rmpi/ChangeLog0000644000176000001440000000007710705664602012775 0ustar ripleyusersCheck at http://www.stats.uwo.ca/faculty/yu/Rmpi/changelogs.htmRmpi/man/0000755000176000001440000000000012202732624011764 5ustar ripleyusersRmpi/man/mpi.exit.Rd0000644000176000001440000000161507476042613014024 0ustar ripleyusers\name{mpi.exit} \alias{mpi.exit} \alias{mpi.quit} \title{Exit MPI Environment } \description{ \code{mpi.exit} terminates MPI execution environment and detaches the library Rmpi. After that, you can still work on R. \code{mpi.quit} terminates MPI execution environment and quits R. } \usage{ mpi.exit() mpi.quit(save = "no") } \arguments{ \item{save}{the same argument as \code{quit} but default to "no".} } \value{ \code{mpi.exit} always returns 1 } \details{ Normally, \code{\link{mpi.finalize}} is used to clean all MPI states. However, it will not detach the library Rmpi. To be more safe leaving MPI, \code{mpi.exit} not only calls \code{mpi.finalize} but also detaches the library Rmpi. This will make reload the library Rmpi impossible. If leaving MPI and R altogether, one simply uses \code{mpi.quit}. } \seealso{ \code{\link{mpi.finalize}} } \author{ Hao Yu } \keyword{utilities} Rmpi/man/mpi.cart.rank.Rd0000644000176000001440000000174112336657543014743 0ustar ripleyusers\name{mpi.cart.rank} \title{MPI\_Cart\_rank} \alias{mpi.cart.rank} \description{ \code{mpi.cart.rank} translates a Cartesian topology coordinate to its rank. } \usage{ mpi.cart.rank(comm=3, coords) } \arguments{ \item{comm}{Communicator with Cartesian structure} \item{coords}{Specifies the Cartesian coordinates of a process} } \value{ \code{mpi.cart.rank} returns the rank of the specified process. } \details{ For a process group with a Cartesian topology, this function translates the logical process coordinates to process ranks as they are used by the point-to-point routines. It is the inverse map of \code{mpi.cart.coords}. } \author{ Alek Hunchak and Hao Yu } \seealso{ \code{\link{mpi.cart.coords}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Need at least 9 slaves mpi.bcast.cmd(mpi.cart.create(1,c(3,3),c(F,T))) mpi.cart.create(1,c(3,3),c(F,T)) mpi.cart.rank(3,c(1,0)) } } \keyword{interface} Rmpi/man/mpi.bcast.Robj.Rd0000644000176000001440000000362212203166624015033 0ustar ripleyusers\name{mpi.bcast.Robj} \title{Extensions of MPI\_Bcast API} \alias{mpi.bcast.Robj} \alias{mpi.bcast.Robj2slave} \alias{mpi.bcast.Rfun2slave} \alias{mpi.bcast.data2slave} \description{ \code{mpi.bcast.Robj} and \code{mpi.bcast.Robj2slave} are used to move a general R object around among master and all slaves. } \usage{ mpi.bcast.Robj(obj = NULL, rank = 0, comm = 1) mpi.bcast.Robj2slave(obj, comm = 1, all = FALSE) mpi.bcast.Rfun2slave(comm = 1) mpi.bcast.data2slave(obj, comm = 1, buffunit = 100) } \arguments{ \item{obj}{an R object to be transmitted from the sender} \item{rank}{the sender.} \item{comm}{a communicator number.} \item{all}{a logical. If TRUE, all R objects on master are transmitted to slaves.} \item{buffunit}{a buffer unit number.} } \value{ \code{mpi.bcast.Robj} returns no value for the sender and the transmitted one for others. \code{mpi.bcast.Robj2slave} returns no value for the master and the transmitted R object along its name on slaves. \code{mpi.bcast.Rfun2slave} transmits all master's functions to slaves and returns no value. \code{mpi.bcast.data2slave} transmits a double vector or a matrix to slaves and returns no value. } \details{ \code{mpi.bcast.Robj} is an extension of \code{\link{mpi.bcast}} for moving a general R object around from a sender to everyone. \code{mpi.bcast.Robj2slave} does an R object transmission from master to all slaves unless all=TRUE in which case, all master's objects with the global enviroment are transmitted to all slavers. \code{mpi.bcast.data2slave} transfers data (a double vector or a matrix) natively without (un)serilization. It should be used with a huge vector or matrix. It results less memory usage and faster transmission. Notice that data with missing values (NA) are allowed. } \author{ Hao Yu } \seealso{ \code{\link{mpi.send.Robj}}, \code{\link{mpi.recv.Robj}}, } %\examples{ %} \keyword{utilities} Rmpi/man/mpi.parSim.Rd0000644000176000001440000001121512012306626014270 0ustar ripleyusers\name{mpi.parSim} \alias{mpi.parSim} \title{Parallel Monte Carlo Simulation} \description{ Carry out parallel Monte Carlo simulation on R slaves spawned by using slavedaemon.R script and all executed results are returned back to master. } \usage{ mpi.parSim(n=100, rand.gen=rnorm, rand.arg=NULL,statistic, nsim=100, run=1, slaveinfo=FALSE, sim.seq=NULL, simplify=TRUE, comm=1, ...) } \arguments{ \item{n}{sample size.} \item{rand.gen}{the random data generating function. See the details section} \item{rand.arg}{additional argument list to \code{rand.gen}.} \item{statistic}{the statistic function to be simulated. See the details section} \item{nsim}{the number of simulation carried on a slave which is counted as one slave job.} \item{run}{the number of looping. See the details section.} \item{slaveinfo}{if TRUE, the numbers of jobs finished by slaves will be displayed.} \item{sim.seq}{if reproducing the same simulation is desirable, set it to the integer vector .mpi.parSim generated in previous simulation.} \item{simplify}{logical; should the result be simplified to a vector or matrix if possible?} \item{comm}{a communicator number} \item{...}{optional arguments to \code{statistic}} } \value{ The returned values depend on values returned by \code{\link{replicate}} of \code{statistic(rand.gen(n))} and the total number of simulation (TNS). If \code{statistic} returns a single value, then the result is a vector of length TNS. If \code{statistic} returns a vector (list) of length \code{nrow}, then the result is a matrix of dimension \code{c(nrow, TNS)}. } \details{ It is assumed that one simulation is carried out as \code{statistic(rand.gen(n))}, where \code{rand.gen(n)} can return any values as long as \code{statistic} can take them. Additional arguments can be passed to \code{rand.gen} by \code{rand.arg} as a list. Optional arguments can also be passed to \code{statistic} by the argument \code{...}. Each slave job consists of \code{replicate(nsim,statistic(rand.gen(n)))}, i.e., each job runs \code{nsim} number of simulation. The returned values are transported from slaves to master. The total number of simulation (TNS) is calculated as follows. Let slave.num be the total number of slaves in a \code{comm} and it is \code{mpi.comm.size(comm)-1}. Then TNS=slave.num*nsim*run and the total number of slave jobs is slave.num*run, where \code{run} is the number of looping from master perspective. If run=1, each slave will run one slave job. If run=2, each slave will run two slaves jobs on average, and so on. The purpose of using \code{run} has two folds. It allows a tuneup of slave job size and total number of slave jobs to deal with two different cluster environments. On a cluster of slaves with equal CPU power, \code{run=1} is often enough. But if \code{nsim} is too big, one can set \code{run=2} and the slave jog size to be \code{nsim/2} so that TNS=slave.num*(nsim/2)*(2*run). This may improve R computation efficiency slightly. On a cluster of slaves with different CPU power, one can choose a big value of \code{run} and a small value of \code{nsim} so that master can dispatch more jobs to slaves who run faster than others. This will keep all slaves busy so that load balancing is achieved. The sequence of slaves who deliver results to master are saved into \code{.mpi.parSim}. It keeps track which part of results done by which slaves. \code{.mpi.parSim} can be used to reproduce the same simulation result if the same seed is used and the argument \code{sim.seq} is equal to \code{.mpi.parSim}. See the warning section before you use \code{mpi.parSim}. } \section{Warning}{ It is assumed that a parallel RNG is used on all slaves. Run \code{mpi.setup.rngstream} on the master to set up a parallel RNG. Though \code{mpi.parSim} works without a parallel RNG, the quality of simulation is not guarantied. \code{mpi.parSim} will automatically transfer \code{rand.gen} and \code{statistic} to slaves. However, any functions that \code{rand.gen} and \code{statistic} reply on but are not on slaves must be transfered to slaves before using \code{mpi.parSim}. You can use \code{\link{mpi.bcast.Robj2slave}} for that purpose. The same is applied to required packages or C/Fortran codes. You can use either \code{\link{mpi.bcast.cmd}} or put \code{required(package)} and/or \code{dyn.load(so.lib)} into \code{rand.gen} and \code{statistic}. If \code{simplify} is TRUE, sapply style simplication is applied. Otherwise a list of length slave.num*run is returned.} \seealso{ \code{\link{mpi.setup.rngstream}} \code{\link{mpi.bcast.cmd}} \code{\link{mpi.bcast.Robj2slave}} } \author{ Hao Yu } \keyword{utilities} Rmpi/man/mpi.parapply.Rd0000644000176000001440000000756412336660460014711 0ustar ripleyusers\name{mpi.applyLB} \alias{mpi.applyLB} \alias{mpi.parApply} \alias{mpi.parLapply} \alias{mpi.parSapply} \alias{mpi.parRapply} \alias{mpi.parCapply} \alias{mpi.parReplicate} \alias{mpi.parMM} \title{(Load balancing) parallel apply} \description{ (Load balancing) parallel\code{lapply} and related functions. } \usage{ mpi.applyLB(X, FUN, ..., apply.seq=NULL, comm=1) mpi.parApply(X, MARGIN, FUN, ..., job.num = mpi.comm.size(comm)-1, apply.seq=NULL, comm=1) mpi.parLapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1) mpi.parSapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify=TRUE, USE.NAMES = TRUE, comm=1) mpi.parRapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1) mpi.parCapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1) mpi.parReplicate(n, expr, job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, comm=1) mpi.parMM (A, B, job.num=mpi.comm.size(comm)-1, comm=1) } \arguments{ \item{X}{an array or matrix.} \item{MARGIN}{vector specifying the dimensions to use.} \item{FUN}{a function.} \item{simplify}{logical; should the result be simplified to a vector or matrix if possible?} \item{USE.NAMES}{logical; if \code{TRUE} and if \code{X} is character, use \code{X} as \code{names} for the result unless it had names already.} \item{n}{number of replications.} \item{A}{a matrix} \item{B}{a matrix} \item{expr}{expression to evaluate repeatedly.} \item{job.num}{Total job numbers. If job numbers is bigger than total slave numbers (default value), a load balancing approach is used.} \item{apply.seq}{if reproducing the same computation (simulation) is desirable, set it to the integer vector .mpi.applyLB generated in previous computation (simulation).} \item{...}{optional arguments to \code{FUN}} \item{comm}{a communicator number} } \details{ Unless length of \code{X} is no more than total slave numbers (slave.num) and in this case \code{mpi.applyLB} is the same as \code{mpi.apply}, \code{mpi.applyLB} sends a next job to a slave who just delivered a finished job. The sequence of slaves who deliver results to master are saved into \code{.mpi.applyLB}. It keeps track which part of results done by which slaves. \code{.mpi.applyLB} can be used to reproduce the same simulation result if the same seed is used and the argument \code{apply.seq} is equal to \code{.mpi.applyLB}. With the default value of argument \code{job.num} which is slave.num, \code{mpi.parApply}, \code{mpi.parLapply}, \code{mpi.parSapply}, \code{mpi.parRapply}, \code{mpi.parCapply}, \code{mpi.parSapply}, and \code{mpi.parMM} are clones of \pkg{snow}'s parApply, parLappy, parSapply, parRapply, parCapply, parSapply, and parMM, respectively. When \code{job.num} is bigger than slave.num, a load balancing approach is used. } \section{Warning}{ When using the argument \code{apply.seq} with \code{.mpi.applyLB}, be sure all settings are the same as before, i.e., the same data, job.num, slave.num, and seed. Otherwise a deadlock could occur. Notice that \code{apply.seq} is useful only if \code{job.num} is bigger than slave.num. } \seealso{ \code{\link{mpi.apply}} } \examples{ \donttest{ #Assume that there are some slaves running #mpi.applyLB x=1:7 mpi.applyLB(x,rnorm,mean=2,sd=4) #get the same simulation mpi.remote.exec(set.seed(111)) mpi.applyLB(x,rnorm,mean=2,sd=4) mpi.remote.exec(set.seed(111)) mpi.applyLB(x,rnorm,mean=2,sd=4,apply.seq=.mpi.applyLB) #mpi.parApply x=1:24 dim(x)=c(2,3,4) mpi.parApply(x, MARGIN=c(1,2), FUN=mean,job.num = 5) #mpi.parLapply mdat <- matrix(c(1,2,3, 7,8,9), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("R.1", "R.2"), c("C.1", "C.2", "C.3"))) mpi.parLapply(mdat, rnorm) #mpi.parSapply mpi.parSapply(mdat, rnorm) #mpi.parMM A=matrix(1:1000^2,ncol=1000) mpi.parMM(A,A) } } \keyword{utilities} Rmpi/man/mpi.universe.size.Rd0000644000176000001440000000070207476043410015654 0ustar ripleyusers\name{mpi.universe.size} \title{MPI\_Universe\_size API} \usage{ mpi.universe.size() } \alias{mpi.universe.size} \arguments{ None. } \description{ \code{mpi.universe.size} returns the total number of CPUs available in a cluster. Some MPI implements may not have this MPI call available. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.gather.Robj.Rd0000644000176000001440000000337012336660276015222 0ustar ripleyusers\name{mpi.gather.Robj} \title{Extentions of MPI\_Gather and MPI\_Allgather APIs} \alias{mpi.gather.Robj} \alias{mpi.allgather.Robj} \description{ \code{mpi.gather.Robj} gathers each member's object to the member specified by the argument \code{root}. The root member receives the objects as a list. \code{mpi.allgather.Robj} is the same as \code{mpi.gather.Robj} except that all members receive the result instead of just the root. } \usage{ mpi.gather.Robj(obj=NULL, root = 0, comm = 1, ...) mpi.allgather.Robj(obj=NULL, comm = 1) } \arguments{ \item{obj}{data to be gathered. Could be different type.} \item{root}{rank of the gather} \item{comm}{a communicator number} \item{...}{optional arugments to \code{sapply}.} } \details{ Since sapply is used to gather all results, its default option "simplify=TRUE" is to simplify outputs. In some situations, this option is not desirable. Using "simplify=FALSE" as in the place of ... will tell sapply not to simplify and a list of outputs will be returned. } \value{ For \code{mpi.gather.Robj}, it returns a list, the gathered message for the root member. For \code{mpi.allgatherv.Robj}, it returns a list, the gathered message for all members. } \author{ Hao Yu and Wei Xia } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.gather}}, \code{\link{mpi.allgatherv}}. } \examples{ \donttest{ #Assume that there are some slaves running mpi.bcast.cmd(id<-mpi.comm.rank()) mpi.bcast.cmd(x<-rnorm(id)) mpi.bcast.cmd(mpi.gather.Robj(x)) x<-"test mpi.gather.Robj" mpi.gather.Robj(x) mpi.bcast.cmd(obj<-rnorm(id+10)) mpi.bcast.cmd(nn<-mpi.allgather.Robj(obj)) obj<-rnorm(5) mpi.allgather.Robj(obj) mpi.remote.exec(nn) } } \keyword{interface} Rmpi/man/mpi.scatter.Robj.Rd0000644000176000001440000000323312336660670015411 0ustar ripleyusers\name{mpi.scatter.Robj} \title{Extensions of MPI\_ SCATTER and MPI\_SCATTERV } \alias{mpi.scatter.Robj} \alias{mpi.scatter.Robj2slave} \description{ \code{mpi.scatter.Robj} and \code{mpi.scatter.Robj2slave} are used to scatter a list to all members. They are more efficient than using any parallel apply functions. } \usage{ mpi.scatter.Robj(obj = NULL, root = 0, comm = 1) mpi.scatter.Robj2slave(obj, comm = 1) } \arguments{ \item{obj}{a list object to be scattered from the root or master} \item{root}{rank of the scatter.} \item{comm}{a communicator number.} } \value{ \code{mpi.scatter.Robj} for non-root members, returns the scattered R object. For the root member, it returns the portion belonging to itself. \code{mpi.scatter.Robj2slave} returns no value for the master and all slaves get their corresponding components in the list, i.e., the first slave gets the first component in the list. } \details{ \code{mpi.scatter.Robj} is an extension of \code{\link{mpi.scatter}} for scattering a list object from a sender (root) to everyone. \code{mpi.scatter.Robj2slave} scatters a list to all slaves. } \author{ Hao Yu and Wei Xia } \seealso{ \code{\link{mpi.scatter}}, \code{\link{mpi.gather.Robj}}, } \examples{ \donttest{ #assume that there are three slaves running mpi.bcast.cmd(x<-mpi.scatter.Robj()) xx <- list("master",rnorm(3),letters[2],1:10) mpi.scatter.Robj(obj=xx) mpi.remote.exec(x) #scatter a matrix to slaves dat=matrix(1:24,ncol=3) splitmatrix = function(x, ncl) lapply(.splitIndices(nrow(x), ncl), function(i) x[i,]) dat2=splitmatrix(dat,3) mpi.scatter.Robj2slave(dat2) mpi.remote.exec(dat2) } } \keyword{utilities} Rmpi/man/mpi.send.Rd0000644000176000001440000000714112336660712014001 0ustar ripleyusers\name{mpi.send} \title{MPI\_Send, MPI\_Isend, MPI\_Recv, and MPI\_Irecv APIs} \alias{mpi.send} \alias{mpi.isend} \alias{mpi.recv} \alias{mpi.irecv} \description{ The pair \code{mpi.send} and \code{mpi.recv} are two most used blocking calls for point-to-point communications. An int, double or char vector can be transmitted from any source to any destination. The pair \code{mpi.isend} and \code{mpi.irecv} are the same except that they are nonblocking calls. Blocking and nonblocking calls are interchangeable, e.g., nonblocking sends can be matched with blocking receives, and vice-versa. } \usage{ mpi.send(x, type, dest, tag, comm = 1) mpi.isend(x, type, dest, tag, comm = 1, request=0) mpi.recv(x, type, source, tag, comm = 1, status = 0) mpi.irecv(x, type, source, tag, comm = 1, request = 0) } \arguments{ \item{x}{data to be sent or received. Must be the same type for source and destination. The receive buffer must be as large as the send buffer.} \item{type}{1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{dest}{the destination rank. Use \code{mpi.proc.null} for a fake destination.} \item{source}{the source rank. Use \code{mpi.any.source} for any source. Use \code{mpi.proc.null} for a fake source. } \item{tag}{non-negative integer. Use \code{mpi.any.tag} for any tag flag.} \item{comm}{a communicator number.} \item{request}{a request number.} \item{status}{a status number.} } \value{ \code{mpi.send} and \code{mpi.isend} return no value. \code{mpi.recv} returns the int, double or char vector sent from \code{source}. However, \code{mpi.irecv} returns no value. See details for explanation. } \details{ The pair \code{mpi.send} (or \code{mpi.isend}) and \code{mpi.recv} (or \code{mpi.irecv}) must be used together, i.e., if there is a sender, then there must be a receiver. Any mismatch will result a deadlock situation, i.e., programs stop responding. The receive buffer must be large enough to contain an incoming message otherwise programs will be crashed. One can use \code{\link{mpi.probe}} (or \link{mpi.iprobe}) and \code{\link{mpi.get.count}} to find the length of an incoming message before calling \code{mpi.recv}. If \code{\link{mpi.any.source}} or \code{\link{mpi.any.tag}} is used in \code{mpi.recv}, one can use \code{\link{mpi.get.sourcetag}} to find out the source or tag of the received message. To send/receive an R object rather than an int, double or char vector, please use the pair \code{\link{mpi.send.Robj}} and \code{\link{mpi.recv.Robj}}. Since \code{mpi.irecv} is a nonblocking call, \code{x} with enough buffer must be created before using it. Then use nonblocking completion calls such as \code{\link{mpi.wait}} or \code{\link{mpi.test}} to test if \code{x} contains data from sender. If multiple nonblocking sends or receives are used, please use request number consecutively from 0. For example, to receive two messages from two slaves, try mpi.irecv(x,1,source=1,tag=0,comm=1,request=0) mpi.irecv(y,1,source=2,tag=0,comm=1,request=1) Then \code{mpi.waitany}, \code{mpi.waitsome} or \code{mpi.waitall} can be used to complete the operations. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.send.Robj}}, \code{\link{mpi.recv.Robj}}, \code{\link{mpi.probe}}, \code{\link{mpi.wait}}, \code{\link{mpi.get.count}}, \code{\link{mpi.get.sourcetag}}. } \examples{ \donttest{ #on a slave mpi.send(1:10,1,0,0) #on master x <- integer(10) mpi.irecv(x,1,1,0) x mpi.wait() x } } \keyword{interface} Rmpi/man/mpi.get.processor.name.Rd0000644000176000001440000000102107476042730016556 0ustar ripleyusers\name{mpi.get.processor.name} \title{MPI\_Get\_processor\_name API} \usage{ mpi.get.processor.name(short = TRUE) } \alias{mpi.get.processor.name} \arguments{ \item{short}{a logical.} } \description{ \code{mpi.get.processor.name} returns the host name (a string) where it is executed. } \value{ a base host name if \code{short = TRUE} and a full host name otherwise. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.comm.spawn.Rd0000644000176000001440000000303212007014442015111 0ustar ripleyusers\name{mpi.comm.spawn} \alias{mpi.comm.spawn} \title{MPI\_Comm\_spawn API } \description{ \code{mpi.comm.spawn} tries to start \code{nslaves} identical copies of \code{slaves}, establishing communication with them and returning an intercommunicator. The spawned slaves are referred to as children, and the process that spawned them is called the parent (master). The children have their own MPI\_COMM\_WORLD represented by comm 0. To make communication possible among master and slaves, all slaves should use \code{\link{mpi.comm.get.parent}} to find their parent and use \code{\link{mpi.intercomm.merge}} to merger an intercomm to a comm. } \usage{ mpi.comm.spawn(slave, slavearg = character(0), nslaves = mpi.universe.size(), info = 0, root = 0, intercomm = 2, quiet = FALSE) } \arguments{ \item{slave}{a file name to an executable program.} \item{slavearg}{an argument list (a char vector) to slave.} \item{nslaves}{number of slaves to be spawned.} \item{info}{an info number.} \item{root}{the root member who spawns slaves.} \item{intercomm}{an intercomm number.} \item{quiet}{a logical. If TRUE, do not print anything unless an error occurs.} } \value{ Unless \code{quiet = TRUE}, a message is printed to indicate how many slaves are successfully spawned and how many failed. } \seealso{ \code{\link{mpi.comm.get.parent}}, \code{\link{mpi.intercomm.merge}}. } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \author{ Hao Yu } \keyword{interface} Rmpi/man/mpi.comm.inter.Rd0000644000176000001440000000216207734633741015131 0ustar ripleyusers\name{mpi.comm.get.parent} \title{MPI\_Comm\_get\_parent, MPI\_Comm\_remote\_size, MPI\_Comm\_test\_inter APIs} \usage{ mpi.comm.get.parent(comm = 2) mpi.comm.remote.size(comm = 2) mpi.comm.test.inter(comm = 2) } \alias{mpi.comm.get.parent} \alias{mpi.comm.remote.size} \alias{mpi.comm.test.inter} \arguments{ \item{comm}{an intercommunicator number.} } \description{ \code{mpi.comm.get.parent} is mainly used by slaves to find the intercommunicator or the parent who spawns them. The intercommunicator is saved in the specified comm number. \code{mpi.comm.remote.size} is mainly used by master to find the total number of slaves spawned. \code{mpi.comm.test.inter} tests if a comm is an intercomm or not. } \value{ \code{mpi.comm.get.parent} and \code{mpi.comm.test.inter} return 1 if success and 0 otherwise. \code{mpi.comm.remote.size} returns the total number of members in the remote group in an intercomm. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.intercomm.merge}} } %\examples{ %} \keyword{interface} Rmpi/man/internal.Rd0000644000176000001440000000110212012240735014055 0ustar ripleyusers\name{string} \alias{string} \alias{mpi.comm.is.null} \title{Internal functions} \description{ Internal functions used by other MPI functions. \code{mpi.comm.is.null} is used to test if a comm is MPI\_COMM\_NULL (empty members). \code{string} create a string (empty space character) buffer. } \usage{ mpi.comm.is.null(comm) string(length) } \arguments{ \item{comm}{a communicator number.} \item{length}{length of a string.} } \value{ \code{string} returns an empty character string. } \seealso{ \code{\link{mpi.spawn.Rslaves}} } \author{ Hao Yu } \keyword{utilities} Rmpi/man/mpi.cart.get.Rd0000644000176000001440000000202112336657522014554 0ustar ripleyusers\name{mpi.cart.get} \title{MPI\_Cart\_get} \alias{mpi.cart.get} \description{ \code{mpi.cart.get} provides the user with information on the Cartesian topology associated with a comm. } \usage{ mpi.cart.get(comm=3, maxdims) } \arguments{ \item{comm}{Communicator with Cartesian structure} \item{maxdims}{length of vectors dims, periods, and coords in the calling program} } \value{ \code{mpi.cart.get} returns a vector containing information on the Cartesian topology associated with comm. maxdims must be at least ndims as returned by \code{mpi.cartdim.get}. } \details{ The coords are as given for the rank of the calling process as shown. } \author{ Alek Hunchak and Hao Yu } \seealso{ \code{\link{mpi.cart.create},\link{mpi.cartdim.get}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Need at least 9 slaves mpi.bcast.cmd(mpi.cart.create(1,c(3,3),c(F,T))) mpi.cart.create(1,c(3,3),c(F,T)) mpi.remote.exec(mpi.cart.get(3,2)) } } \keyword{interface} Rmpi/man/mpi.wait.Rd0000644000176000001440000000736210350204326014006 0ustar ripleyusers\name{mpi.wait} \title{Nonblocking completion operations} \alias{mpi.cancel} \alias{mpi.test.cancelled} \alias{mpi.test} \alias{mpi.testall} \alias{mpi.testany} \alias{mpi.testsome} \alias{mpi.wait} \alias{mpi.waitall} \alias{mpi.waitany} \alias{mpi.waitsome} \description{ \code{mpi.cancel} cancels a nonblocking send or receive request. \code{mpi.test.cancelled} tests if \code{mpi.cancel} cancels or not. \code{wait}, \code{waitall}, \code{waitany}, and \code{waitsome} are used to complete nonblocking send or receive requests. They are not local. \code{test}, \code{testall}, \code{testany}, and \code{testsome} are used to complete nonblocking send and receive requests. They are local. } \usage{ mpi.cancel(request) mpi.test.cancelled(status=0) mpi.test(request, status=0) mpi.testall(count) mpi.testany(count, status=0) mpi.testsome(count) mpi.wait(request, status=0) mpi.waitall(count) mpi.waitany(count, status=0) mpi.waitsome(count) } \arguments{ \item{count}{total number of nonblocking operations.} \item{request}{a request number.} \item{status}{a status number.} } \value{ \code{mpi.cancel} returns no value. \code{mpi.test.cancelled} returns TRUE if a nonblocking call is cancelled; FALSE otherwise. \code{mpi.wait} returns no value. Instead status contains information that can be retrieved by \code{mpi.get.count} and \code{mpi.get.sourcetag}. \code{mpi.test} returns TRUE if a request is complete; FALSE otherwise. If TRUE, it is the same as \code{mpi.wait}. \code{mpi.waitany} returns which request (index) has been completed. In addition, status contains information that can be retrieved by \code{mpi.get.count} and \code{mpi.get.sourcetag}. \code{mpi.testany} returns a list: index--- request index; flag---TRUE if a request is complete; FALSE otherwise (index is no use in this case). If flag is TRUE, it is the same as \code{mpi.waitany}. \code{mpi.waitall} returns no value. Instead statuses 0, 1, ..., count-1 contain corresponding information that can be retrieved by \code{mpi.get.count} and \code{mpi.get.sourcetag}. \code{mpi.testall} returns TRUE if all requests are complete; FALSE otherwise. If TRUE, it is the same as \code{mpi.waitall}. \code{mpi.waitsome} returns a list: count--- number of requests that have been completed; indices---an integer vector of size \$count of those completed request numbers (in 0, 1 ,..., count-1). In addition, statuses 0, 1, ..., \$count-1 contain corresponding information that can be retrieved by \code{mpi.get.count} and \code{mpi.get.sourcetag}. \code{mpi.testsome} is the same as \code{mpi.waitsome} except that \$count may be 0 and in this case \$indices is no use. } \details{ \code{mpi.wait} and \code{mpi.test} are used to complete a nonblocking send and receive request: use the same request number by \code{mpi.isend} or \code{mpi.irecv}. Once completed, the associated request is set to MPI\_REQUEST\_NULL and status contains information such as source, tag, and length of message. If multiple nonblocking sends or receives are initiated, the following calls are more efficient. Make sure that request numbers are used consecutively as request=0, request=1, request=2, etc. In this way, the following calls can find request information in system memory. \code{mpi.waitany} and \code{mpi.testany} are used to complete one out of several requests. \code{mpi.waitall} and \code{mpi.testall} are used to complete all requests. \code{mpi.waitsome} and \code{mpi.testsome} are used to complete all enabled requests. } \author{ Hao Yu } \seealso{ \code{\link{mpi.isend}}, \code{\link{mpi.irecv}}, \code{\link{mpi.get.count}}, \code{\link{mpi.get.sourcetag}}. } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.comm.Rd0000644000176000001440000000231512336657721014007 0ustar ripleyusers\name{mpi.comm.size} \title{MPI\_Comm\_c2f, MPI\_Comm\_dup, MPI\_Comm\_rank, and MPI\_Comm\_size APIs} \usage{ mpi.comm.c2f(comm=1) mpi.comm.dup(comm, newcomm) mpi.comm.rank(comm = 1) mpi.comm.size(comm = 1) } \alias{mpi.comm.c2f} \alias{mpi.comm.dup} \alias{mpi.comm.rank} \alias{mpi.comm.size} \arguments{ \item{comm}{a communicator number} \item{newcomm}{a new communicator number} } \description{ \code{mpi.comm.c2f} converts the comm (a C communicator) and returns an integer that can be used as the communicator in external FORTRAN code. \code{mpi.comm.dup} duplicates (copies) a comm to a new comm. \code{mpi.comm.rank} returns its rank in a comm. \code{mpi.comm.size} returns the total number of members in a comm. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Assume that there are some slaves running mpi.comm.size(comm=1) mpi.comm.size(comm=0) mpi.remote.exec(mpi.comm.rank(comm=1)) mpi.remote.exec(mpi.comm.rank(comm=0)) mpi.remote.exec(mpi.comm.size(comm=1)) mpi.remote.exec(mpi.comm.size(comm=0)) mpi.bcast.cmd(mpi.comm.dup(comm=1,newcomm=5)) mpi.comm.dup(comm=1,newcomm=5) } } \keyword{interface} Rmpi/man/mpi.remote.exec.Rd0000644000176000001440000000332312336660570015266 0ustar ripleyusers\name{mpi.remote.exec} \alias{mpi.remote.exec} \title{Remote Executions on R slaves} \description{ Remotely execute a command on R slaves spawned by using slavedaemon.R script and return all executed results back to master. } \usage{ mpi.remote.exec(cmd, ..., simplify = TRUE, comm = 1, ret = TRUE) } \arguments{ \item{cmd}{the command to be executed on R slaves} \item{...}{used as arguments to cmd (function command) for passing their (master) values to R slaves, i.e., if `myfun(x)' will be executed on R slaves with `x' as master variable, use mpi.remote.exec(cmd=myfun, x).} \item{simplify}{logical; should the result be simplified to a data.frame if possible?} \item{comm}{a communicator number.} \item{ret}{return executed results from R slaves if TRUE.} } \value{ return executed results from R slaves if the argument \code{ret} is set to be TRUE. The value could be a data.frame if values (integer or double) from each slave have the same dimension. Otherwise a list is returned.} \details{ Once R slaves are spawned by \code{\link{mpi.spawn.Rslaves}} with the slavedaemon.R script, they are waiting for instructions from master. One can use \code{\link{mpi.bcast.cmd}} to send a command to R slaves. However it will not return executed results. Hence \code{mpi.remote.exec} can be considered an extension to \code{\link{mpi.bcast.cmd}}. } \section{Warning}{ \code{mpi.remote.exec} may have difficult guessing invisible results on R slaves. Use \code{ret = FALSE} instead. } \seealso{ \code{\link{mpi.spawn.Rslaves}}, \code{\link{mpi.bcast.cmd}} } \author{ Hao Yu } \examples{ \donttest{ mpi.remote.exec(mpi.comm.rank()) x=5 mpi.remote.exec(rnorm,x) } } \keyword{utilities} Rmpi/man/mpi.abort.Rd0000644000176000001440000000072107476042167014163 0ustar ripleyusers\name{mpi.abort} \title{MPI\_Abort API} \usage{ mpi.abort(comm = 1) } \alias{mpi.abort} \arguments{ \item{comm}{a communicator number} } \description{ \code{mpi.abort} makes a ``best attempt" to abort all tasks in a comm. } \value{ 1 if success. Otherwise 0. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.finalize}} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.get.count.Rd0000644000176000001440000000174107476042714014763 0ustar ripleyusers\name{mpi.get.count} \title{MPI\_Get\_count API} \usage{ mpi.get.count(type, status = 0) } \alias{mpi.get.count} \arguments{ \item{type}{1 for integer, 2 for double, 3 for char.} \item{status}{a status number} } \description{ \code{mpi.get.count} finds the length of a received message. } \details{ When \code{\link{mpi.recv}} is used to receive a message, the receiver buffer can be set to be bigger than the incoming message. To find the exact length of the received message, \code{mpi.get.count} is used to find its exact length. \code{mpi.get.count} must be called immediately after calling \code{mpi.recv} otherwise the status may be changed. } \value{ the length of a received message. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.send}}, \code{\link{mpi.recv}}, \code{\link{mpi.get.sourcetag}}, \code{\link{mpi.probe}}. } %\examples{ %} \keyword{interface} Rmpi/man/mpi.barrier.Rd0000644000176000001440000000066007476042213014474 0ustar ripleyusers\name{mpi.barrier} \title{MPI\_Barrier API} \usage{ mpi.barrier(comm = 1) } \alias{mpi.barrier} \arguments{ \item{comm}{a communicator number} } \description{ \code{mpi.barrier} blocks the caller until all members have called it. } \value{ 1 if success. Otherwise 0. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.cart.coords.Rd0000644000176000001440000000203412336657413015271 0ustar ripleyusers\name{mpi.cart.coords} \title{MPI\_Cart\_coords} \alias{mpi.cart.coords} \description{ \code{mpi.cart.coords} translates a rank to its Cartesian topology coordinate. } \usage{mpi.cart.coords(comm=3, rank, maxdims) } \arguments{ \item{comm}{Communicator with Cartesian structure} \item{rank}{rank of a process within group} \item{maxdims}{length of vector coord in the calling program} } \value{ \code{mpi.cart.coords} returns an integer array containing the Cartesian coordinates of specified process. } \details{ This function is the rank-to-coordinates translator. It is the inverse map of \code{mpi.cart.rank}. maxdims is at least as big as ndims as returned by \code{mpi.cartdim.get}. } \author{ Alek Hunchak and Hao Yu } \seealso{ \code{\link{mpi.cart.rank}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Need at least 9 slaves mpi.bcast.cmd(mpi.cart.create(1,c(3,3),c(F,T))) mpi.cart.create(1,c(3,3),c(F,T)) mpi.cart.coords(3,4,2) } } \keyword{interface} Rmpi/man/mpi.comm.free.Rd0000644000176000001440000000147607476042372014735 0ustar ripleyusers\name{mpi.comm.free} \title{MPI\_Comm\_free API} \usage{ mpi.comm.free(comm=1) } \alias{mpi.comm.free} \arguments{ \item{comm}{a communicator number} } \description{ \code{mpi.comm.free} deallocates a communicator so it points to MPI\_COMM\_NULL. } \details{ When members associated with a communicator finish jobs or exit, they have to call \code{mpi.comm.free} to release resource so \code{\link{mpi.comm.size}} will return 0. If the comm was created from an intercommunicator by \code{\link{mpi.intercomm.merge}}, use \code{\link{mpi.comm.disconnect}} instead. } \value{ 1 if success. Otherwise 0. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.comm.disconnect}} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.realloc.Rd0000644000176000001440000000256510350154275014472 0ustar ripleyusers\name{mpi.realloc} \title{Find and increase the lengthes of MPI opaques comm, request, and status} \alias{mpi.comm.maxsize} \alias{mpi.request.maxsize} \alias{mpi.status.maxsize} \alias{mpi.realloc.comm} \alias{mpi.realloc.request} \alias{mpi.realloc.status} \description{ \code{mpi.comm.maxsize}, \code{mpi.request.maxsize}, and \code{mpi.status.maxsize} find the lengthes of comm, request, and status arrayes respectively. \code{mpi.realloc.comm}, \code{mpi.realloc.request} and \code{mpi.realloc.status} increase the lengthes of comm, request and status arrayes to \code{newmaxsize} respectively if \code{newmaxsize} is bigger than the original maximum size. } \usage{ mpi.realloc.comm(newmaxsize) mpi.realloc.request(newmaxsize) mpi.realloc.status(newmaxsize) mpi.comm.maxsize() mpi.request.maxsize() mpi.status.maxsize() } \arguments{ \item{newmaxsize}{an integer.} } \details{ When \pkg{Rmpi} is loaded, Rmpi allocs comm array with size 10, request array with 10,000 and status array with 5,000. They should be enough in most cases. They use less than 150KB system memory. In rare case, one can use \code{mpi.realloc.comm}, \code{mpi.realloc.request} and \code{mpi.realloc.status} to increase them to bigger arrayes.} \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.finalize.Rd0000644000176000001440000000141511321433032014631 0ustar ripleyusers\name{mpi.finalize} \alias{mpi.finalize} \title{MPI\_Finalize API} \description{ Terminates MPI execution environment. } \usage{ mpi.finalize() } \arguments{ None } \value{ Always return 1 } \details{ This routines must be called by each slave (master) before it exits. This call cleans all MPI state. Once \code{mpi.finalize} has been called, no MPI routine may be called. To be more safe leaving MPI, please use \code{\link{mpi.exit}} which not only calls \code{mpi.finalize} but also detaches the library Rmpi. This will make reload the library Rmpi impossible. } \author{ Hao Yu } \seealso{ \code{\link{mpi.exit}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.info.Rd0000644000176000001440000000233107734634151014003 0ustar ripleyusers\name{mpi.info.create} \alias{mpi.info.create} \alias{mpi.info.free} \alias{mpi.info.get} \alias{mpi.info.set} \title{MPI\_Info\_create, MPI\_Info\_free, MPI\_Info\_get, MPI\_Info\_set APIs} \description{ Many MPI APIs take an info argument for additional information passing. An info is an object which consists of many (key,value) pairs. Rmpi uses an internal memory to store an info object. \code{mpi.info.create} creates a new info object. \code{mpi.info.free} frees an info object and sets it to MPI\_INFO\_NULL. \code{mpi.info.get} retrieves the value associated with key in an info. \code{mpi.info.set} adds the key and value pair to info. } \usage{ mpi.info.create(info = 0) mpi.info.free(info = 0) mpi.info.get(info = 0, key, valuelen) mpi.info.set(info = 0, key, value) } \arguments{ \item{info}{an info number.} \item{key}{a char (length 1).} \item{valuelen}{the length (nchar) of a key} \item{value}{a char (length 1).} } \value{ \code{mpi.info.create}, \code{mpi.info.free}, and \code{mpi.info.set} return 1 if success and 0 otherwise. \code{mpi.info.get} returns the value (a char) for a given info and valuelen. } \seealso{ \code{\link{mpi.spawn.Rslaves}} } \author{ Hao Yu } \keyword{interface} Rmpi/man/mpi.cartdim.get.Rd0000644000176000001440000000142712336657635015264 0ustar ripleyusers\name{mpi.cartdim.get} \title{MPI\_Cartdim\_get} \alias{mpi.cartdim.get} \description{ \code{mpi.cartdim.get} gets dim information about a Cartesian topology. } \usage{ mpi.cartdim.get(comm=3) } \arguments{ \item{comm}{Communicator with Cartesian structure} } \value{ \code{mpi.cartdim.get} returns the number of dimensions of the Cartesian structure } \details{ Can be used to provide other functions with the correct size of arrays. } \author{ Alek Hunchak and Hao Yu } \seealso{ \code{\link{mpi.cart.get}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Need at least 9 slaves mpi.bcast.cmd(mpi.cart.create(1,c(3,3),c(F,T))) mpi.cart.create(1,c(3,3),c(F,T)) mpi.cartdim.get(comm=3) } } \keyword{interface} Rmpi/man/mpi.setup.rng.Rd0000644000176000001440000000112612116414274014766 0ustar ripleyusers\name{mpi.setup.rngstream} \alias{mpi.setup.rngstream} \title{Setup parallel RNG on all slaves} \description{ \code{mpi.setup.rngstream} setups RNGstream on all slaves. } \usage{ mpi.setup.rngstream(iseed=NULL, comm = 1) } \arguments{ \item{iseed}{An integer to be supplied to \code{set.seed}, or NULL not to set reproducible seeds.} \item{comm}{A comm number.} } \value{ No value returned. } \details{ \code{mpi.setup.rngstream} can be run only on master node. It can be run later on with the same or different iseed. } \author{ Hao Yu } \keyword{interface} \keyword{distribution} Rmpi/man/mpi.iapply.Rd0000644000176000001440000000574712202716756014362 0ustar ripleyusers\name{mpi.iapplyLB} \alias{mpi.iapplyLB} \alias{mpi.iparApply} \alias{mpi.iparLapply} \alias{mpi.iparSapply} \alias{mpi.iparRapply} \alias{mpi.iparCapply} \alias{mpi.iparReplicate} \alias{mpi.iparMM} \title{(Load balancing) parallel apply with nonblocking features} \description{ (Load balancing) parallel\code{lapply} and related functions. } \usage{ mpi.iapplyLB(X, FUN, ..., apply.seq=NULL, comm=1, sleep=0.01) mpi.iparApply(X, MARGIN, FUN, ..., job.num = mpi.comm.size(comm)-1, apply.seq=NULL, comm=1, sleep=0.01) mpi.iparLapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1,sleep=0.01) mpi.iparSapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify=TRUE, USE.NAMES = TRUE, comm=1, sleep=0.01) mpi.iparRapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1, sleep=0.01) mpi.iparCapply(X, FUN, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1,sleep=0.01) mpi.iparReplicate(n, expr, job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, comm=1,sleep=0.01) mpi.iparMM(A, B, comm=1, sleep=0.01) } \arguments{ \item{X}{an array or matrix.} \item{MARGIN}{vector specifying the dimensions to use.} \item{FUN}{a function.} \item{simplify}{logical; should the result be simplified to a vector or matrix if possible?} \item{USE.NAMES}{logical; if \code{TRUE} and if \code{X} is character, use \code{X} as \code{names} for the result unless it had names already.} \item{n}{number of replications.} \item{A}{a matrix} \item{B}{a matrix} \item{expr}{expression to evaluate repeatedly.} \item{job.num}{Total job numbers. If job numbers is bigger than total slave numbers (default value), a load balancing approach is used.} \item{apply.seq}{if reproducing the same computation (simulation) is desirable, set it to the integer vector .mpi.applyLB generated in previous computation (simulation).} \item{...}{optional arguments to \code{Fun}} \item{comm}{a communicator number} \item{sleep}{a sleep interval on master node (in sec)} } \details{ \code{mpi.iparApply}, \code{mpi.iparLapply}, \code{mpi.iparSapply}, \code{mpi.iparRapply}, \code{mpi.iparCapply}, \code{mpi.iparSapply}, \code{mi.iparReplicate}, and \code{mpi.iparMM} are nonblocking versions of \code{mpi.parApply}, \code{mpi.parLapply}, \code{mpi.parSapply}, \code{mpi.parRapply}, \code{mpi.parCapply}, \code{mpi.parSapply}, \code{mpi.parReplicate}, and \code{mpi.parMM} respectively. The main difference is that \code{mpi.iprobe} and \code{Sys.sleep} are used so that master node consumes almost no CPU cycles while waiting for slaves results. However, due to frequent wake/sleep cycles on master, those functions are not suitable for running small jobs on slave nodes. If anticipated computing time for each job is relatively long, e.g., minutes or hours, setting sleep to be 1 second or longer will further reduce load on master (only slightly). } \seealso{ \code{\link{mpi.iapply}} } \keyword{utilities} Rmpi/man/mpi.gather.Rd0000644000176000001440000000555212336660250014323 0ustar ripleyusers\name{mpi.gather} \title{MPI\_Gather, MPI\_Gatherv, MPI\_Allgather, and MPI\_Allgatherv APIs} \alias{mpi.gather} \alias{mpi.gatherv} \alias{mpi.allgather} \alias{mpi.allgatherv} \description{ \code{mpi.gather} and \code{mpi.gatherv} (vector variant) gather each member's message to the member specified by the argument \code{root}. The root member receives the messages and stores them in rank order. \code{mpi.allgather} and \code{mpi.allgatherv} are the same as \code{mpi.gather} and \code{mpi.gatherv} except that all members receive the result instead of just the root. } \usage{ mpi.gather(x, type, rdata, root = 0, comm = 1) mpi.gatherv(x, type, rdata, rcounts, root = 0, comm = 1) mpi.allgather(x, type, rdata, comm = 1) mpi.allgatherv(x, type, rdata, rcounts, comm = 1) } \arguments{ \item{x}{data to be gathered. Must be the same type.} \item{type}{1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{rdata}{the receive buffer. Must be the same type as the sender and big enough to include all message gathered.} \item{rcounts}{int vector specifying the length of each message.} \item{root}{rank of the receiver} \item{comm}{a communicator number} } \value{ For \code{mpi.gather} or \code{mpi.gatherv}, it returns the gathered message for the root member. For other members, it returns what is in rdata, i.e., rdata (or rcounts) is ignored. For \code{mpi.allgather} or \code{mpi.allgatherv}, it returns the gathered message for all members. } \details{ For \code{mpi.gather} and \code{mpi.allgather}, the message to be gathered must be the same dim and the same type. The receive buffer can be prepared as either integer(size * dim) or double(size * dim), where size is the total number of members in a comm. For \code{mpi.gatherv} and \code{mpi.allgatherv}, the message to be gathered can have different dims but must be the same type. The argument \code{rcounts} records these different dims into an integer vector in rank order. Then the receive buffer can be prepared as either integer(sum(rcounts)) or double(sum(rcounts)). } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.scatter}}, \code{\link{mpi.scatterv}}. } \examples{ \donttest{ #Need 3 slaves to run properly #Or use mpi.spawn.Rslaves(nslaves=3) mpi.bcast.cmd(id <-mpi.comm.rank(.comm), comm=1) mpi.bcast.cmd(mpi.gather(letters[id],type=3,rdata=string(1))) mpi.gather(letters[10],type=3,rdata=string(4)) mpi.bcast.cmd(x<-rnorm(id)) mpi.bcast.cmd(mpi.gatherv(x,type=2,rdata=double(1),rcounts=1)) mpi.gatherv(double(1),type=2,rdata=double(sum(1:3)+1),rcounts=c(1,1:3)) mpi.bcast.cmd(out1<-mpi.allgatherv(x,type=2,rdata=double(sum(1:3)+1), rcounts=c(1,1:3))) mpi.allgatherv(double(1),type=2,rdata=double(sum(1:3)+1),rcounts=c(1,1:3)) } } \keyword{interface} Rmpi/man/mpi.scatter.Rd0000644000176000001440000000422512336660611014513 0ustar ripleyusers\name{mpi.scatter} \title{MPI\_Scatter and MPI\_Scatterv APIs} \alias{mpi.scatter} \alias{mpi.scatterv} \description{ \code{mpi.scatter} and \code{mpi.scatterv} are the inverse operations of \code{\link{mpi.gather}} and \code{\link{mpi.gatherv}} respectively. } \usage{ mpi.scatter(x, type, rdata, root = 0, comm = 1) mpi.scatterv(x, scounts, type, rdata, root = 0, comm = 1) } \arguments{ \item{x}{data to be scattered.} \item{type}{1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{rdata}{the receive buffer. Must be the same type as the sender} \item{scounts}{int vector specifying the block length inside a message to be scattered to other members.} \item{root}{rank of the receiver} \item{comm}{a communicator number} } \details{ \code{mpi.scatter} scatters the message x to all members. Each member receives a portion of x with dim as length(x)/size in rank order, where size is the total number of members in a comm. So the receive buffer can be prepared as either integer(length(x)/size) or double(length(x)/size). For \code{mpi.scatterv}, scounts counts the portions (different dims) of x sent to each member. Each member needs to prepare the receive buffer as either integer(scounts[i]) or double(scounts[i]). } \value{ For non-root members, \code{mpi.scatter} or \code{scatterv} returns the scattered message and ignores whatever is in x (or scounts). For the root member, it returns the portion belonging to itself. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.gather}}, \code{\link{mpi.gatherv}}. } \examples{ \donttest{ #Need 3 slaves to run properly #Or run mpi.spawn.Rslaves(nslaves=3) num="123456789abcd" scounts<-c(2,3,1,7) mpi.bcast.cmd(strnum<-mpi.scatter(integer(1),type=1,rdata=integer(1),root=0)) strnum<-mpi.scatter(scounts,type=1,rdata=integer(1),root=0) mpi.bcast.cmd(ans <- mpi.scatterv(string(1),scounts=0,type=3,rdata=string(strnum), root=0)) mpi.scatterv(as.character(num),scounts=scounts,type=3,rdata=string(strnum),root=0) mpi.remote.exec(ans) } } \keyword{interface} Rmpi/man/mpi.const.Rd0000644000176000001440000000151307734634037014202 0ustar ripleyusers\name{mpi.any.source} \alias{mpi.any.source} \alias{mpi.any.tag} \alias{mpi.proc.null} \title{MPI Constants} \description{ Find MPI constants: MPI\_ANY\_SOURCE, MPI\_ANY\_TAG, or MPI\_PROC\_NULL } \usage{ mpi.any.source() mpi.any.tag() mpi.proc.null() } \arguments{ None } \value{ Each function returns an integer value. } \details{ These constants are mainly used by \code{\link{mpi.send}}, \code{\link{mpi.recv}}, and \code{\link{mpi.probe}}. Different implementation of MPI may use different integers for MPI\_ANY\_SOURCE, MPI\_ANY\_TAG, and MPI\_PROC\_NULL. Hence one should use these functions instead real integers for MPI communications. } \seealso{ \code{\link{mpi.send}}, \code{\link{mpi.recv}}. } \references{ \url{http://www.lam-mpi.org}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \keyword{utilities} Rmpi/man/mpi.spawn.Rslaves.Rd0000644000176000001440000000740312336661070015615 0ustar ripleyusers\name{mpi.spawn.Rslaves} \alias{mpi.spawn.Rslaves} \alias{mpi.close.Rslaves} \alias{tailslave.log} \title{Spawn and Close R Slaves} \description{ \code{mpi.spawn.Rslaves} spawns R slaves to those hosts automatically chosen by MPI or specific hosts assigned by the argument \code{hosts}. Those R slaves are running in R BATCH mode with a specific Rscript file. The default Rscript file "slavedaemon.R" provides interactive R slave environments. \code{mpi.close.Rslaves} shuts down R slaves spawned by \code{mpi.spawn.Rslaves}. \code{tailslave.log} view (from tail) R slave log files (assuming they are all in one working directory). } \usage{ mpi.spawn.Rslaves(Rscript=system.file("slavedaemon.R", package="Rmpi"), nslaves=mpi.universe.size(), root = 0, intercomm = 2, comm = 1, hosts = NULL, needlog = TRUE, mapdrive=TRUE, quiet = FALSE, nonblock=TRUE, sleep=0.1) mpi.close.Rslaves(dellog = TRUE, comm = 1) tailslave.log(nlines = 3, comm = 1) } \arguments{ \item{Rscript}{an R script file used to run R in BATCH mode.} \item{nslaves}{number of slaves to be spawned.} \item{root}{the rank number of the member who spawns R slaves.} \item{intercomm}{an intercommunicator number} \item{comm}{a communicator number merged from an intercomm.} \item{hosts}{NULL or LAM node numbers to specify where R slaves to be spawned.} \item{needlog}{a logical. If TRUE, R BATCH outputs will be saved in log files. If FALSE, the outputs will send to /dev/null.} \item{mapdrive}{a logical. If TRUE and master's working dir is on a network, mapping network drive is attemped on remote nodes under windows platform.} \item{quiet}{a logical. If TRUE, do not print anything unless an error occurs.} \item{nonblock}{a logical. If TRUE, a nonblock procedure is used on all slaves so that they will consume none or little CPUs while waiting.} \item{sleep}{a sleep interval, used when nonblock=TRUE. Smaller sleep is, more response slaves are, more CPUs consume.} \item{dellog}{a logical specifying if R slave's log files are deleted or not.} \item{nlines}{number of lines to view from tail in R slave's log files.} } \value{ Unless \code{quiet = TRUE}, \code{mpi.spawn.Rslaves} prints to stdio how many slaves are successfully spawned and where they are running. \code{mpi.close.Rslaves} return 1 if success and 0 otherwise. \code{tailslave.log} returns last lines of R slave's log files. } \details{ The R slaves that \code{mpi.spawn.Rslaves} spawns are really running a shell program which can be found in \code{system.file("Rslaves.sh",package="Rmpi")} which takes a Rscript file as one of its arguments. Other arguments are used to see if a log file (R output) is needed and how to name it. The master process id and the comm number, along with host names where R slaves are running are used to name these log files. Once R slaves are successfully spawned, the mergers from an intercomm (default `intercomm = 2') to a comm (default `comm = 1') are automatically done on master and slaves (should be done if the default Rscript is replaced). If additional sets of R slaves are needed, please use `comm = 3', `comm = 4', etc to spawn them. At most a comm number up to 10 can be used. Notice that the default comm number for R slaves (using slavedaemon.R) is always 1 which is saved as .comm. To spawn R slaves to specific hosts, please use the argument \code{hosts} with a list of those node numbers (an integer vector). Total node numbers along their host names can be found by using \code{\link{lamhosts}}. Notice that this is LAM-MPI specific. } \seealso{ \code{\link{mpi.comm.spawn}}, \code{\link{lamhosts}}. } \author{ Hao Yu } \examples{ \donttest{ mpi.spawn.Rslaves(nslaves=2) tailslave.log() mpi.remote.exec(rnorm(10)) mpi.close.Rslaves() } } \keyword{utilities} Rmpi/man/mpi.probe.Rd0000644000176000001440000000302010350164763014146 0ustar ripleyusers\name{mpi.probe} \title{MPI\_Probe and MPI\_Iprobe APIs} \usage{ mpi.probe(source, tag, comm = 1, status = 0) mpi.iprobe(source, tag, comm = 1, status = 0) } \alias{mpi.probe} \alias{mpi.iprobe} \arguments{ \item{source}{the source of incoming message or mpi.any.source() for any source.} \item{tag}{a tag number or mpi.any.tag() for any tag.} \item{comm}{a communicator number} \item{status}{a status number} } \description{ \code{mpi.probe} uses the source and tag of incoming message to set a status. \code{mpi.iprobe} does the same except it is a nonblocking call, i.e., returns immediately.} \details{ When \code{\link{mpi.send}} or other nonblocking sends are used to send a message, the receiver may not know the exact length before receiving it. \code{mpi.probe} is used to probe the incoming message and put some information into a status. Then the exact length can be found by using \code{\link{mpi.get.count}} to such a status. If the wild card \code{mpi.any.source} or \code{mpi.any.tag} are used, then one can use \code{\link{mpi.get.sourcetag}} to find the exact source or tag of a sender. } \value{ \code{mpi.probe} returns 1 only after a matching message has been found. \code{mpi.iproble} returns TRUE if there is a message that can be received; FALSE otherwise. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.send}}, \code{\link{mpi.recv}}, \code{\link{mpi.get.count}} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.dims.create.Rd0000644000176000001440000000243612336660172015250 0ustar ripleyusers\name{mpi.dims.create} \title{MPI\_Dims\_create} \alias{mpi.dims.create} \description{ \code{mpi.dims.create} Create a Cartesian dimension used by \code{mpi.cart.create}. } \usage{ mpi.dims.create(nnodes, ndims, dims=integer(ndims)) } \arguments{ \item{nnodes}{Number of nodes in a cluster} \item{ndims}{Number of dimension in a Cartesian topology} \item{dims}{Initial dimension numbers} } \value{ \code{mpi.dims.create} returns the dimension vector used by that in \code{mpi.cart.create}. } \details{ The entries in the return value are set to describe a Cartesian grid with \code{ndims} dimensions and a total of \code{nnodes} nodes. The dimensions are set to be as close to each other as possible, using an appropriate divisibility algorithm. The return value can be constrained by specifying positive number(s) in \code{dims}. Only those 0 values in \code{dims} are modified by \code{mpi.dims.create}.} \author{ Hao Yu } \seealso{ \code{\link{mpi.cart.create}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #What is the dim numbers of 2 dim Cartersian topology under a grid of 36 nodes mpi.dims.create(36,2) #return c(6,6) #Constrained dim numbers mpi.dims.create(12,2,c(0,4)) #return c(9,4) } } \keyword{interface} Rmpi/man/mpi.intercomm.merge.Rd0000644000176000001440000000241707476043136016150 0ustar ripleyusers\name{mpi.intercomm.merge} \title{MPI\_Intercomm\_merge API} \usage{ mpi.intercomm.merge(intercomm=2, high=0, comm=1) } \alias{mpi.intercomm.merge} \arguments{ \item{intercomm}{an intercommunicator number} \item{high}{Used to order the groups of the two intracommunicators within comm when creating the new communicator} \item{comm}{a (intra)communicator number} } \description{ Creates an intracommunicator from an intercommunicator } \details{ When master spawns slaves, an intercommunicator is created. To make communications (point-to-point or groupwise) among master and slaves, an intracommunicator must be created. \code{mpi.intercomm.merge} is used for that purpose. This is a collective call so all master and slaves call together. R slaves spawned by \code{\link{mpi.spawn.Rslaves}} should use \code{\link{mpi.comm.get.parent}} to get (set) an intercomm to a number followed by merging antercomm to an intracomm. One can use \code{\link{mpi.comm.test.inter}} to test if a communicator is an intercommunicator or not. } \value{ 1 if success. Otherwise 0. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.comm.test.inter}} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.bcast.cmd.Rd0000644000176000001440000000457512111755317014713 0ustar ripleyusers\name{mpi.bcast.cmd} \title{Extension of MPI\_Bcast API} \alias{mpi.bcast.cmd} \description{ \code{mpi.bcast.cmd} is an extension of \code{\link{mpi.bcast}}. It is mainly used to transmit a command from master to all R slaves spawned by using slavedaemon.R script. } \usage{ mpi.bcast.cmd(cmd=NULL, ..., rank = 0, comm = 1, nonblock=FALSE, sleep=0.1) } \arguments{ \item{cmd}{a command to be sent from master.} \item{...}{used as arguments to cmd (function command) for passing their (master) values to R slaves, i.e., if `myfun(x)' will be executed on R slaves with `x' as master variable, use mpi.bcast.cmd(cmd=myfun, x=x).} \item{rank}{the sender} \item{comm}{a communicator number} \item{nonblock}{logical. If TRUE, a nonblock procedure is used on all receivers so that they will consume none or little CPUs while waiting.} \item{sleep}{a sleep interval, used when nonblock=TRUE. Smaller sleep is, more response receivers are, more CPUs consume} } \value{ \code{mpi.bcast.cmd} returns no value for the sender and an expression of the transmitted command for others. } \details{ \code{mpi.bcast.cmd} is a collective call. This means all members in a communicator must execute it at the same time. If slaves are spawned (created) by using slavedaemon.R (Rprofile script), then they are running \code{mpi.bcast.cmd} in infinite loop (idle state). Hence master can execute \code{mpi.bcast.cmd} alone to start computation. On the master, \code{cmd} and \code{...} are put together as a list which is then broadcasted (after serialization) to all slaves (using for loop with mpi.send and mpi.recv pair). All slaves will return an expression which will be evaluated by either slavedaemon.R, or by whatever an R script based on slavedaemon.R. If nonblock=TRUE, then on receiving side, a nonblock procedure is used to check if there is a message. If not, it will sleep for the specied amount and repeat itself. Please use \code{\link{mpi.remote.exec}} if you want the executed results returned from R slaves. } \section{Warning}{ Be caution to use \code{mpi.bcast.cmd} alone by master in the middle of comptuation. Only all slaves in idle states (waiting instructions from master) can it be used. Othewise it may result miscommunication with other MPI calls. } \author{ Hao Yu } \seealso{ \code{\link{mpi.remote.exec}} } %\examples{ %} \keyword{utilities} Rmpi/man/mpi.apply.Rd0000644000176000001440000000252112336657161014176 0ustar ripleyusers\name{mpi.apply} \alias{mpi.apply} \alias{mpi.iapply} \title{Scatter an array to slaves and then apply a FUN} \description{ An array (length <= total number of slaves) is scattered to slaves so that the first slave calls \code{FUN} with arguments \code{x[[1]]} and \code{...}, the second one calls with arguments \code{x[[2]]} and \code{...}, and so on. \code{mpi.iapply} is a nonblocking version of \code{mpi.apply} so that it will not consume CPU on master node.} \usage{ mpi.apply(X, FUN, ..., comm=1) mpi.iapply(X, FUN, ..., comm=1, sleep=0.01) } \arguments{ \item{X}{an array} \item{FUN}{a function} \item{...}{optional arguments to \code{FUN}} \item{comm}{a communicator number} \item{sleep}{a sleep interval on master node (in sec)} } \value{ A list of the results is returned. Its length is the same as that of \code{x}. In case the call \code{FUN} with arguments \code{x[[i]]} and \code{...} fails on ith slave, corresponding error message will be returned in the returning list. } %\seealso{ % \code{\link{mpi.spawn.Rslaves}}, % \code{\link{mpi.bcast.cmd}} % \code{\link{mpi.bcast.Robj2slave}} %} \author{ Hao Yu } \examples{ \donttest{ #Assume that there are at least 5 slaves running #Otherwise run mpi.spawn.Rslaves(nslaves=5) x=c(10,20) mpi.apply(x,runif) meanx=1:5 mpi.apply(meanx,rnorm,n=2,sd=4) } } \keyword{utilities} Rmpi/man/mpi.cart.shift.Rd0000644000176000001440000000267512336657575015141 0ustar ripleyusers\name{mpi.cart.shift} \title{MPI\_Cart\_shift} \alias{mpi.cart.shift} \description{ \code{mpi.cart.shift} shifts the Cartesian topology in both manners, displacement and direction. } \usage{ mpi.cart.shift(comm=3, direction, disp) } \arguments{ \item{comm}{Communicator with Cartesian structure} \item{direction}{Coordinate dimension of the shift} \item{disp}{displacement (>0 for upwards or left shift, <0 for downwards or right shift)} } \value{ \code{mpi.cart.shift} returns a vector containing information regarding the rank of the source process and rank of the destination process. } \details{ \code{mpi.cart.shift} provides neighbor ranks from given direction and displacement. The direction argument indicates the dimension of the shift. direction=1 means the first dim, direction=2 means the second dim, etc. disp=1 or -1 provides immediate neighbor ranks and disp=2 or -2 provides neighbor's neighbor ranks. Negative ranks mean out of boundary. They correspond to \code{mpi.proc.null}. } \author{ Alek Hunchak and Hao Yu } \seealso{ \code{\link{mpi.cart.create}},\code{\link{mpi.proc.null}} } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Need at least 9 slaves mpi.bcast.cmd(mpi.cart.create(1,c(3,3),c(F,T))) mpi.cart.create(1,c(3,3),c(F,T)) mpi.remote.exec(mpi.cart.shift(3,2,1))#get neighbor ranks mpi.remote.exec(mpi.cart.shift(3,1,1)) } } \keyword{interface} Rmpi/man/mpi.send.Robj.Rd0000644000176000001440000000331611253610751014667 0ustar ripleyusers\name{mpi.send.Robj} \title{Extensions of MPI\_Send and MPI\_Recv APIs} \alias{mpi.send.Robj} \alias{mpi.isend.Robj} \alias{mpi.recv.Robj} \description{ \code{mpi.send.Robj} and \code{mpi.recv.Robj} are two extensions of \code{mpi.send} and \code{mpi.recv}. They are used to transmit a general R object from any source to any destination. \code{mpi.isend.Robj} is a nonblocking version of \code{mpi.send.Robj}. } \usage{ mpi.send.Robj(obj, dest, tag, comm = 1) mpi.isend.Robj(obj, dest, tag, comm = 1, request=0) mpi.recv.Robj(source, tag, comm = 1, status = 0) } \arguments{ \item{obj}{an R object. Can be any R object. } \item{dest}{the destination rank.} \item{source}{the source rank or mpi.any.source() for any source.} \item{tag}{non-negative integer or mpi.any.tag() for any tag.} \item{comm}{a communicator number.} \item{request}{a request number.} \item{status}{a status number.} } \value{ \code{mpi.send.Robj} or \code{mpi.isend.Robj} return no value. \code{mpi.recv.Robj} returns the the transmitted R object. } \details{ \code{mpi.send.Robj} and \code{mpi.isend.Robj} use \code{serialize} to encode an R object into a binary char vector. It sends the message to the destination. The receiver decode the message back into an R object by using \code{unserialize}. If \code{mpi.isend.Robj} is used, \code{mpi.wait} or \code{mpi.test} must be used to check the object has been sent. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.send}}, \code{\link{mpi.recv}}, \code{\link{mpi.wait}}, \code{\link{serialize}}, \code{\link{unserialize}}, } %\examples{ %} \keyword{utilities} Rmpi/man/mpi.cart.create.Rd0000644000176000001440000000251212336657435015250 0ustar ripleyusers\name{mpi.cart.create} \title{MPI\_Cart\_create} \alias{mpi.cart.create} \description{ \code{mpi.cart.create} creates a Cartesian structure of arbitrary dimension. } \usage{ mpi.cart.create(commold=1, dims, periods, reorder=FALSE, commcart=3) } \arguments{ \item{commold}{Input communicator} \item{dims}{Integery array of size ndims specifying the number of processes in each dimension} \item{periods}{Logical array of size ndims specifying whether the grid is periodic or not in each dimension} \item{reorder}{ranks may be reordered or not} \item{commcart}{The new communicator to which the Cartesian topology information is attached} } \value{ \code{mpi.cart.create} returns 1 if success and 0 otherwise. } \details{ If reorder = false, then the rank of each process in the new group is the same as its rank in the old group. If the total size of the Cartesian grid is smaller than the size of the group of commold, then some processes are returned mpi.comm.null. The call is erroneous if it specifies a grid that is larger than the group size. } \author{ Alek Hunchak and Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \examples{ \donttest{ #Need at least 9 slaves mpi.bcast.cmd(mpi.cart.create(1,c(3,3),c(F,T))) mpi.cart.create(1,c(3,3),c(F,T)) } } \keyword{interface} Rmpi/man/mpi.comm.disconnect.Rd0000644000176000001440000000171307476042354016137 0ustar ripleyusers\name{mpi.comm.disconnect} \title{MPI\_Comm\_disconnect API} \usage{ mpi.comm.disconnect(comm=1) } \alias{mpi.comm.disconnect} \arguments{ \item{comm}{a communicator number} } \description{ \code{mpi.comm.disconnect} disconnects itself from a communicator and then deallocates the communicator so it points to MPI\_COMM\_NULL. } \details{ When members associated with a communicator finish jobs or exit, they have to call \code{mpi.comm.disconnect} to release resource if the communicator was created from an intercommunicator by \code{\link{mpi.intercomm.merge}}. If \code{\link{mpi.comm.free}} is used instead, \code{\link{mpi.finalize}} called by slaves may cause undefined impacts on master who wishes to stay. } \value{ 1 if success. Otherwise 0. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.comm.free}} } %\examples{ %} \keyword{interface} Rmpi/man/mpi.comm.set.errhandler.Rd0000644000176000001440000000134110652542602016712 0ustar ripleyusers\name{mpi.comm.set.errhandler} \title{MPI\_Comm\_set\_errhandler API} \usage{ mpi.comm.set.errhandler(comm = 1) } \alias{mpi.comm.set.errhandler} \arguments{ \item{comm}{a communicator number} } \description{ \code{mpi.comm.set.errhandler} sets a communicator to MPI\_ERRORS\_RETURN instead of MPI\_ERRORS\_ARE\_FATAL (default) which crashes R on any type of MPI errors. Almost all MPI API calls return errcodes which can map to specific MPI error messages. All MPI related error messages come from predefined MPI\_Error\_string. } \value{ 1 if success. Otherwise 0. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } %\examples{ %} \keyword{interface} Rmpi/man/hosts.Rd0000644000176000001440000000243612324026235013417 0ustar ripleyusers\name{lamhosts} \alias{mpi.is.master} \alias{lamhosts} \alias{mpi.hostinfo} \alias{slave.hostinfo} \title{Hosts Information} \description{ \code{lamhosts} finds the host name associated with its node number. Can be used by \code{\link{mpi.spawn.Rslaves}} to spawn R slaves on selected hosts. This is a LAM-MPI specific function. \code{mpi.is.master} checks if it is running on master or slaves. \code{mpi.hostinfo} finds an individual host information including rank and size in a comm. \code{slave.hostinfo} is executed only by master and find all master and slaves host information in a comm. } \usage{ lamhosts() mpi.is.master() mpi.hostinfo(comm = 1) slave.hostinfo(comm = 1, short=TRUE) } \arguments{ \item{comm}{a communicator number} \item{short}{if true, a short form is printed} } \value{ \code{lamhosts} returns CPUs nodes numbers with their host names. \code{mpi.is.master} returns TRUE if it is on master and FALSE otherwise. \code{mpi.hostinfo} sends to stdio a host name, rank, size and comm. \code{slave.hostname} sends to stdio a list of host, rank, size, and comm information for all master and slaves. With short=TRUE and 8 slaves or more, the first 3 and last 2 slaves are shown. } \seealso{ \code{\link{mpi.spawn.Rslaves}} } \author{ Hao Yu } \keyword{utilities} Rmpi/man/mpi.get.sourcetag.Rd0000644000176000001440000000206107476042745015627 0ustar ripleyusers\name{mpi.get.sourcetag} \title{Utility for finding the source and tag of a received message} \usage{ mpi.get.sourcetag(status = 0) } \alias{mpi.get.sourcetag} \arguments{ \item{status}{a status number} } \description{ \code{mpi.get.sourcetag} finds the source and tag of a received message. } \details{ When \code{\link{mpi.any.source}} and/or \code{\link{mpi.any.tag}} are used by \code{\link{mpi.recv}} or \code{\link{mpi.probe}}, one can use \code{mpi.get.sourcetag} to find who sends the message or with what a tag number. \code{\link{mpi.get.sourcetag}} must be called immediately after calling \code{mpi.recv} or \code{mpi.probe} otherwise the obtained information may not be right. } \value{ 2 dim int vector. The first integer is the source and the second is the tag. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.send}}, \code{\link{mpi.recv}}, \code{\link{mpi.probe}}, \code{\link{mpi.get.count}} } %\examples{ %} \keyword{utilities} Rmpi/man/mpi.sendrecv.Rd0000644000176000001440000000527312336660756014675 0ustar ripleyusers\name{mpi.sendrecv} \title{MPI\_Sendrecv and MPI\_Sendrecv\_replace APIs} \alias{mpi.sendrecv} \alias{mpi.sendrecv.replace} \description{ \code{mpi.sendrecv} and \code{mpi.sendrecv.replace} execute blocking send and receive operations. Both of them combine the sending of one message to a destination and the receiving of another message from a source in one call. The source and destination are possibly the same. The send buffer and receive buffer are disjoint for \code{mpi.sendrecv}, while the buffers are not disjoint for \code{mpi.sendrecv.replace}. } \usage{ mpi.sendrecv(senddata, sendtype, dest, sendtag, recvdata, recvtype, source, recvtag, comm = 1, status = 0) mpi.sendrecv.replace(x, type, dest, sendtag, source, recvtag, comm = 1, status = 0) } \arguments{ \item{x}{data to be sent or recieved. Must be the same type for source and destination.} \item{senddata}{data to be sent. May have different datatypes and lengths} \item{recvdata}{data to be recieved. May have different datatypes and lengths} \item{type}{type of the data to be sent or recieved. 1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{sendtype}{type of the data to be sent. 1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{recvtype}{type of the data to be recieved. 1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{dest}{the destination rank. Use \code{mpi.proc.null} for a fake destination.} \item{source}{the source rank. Use \code{mpi.any.source} for any source. Use \code{mpi.proc.null} for a fake source. } \item{sendtag}{non-negative integer. Use \code{mpi.any.tag} for any tag flag.} \item{recvtag}{non-negative integer. Use \code{mpi.any.tag} for any tag flag.} \item{comm}{a communicator number.} \item{status}{a status number.} } \value{ Returns the int, double or char vector sent from the send buffers. } \details{ The receive buffer must be large enough to contain an incoming message otherwise programs will be crashed. There is compatibility between send-receive and normal sends and receives. A message sent by a send-receive can be received by a regular receive and a send-receive can receive a message sent by a regular send. } \author{ Kris Chen } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.send.Robj}}, \code{\link{mpi.recv.Robj}}, \code{\link{mpi.probe}}. \code{\link{mpi.get.sourcetag}}. } \examples{ \donttest{ mpi.sendrecv(as.integer(11:20),1,0,33,integer(10),1,0,33,comm=0) mpi.sendrecv.replace(seq(1,2,by=0.1),2,0,99,0,99,comm=0) } } \keyword{interface} Rmpi/man/mpi.bcast.Rd0000644000176000001440000000364612202732767014154 0ustar ripleyusers\name{mpi.bcast} \title{MPI\_Bcast API} \alias{mpi.bcast} \description{ \code{mpi.bcast} is a collective call among all members in a comm. It broadcasts a message from the specified rank to all members. } \usage{ mpi.bcast(x, type, rank = 0, comm = 1, buffunit=100) } \arguments{ \item{x}{data to be sent or received. Must be the same type among all members.} \item{type}{1 for integer, 2 for double, and 3 for character. Others are not supported.} \item{rank}{the sender.} \item{comm}{a communicator number.} \item{buffunit}{a buffer unit number.} } \value{ \code{mpi.bcast} returns the message broadcasted by the sender (specified by the rank). } \details{ \code{mpi.bcast} is a blocking call among all members in a comm, i.e, all members have to wait until everyone calls it. All members have to prepare the same type of messages (buffers). Hence it is relatively difficult to use in R environment since the receivers may not know what types of data to receive, not mention the length of data. Users should use various extensions of \code{mpi.bcast} in R. They are \code{\link{mpi.bcast.Robj}}, \code{\link{mpi.bcast.cmd}}, and \code{\link{mpi.bcast.Robj2slave}}. When type=5, MPI continuous datatype (double) is defined with unit given by \code{buffunit}. It is used to transfer huge data where a double vector or matrix is divided into many chunks with unit \code{buffunit}. Total ceiling(length(obj)/buffunit) units are transferred. Due to MPI specification, both \code{buffunit} and total units transferred cannot be over 2^31-1. Notice that the last chunk may not have full length of data due to rounding. Special care is needed. } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.bcast.Robj}}, \code{\link{mpi.bcast.cmd}}, \code{\link{mpi.bcast.Robj2slave}}. } %\examples{ %} \keyword{interface} Rmpi/man/mpi.reduce.Rd0000644000176000001440000000400607476043173014321 0ustar ripleyusers\name{mpi.reduce} \title{MPI\_Reduce and MPI\_Allreduce APIs} \alias{mpi.allreduce} \alias{mpi.reduce} \description{ \code{mpi.reduce} and \code{mpi.allreduce} are global reduction operations. \code{mpi.reduce} combines each member's result, using the operation \code{op}, and returns the combined value(s) to the member specified by the argument \code{dest}. \code{mpi.allreduce} is the same as \code{mpi.reduce} except that all members receive the combined value(s). } \usage{ mpi.reduce(x, type=2, op=c("sum","prod","max","min","maxloc","minloc"), dest = 0, comm = 1) mpi.allreduce(x, type=2, op=c("sum","prod","max","min","maxloc","minloc"), comm = 1) } \arguments{ \item{x}{data to be reduced. Must be the same dim and the same type for all members.} \item{type}{1 for integer and 2 for double. Others are not supported.} \item{op}{one of "sum", "prod", "max", "min", "maxloc", or "minloc".} \item{dest}{rank of destination} \item{comm}{a communicator number} } \value{ \code{mpi.reduce} returns the combined value(s) to the member specified by \code{dest}. \code{mpi.allreduce} returns the combined values(s) to every member in a comm. The combined value(s) may be the summation, production, maximum, or minimum specified by the argument \code{op}. If the \code{op} is either "maxloc" or "minloc", then the maximum (minimum) value(s) along the maximum (minimum) rank(s) will be returned. } \details{ It is important that all members in a comm call either all \code{mpi.reduce} or all \code{mpi.allreduce} even though the master may not be in computation. They must provide exactly the same type and dim vectors to be reduced. If the operation "maxloc" or "minloc" is used, the combined vector is twice as long as the original one since the maximum or minimum ranks are included. } \author{ Hao Yu } \references{ \url{http://www.lam-mpi.org/}, \url{http://www-unix.mcs.anl.gov/mpi/www/www3/} } \seealso{ \code{\link{mpi.gather}}. } %\examples{ %} \keyword{interface} Rmpi/configure.win0000644000176000001440000000000012334141130013667 0ustar ripleyusersRmpi/cleanup0000755000176000001440000000032312324025032012555 0ustar ripleyusers#! /bin/sh /bin/rm -rf ./chm /bin/rm -rf ./config.* /bin/rm -rf ./autom4te.cache /bin/rm -rf src/Makevars /bin/rm -rf src/*.so src/*.o src/*.d src/*.dll src/*.a src/*.rc src/*.rds src/Makedeps /bin/rm -rf src-* Rmpi/INDEX0000644000176000001440000001514112325505701012005 0ustar ripleyusersMPI APIs: mpi.abort Abort (quit) all tasks associated with a comm mpi.allgather Gather data from each process to all process mpi.allgatherv Gather diff size data from each process to all process mpi.allreduce Reduce all process's vectors into one vector mpi.barrier Block the caller until all group have called it mpi.bcast Broadcast a vector (int,double,char) to every process mpi.cancel Cancel a nonblocking send or recv mpi.cart.coords Translate a rank to the Cartesian topology coordinate mpi.cart.create Create a Cartesian structure of arbitrary dimension mpi.cartdim.get Get dim information about a Cartesian topology mpi.cart.get Provide the Cartesian topology associated with a comm mpi.cart.rank Translate a Cartesian topology coordinate to the rank mpi.cart.shift Shift Cartesian topology in displacement and direction mpi.comm.disconnect Disconeect and free a comm mpi.comm.dup Duplicate a comm to a new comm mpi.comm.c2f Convert a comm into an integer used by extern Fortran mpi.comm.free Free a comm mpi.comm.get.parent Get the parent intercomm mpi.comm.rank Find the rank (process id) of master and slaves mpi.comm.remote.size Find the size of a remote group from an intercomm mpi.comm.size Find the size (total # of master and slaves) mpi.comm.set.errhandler Set comm to error return (no crash) mpi.comm.spawn Spawn slaves mpi.comm.test.inter Test if a comm is an intercomm mpi.dims.create Create a Cartesian dim used by mpi.cart.create mpi.finalize Exit MPI environment (call MPI_Finalize()) mpi.gather Gather data from each process to a root process mpi.gatherv Gather diff data from each process to a root process mpi.get.count Get the length of a message for given status and type mpi.get.processor.name Get the process (host) name mpi.info.create Create an info object mpi.info.free Free an info object mpi.info.get Get the value from an info object and a key mpi.info.set Set a key/value pair of an info object mpi.intercomm.merge Merge a intercomm to a comm mpi.iprobe Nonblocking use a source and a tag to set status mpi.irecv Nonblocking receive a vector from a specific process mpi.isend Nonblocking send a vector to a specific process mpi.probe Use a source and a tag to set status mpi.recv Receive a vector from a specific process mpi.reduce Reduce all processes's vectors into one (one process) mpi.scatter Opposite of mpi.gather mpi.scatterv Opposite of mpi.gatherv (diff size data) mpi.send Send a vector to a specific process mpi.sendrecv Send & receive different vectors in one call mpi.sendrecv.replace Send & replace a vector in one call mpi.test Test if a nonblocking send/recv request is complete mpi.testall Test if all nonblocking send/recv requests are complete mpi.testany Test if any nonblocking send/recv requests are complete mpi.testsome Test if some nonblocking send/recv requests are complete mpi.test.cancelled Test if a communication is cancelled by mpi.cancel mpi.universe.size Total number of CPUs available mpi.wait Wait if a nonblocking send/recv request is complete mpi.waitall Wait if all nonblocking send/recv requests are complete mpi.waitany Wait if any nonblocking send/recv requests are complete mpi.waitsome Wait if some nonblocking send/recv requests are complete ****************************************************************************** MPI Extensions in R Environment: lamhosts Hosts id and machine host name mapping mpi.allgather.Robj Gather any type of objects to every number mpi.any.source A constant for receiving a message from any source mpi.any.tag A constant for receiving a message from any tag mpi.bcast.Robj Broadcast an R object to every process mpi.comm.maxsize Find the length of comm array mpi.exit Call MPI_Finalize and detach Rmpi library mpi.gather.Robj Gather any type of object to a root process mpi.get.sourcetag Get the source and tag for a given status mpi.hostinfo Get the host information that the process is running mpi.is.master TRUE if it is a master otherwise FALSE (slave) mpi.isend.Robj Nonblocking send an R object to a specific process mpi.proc.null Dummy source and destination mpi.quit Call MPI_Finalize and quit R mpi.recv.Robj Receive an R object from a process (by mpi.send.Robj) mpi.realloc.comm Increase comm array to a new size mpi.realloc.request Increase request array to a new size mpi.realloc.status Increase status array to a new size mpi.request.maxsize Find the length of request array mpi.scatter.Robj Scatter an list to every number mpi.send.Robj Send an R object to a specific process mpi.spawn.Rslaves Spawn R slaves. The default R script is slavedaemon.R mpi.status.maxsize Find the length of status array ***************************************************************************** MPI Extensions specifically to slavedaemon.R Script (interactive R slaves). mpi.apply Scatter an array to slaves and then apply a fun mpi.iapply Nonblocking scatter an array to slaves and then apply a fun mpi.applyLB Load balancing version of mpi.apply mpi.iapplyLB Nonblocking load balancing version of mpi.apply mpi.bcast.Robj2slave Master sends an Robj to all slaves mpi.bcast.Rfun2slave Master sends all user functions to all slaves mpi.bcast.Rdata2slave Master sends an vector or matrix to all slaves without serialization mpi.bcast.cmd Broadcast a command to every process mpi.close.Rslaves Close all slaves launched by mpi.spawn.Rslaves() mpi.parApply (Load balancing) parallel apply mpi.iparApply (Nonblocking and load balancing) parallel apply mpi.parCapply (Load balancing) parallel column apply mpi.iparCapply (Nonblocking and load balancing) parallel column apply mpi.parLapply (Load balancing) parallel lapply mpi.iparLapply (Nonblocking and load balancing) parallel lapply mpi.parRapply (Load balancing) parallel row apply mpi.iparRapply (Nonblocking and load balancing) parallel row apply mpi.parReplicate A wrapper to mpi.parSapply for repeated eval of an expr mpi.iparReplicate A nonblocking wrapper to mpi.iparSapply for repeated eval of an expr mpi.parSapply (Load balancing) parallel sapply mpi.iparSapply (Nonblocking and load balancing) parallel sapply mpi.parSim (Load balancing) parallel Monte Carlo simulation mpi.remote.exec Run a command remotely on slaves and return results back to the master mpi.setup.rngstream Setup RNDstream (package rlecuyer) on all slaves slave.hostinfo Show all slave rank, comm, host information tailslave.log Tail (view) last lines of slave log files ***************************************************************************** Some Internal Functions used by other MPI Functions mpi.comm.is.null Test if a comm is NULL (no members) string Create a string (empty space character) buffer