Skip to content

Commit

Permalink
Merge pull request #5 from rocanale/master
Browse files Browse the repository at this point in the history
Updating package, compatible with Elemental
  • Loading branch information
rocanale authored Jan 12, 2017
2 parents 08474bb + b2edd59 commit 1fea004
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ before_install:
- curl https://cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz | sudo tar -x -z --strip-components 1 -C /usr
- git clone git://github.com/elemental/Elemental.git
- cd Elemental
- git checkout 8a1a42c
- git checkout v0.87.6
- mkdir build && cd build
- cmake .. -DCMAKE_CXX_COMPILER=g++-5 -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_Fortran_COMPILER=gfortran-5 -DCMAKE_INSTALL_PREFIX=~/local/El;
- make -j2 && sudo make install
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: RElem
Type: Package
Title: Distributed Parallel Linear Algebra Through Elemental (Libelemental.org)
Version: 0.2.874
Version: 0.2.876
Date: 2016-11-25
Depends: R (>= 3.1.0)
Author: Rodrigo Canales
Maintainer: Rodrigo Canales <rodrigo.canales@rwth-aachen.de>
Description: Wrappers to use Elemental library (0.87.4), allowing distributed parallel computations using native R syntax.
Description: Wrappers to use Elemental library (0.87.6), allowing distributed parallel computations using native R syntax.
License: MIT | file LICENSE
URL: https://github.com/HPAC/RElem
Collate:
Expand Down
2 changes: 1 addition & 1 deletion R/Operators.R
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ setMethod("t",
setMethod("t",
signature(x = "ElDistMatrix"),
function (x){
y <- Matrix(x@datatype)
y <- DistMatrix(x@datatype)
Transpose(x,y)
y
})
Expand Down
76 changes: 61 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#RElem

[![Build Status](https://travis-ci.org/rocanale/RElem.svg?branch=master)](https://travis-ci.org/rocanale/RElem) using Elemental v0.87.6 (8a1a42c)
[![Build Status](https://travis-ci.org/rocanale/RElem.svg?branch=master)](https://travis-ci.org/rocanale/RElem) using Elemental v0.87.6

This R package links R and the dense linear algebra library
[Elemental](http://www.libelemental.org), providing distributed parallel
Expand All @@ -25,12 +25,11 @@ package:
* Matrix Factorizations
* Spectral Decomposition
* Solvers
* Optimization Models
* Matrix Generators
* LibFLAME-like
* Partition
* Merge
* Repartition (_Not yet active in El headers_)
* Slide Partition (_Not yet active in El headers_)
* I/O routines


Expand All @@ -40,12 +39,31 @@ package:
The installation of the RElem requires two steps:

#### 1. Install Elemental
- [Install Elemental](http://libelemental.org/documentation/dev/build.html) as a shared library
- Ideally, Elemental is installed in one of the default paths `/usr/local`, `$HOME/local`, `$HOME/.local`
- [Install Elemental latest release](https://github.com/elemental/Elemental/releases/tag/v0.87.6) 0.87.6
- Elemental requires a C/C++ compiler, a fortran compiler and an MPI distribution like mpich.
- Ideally, Elemental is installed in one of these paths `/usr/local`, `$HOME/local`, `$HOME/.local`


##### Unix Installation example

```
mkdir build
cd build
cmake \
-D EL_DISABLE_SCALAPACK=ON \
-D CMAKE_INSTALL_PREFIX=$HOME/local \
-D EL_DISABLE_PARMETIS=ON \
..
make -j4
make install
```

*If you installed Elemental in a non default path, please be sure that libEl.so can be loaded*:

`export LD_LIBRARY_PATH=$HOME/local:$LD_LIBRARY_PATH`

#### 2. Install RElem
We have plans to make R-El available in R's package manager CRAN in the future. So far, **a
superuser** can install the interface from R as follows:
We have plans to make R-El available in R's package manager CRAN in the future. Nevertheless it is possible to install it manually.

A zip file from the package can be downloaded from our [releases](https://github.com/rocanale/RElem/releases) and then installed using the following command:

Expand Down Expand Up @@ -117,21 +135,17 @@ For distributed computations, R needs to be invoked by MPI as follows:

`mpiexec -n 4 R --no-readline --slave --quiet --vanilla -f SimpleDist.R`

Note: The openmpi library (or the one installed in the system) must be preloaded using the `LD_PRELOAD` environment variable:

`export LD_PRELOAD=/usr/lib/libmpi.so:$LD_PRELOAD`
### Simple Script

### Source

The following example invokes `GEMM` with distributed matrices
The following example invokes a matrix multiplication `GEMM` using distributed matrices

```s
# Load the library
library(RElem)
# Create the Matrices
A <- DistMatrix(g)
B <- DistMatrix(g)
A <- DistMatrix()
B <- DistMatrix()
#Initialize the Matrices
Uniform(A,6,4)
Expand All @@ -143,3 +157,35 @@ C <- A%*%B
print(C)
```

## Appendix: Full installation script using mac OS X

This script assumes that the computer has gfortran and mpich from macports.

```
git clone git@github.com:elemental/Elemental.git
git checkout v0.87.6
mkdir build
cd build
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=${HOME}/local/El \
-D EL_DISABLE_PARMETIS=ON \
-D CMAKE_Fortran_COMPILER=gfortran-mp-5 \
-D MPI_C_COMPILER=mpicc-mpich-mp \
-D MPI_CXX_COMPILER=mpic++-mpich-mp \
-D MPI_FORTRAN_COMPILER=mpifort-mpich-mp \
-D MPI_F77_COMPILER=mpif77-mpich-mp \
-D EL_DISABLE_SCALAPACK=ON \
..
make -j4
make install
export LD_LIBRARY_PATH=${HOME}/local/El/lib:$LD_LIBRARY_PATH
R CMD INSTALL RElem.tar.gz
```
36 changes: 12 additions & 24 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for configRElem v0.01.085.
# Generated by GNU Autoconf 2.69 for configRElem v0.2.876.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -576,8 +576,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='configRElem'
PACKAGE_TARNAME='configrelem'
PACKAGE_VERSION='v0.01.085'
PACKAGE_STRING='configRElem v0.01.085'
PACKAGE_VERSION='v0.2.876'
PACKAGE_STRING='configRElem v0.2.876'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand All @@ -603,7 +603,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -669,7 +668,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -922,15 +920,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1068,7 +1057,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1181,7 +1170,7 @@ 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 configRElem v0.01.085 to adapt to many kinds of systems.
\`configure' configures configRElem v0.2.876 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1221,7 +1210,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand All @@ -1243,7 +1231,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of configRElem v0.01.085:";;
short | recursive ) echo "Configuration of configRElem v0.2.876:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1316,7 +1304,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configRElem configure v0.01.085
configRElem configure v0.2.876
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand All @@ -1333,7 +1321,7 @@ 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 configRElem $as_me v0.01.085, which was
It was created by configRElem $as_me v0.2.876, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -1699,7 +1687,7 @@ if test -n "${UsrPrefix}"; then
else
#Checking the common folders
HIDLOC="/.local"
for pr in /usr/local /usr/local/El /usr/local/opt/Elemental /opt/El "$HOME/local" "$HOME/local/El" "$HOME$HIDLOC"; do
for pr in /usr/local /usr/local/El /usr/local/Elemental /usr/share /usr/local/share /opt/El "$HOME/local" "$HOME/local/El" "$HOME$HIDLOC" /usr/local/Cellar/elemental /usr/opt/Cellar/elemental; do
if test -f "${pr}/conf/ElVars"; then
EL_PREFIX="${pr}"
echo "Found Elemental in ${pr}"
Expand All @@ -1709,7 +1697,7 @@ else
fi

if test ! -n "${EL_PREFIX}" ; then
as_fn_error $? "Elemental not found, please specify the prefix of its installation using the flag --with-ElPrefix=/THE/PREFIX" "$LINENO" 5
as_fn_error $? "Elemental not found, please specify the prefix of its installation using the flag --configure-args=--with-ElPrefix=/THE/PREFIX" "$LINENO" 5
fi


Expand Down Expand Up @@ -2257,7 +2245,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by configRElem $as_me v0.01.085, which was
This file was extended by configRElem $as_me v0.2.876, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -2310,7 +2298,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
configRElem config.status v0.01.085
configRElem config.status v0.2.876
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT(configRElem, v0.01.085)
AC_INIT(configRElem, v0.2.876)
AC_ARG_WITH(ElPrefix,
AC_HELP_STRING(--with-ElPrefix=EL_PREFIX,
The elemental prefix at the installation),
Expand All @@ -15,7 +15,7 @@ if test -n "${UsrPrefix}"; then
else
#Checking the common folders
HIDLOC="/.local"
for pr in /usr/local /usr/local/El /usr/local/opt/Elemental /opt/El "$HOME/local" "$HOME/local/El" "$HOME$HIDLOC"; do
for pr in /usr/local /usr/local/El /usr/local/Elemental /usr/share /usr/local/share /opt/El "$HOME/local" "$HOME/local/El" "$HOME$HIDLOC" /usr/local/Cellar/elemental /usr/opt/Cellar/elemental; do
if test -f "${pr}/conf/ElVars"; then
EL_PREFIX="${pr}"
echo "Found Elemental in ${pr}"
Expand All @@ -25,7 +25,7 @@ else
fi

if test ! -n "${EL_PREFIX}" ; then
AC_MSG_ERROR([Elemental not found, please specify the prefix of its installation using the flag --with-ElPrefix=/THE/PREFIX])
AC_MSG_ERROR([Elemental not found, please specify the prefix of its installation using the flag --configure-args=--with-ElPrefix=/THE/PREFIX])
fi

AC_SUBST(EL_PREFIX)
Expand Down
15 changes: 14 additions & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
include @EL_PREFIX@/conf/ElVars

#To check if ElVars has the right location

ifneq (,$(wildcard $(EL_LIB)/libEl* ))
EL_LIBR=$(EL_LIB)
else
ifneq (,$(wildcard $(EL_LIB)64/libEl* ))
EL_LIBR=$(EL_LIB)64
else
#Go back to the original
EL_LIBR=$(EL_LIB)
endif
endif

CC_FLAGS = -std=c99 -O3
EL_PATH=-L$(EL_LIB) -L$(EL_LIB)/external/pmrrr
EL_PATH=-L$(EL_LIBR) -L$(EL_LIBR)/external/pmrrr
LINK_FLAGS = $(EL_LINK_FLAGS)

PKG_CFLAGS = $(CC_FLAGS) $(R_INC) $(ALL_MPI_FLAGS) $(ALL_MATH_INC)
Expand Down

0 comments on commit 1fea004

Please sign in to comment.