Skip to content

Commit

Permalink
redefine run_async in custom easyblocks for Rmpi and Rserve
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Oct 26, 2021
1 parent b51ab1f commit 1bddb65
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
28 changes: 22 additions & 6 deletions easybuild/easyblocks/r/rmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
class EB_Rmpi(RPackage):
"""Build and install Rmpi R library."""

def run(self, **kwargs):
"""Set various configure arguments prior to building."""
def prepare_rmpi_configureargs(self):
"""
Prepare configure arguments for installing Rpmi.
"""

mpi_types = {
toolchain.MPI_TYPE_OPENMPI: "OPENMPI",
Expand All @@ -51,17 +53,31 @@ def run(self, **kwargs):
# type of MPI
# MPI_TYPE does not distinguish between MPICH and IntelMPI, which is why we also check mpi_family()
mpi_type = self.toolchain.mpi_family()
Rmpi_type = mpi_types[self.toolchain.MPI_TYPE]
rmpi_type = mpi_types[self.toolchain.MPI_TYPE]
# Rmpi versions 0.6-4 and up support INTELMPI (using --with-Rmpi-type=INTELMPI)
if ((LooseVersion(self.version) >= LooseVersion('0.6-4')) and (mpi_type == toolchain.INTELMPI)):
Rmpi_type = 'INTELMPI'
rmpi_type = 'INTELMPI'

self.log.debug("Setting configure args for Rmpi")
self.configureargs = [
"--with-Rmpi-include=%s" % self.toolchain.get_variable('MPI_INC_DIR'),
"--with-Rmpi-libpath=%s" % self.toolchain.get_variable('MPI_LIB_DIR'),
"--with-mpi=%s" % self.toolchain.get_software_root(self.toolchain.MPI_MODULE_NAME)[0],
"--with-Rmpi-type=%s" % Rmpi_type,
"--with-Rmpi-type=%s" % rmpi_type,
]

def run(self):
"""
Install Rmpi as extension, after seting various configure arguments.
"""
self.prepare_rmpi_configureargs()
# it might be needed to get the R cmd and run it with mympirun...
super(EB_Rmpi, self).run()

def run_async(self):
"""
Asynchronously install Rmpi as extension, after seting various configure arguments.
"""
self.prepare_rmpi_configureargs()
# it might be needed to get the R cmd and run it with mympirun...
super(EB_Rmpi, self).run(**kwargs)
super(EB_Rmpi, self).run_async()
8 changes: 6 additions & 2 deletions easybuild/easyblocks/r/rserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
class EB_Rserve(RPackage):
"""Build and install Rserve R library."""

def run(self, **kwargs):
def run(self):
"""Set LIBS environment variable correctly prior to building."""
self.configurevars = ['LIBS="$LIBS -lpthread"']
super(EB_Rserve, self).run()

def run_async(self):
"""Set LIBS environment variable correctly prior to building."""
self.configurevars = ['LIBS="$LIBS -lpthread"']
super(EB_Rserve, self).run(**kwargs)
super(EB_Rserve, self).run_async()

0 comments on commit 1bddb65

Please sign in to comment.