Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Java wrapper support to OpenMPI #2360

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion easybuild/easyblocks/o/openmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,20 @@
class EB_OpenMPI(ConfigureMake):
"""OpenMPI easyblock."""

def __init__(self, *args, **kwargs):
super(EB_OpenMPI, self).__init__(*args, **kwargs)
# Define whether we support the OpenMPI Java wrappers (default is no)
self.java = False

def configure_step(self):
"""Custom configuration step for OpenMPI."""

def config_opt_unused(key, enable_opt=False):
def config_opt_unused(key, enable_opt=False, enable_mpi=False):
"""Helper function to check whether a configure option is already specified in 'configopts'."""
if enable_opt:
regex = re.compile('--(disable|enable)-%s' % key)
elif enable_mpi:
regex = re.compile('--(disable|enable)-mpi-%s' % key)
else:
regex = re.compile('--(with|without)-%s' % key)

Expand Down Expand Up @@ -73,6 +80,16 @@ def config_opt_unused(key, enable_opt=False):
opt_name = dep.lower()
self.cfg.update('configopts', '--with-%s=%s' % (opt_name, dep_root))

# handle Java support
java = 'java'
if config_opt_unused(java, enable_mpi=True):
dep_root = get_software_root(java)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't get_software_root case sensitive? If so it should be ('Java') not lowercase...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if dep_root:
self.cfg.update('configopts',
'--enable-mpi-%s --with-jdk-bindir=%s/bin --with-jdk-headers=%s/include' %
(java, dep_root, dep_root))
self.java = True

# check whether VERBS support should be enabled
if config_opt_unused('verbs'):

Expand Down Expand Up @@ -101,11 +118,15 @@ def sanity_check_step(self):
"""Custom sanity check for OpenMPI."""

bin_names = ['mpicc', 'mpicxx', 'mpif90', 'mpifort', 'mpirun', 'ompi_info', 'opal_wrapper', 'orterun']
if self.java:
bin_names.append('mpijavac')
bin_files = [os.path.join('bin', x) for x in bin_names]

shlib_ext = get_shared_lib_ext()
lib_names = ['mpi_mpifh', 'mpi', 'ompitrace', 'open-pal', 'open-rte']
lib_files = [os.path.join('lib', 'lib%s.%s' % (x, shlib_ext)) for x in lib_names]
if self.java:
lib_files.append(os.path.join('lib', 'mpi.jar'))

inc_names = ['mpi-ext', 'mpif-config', 'mpif', 'mpi', 'mpi_portable_platform']
inc_files = [os.path.join('include', x + '.h') for x in inc_names]
Expand All @@ -122,6 +143,8 @@ def sanity_check_step(self):
'mpifort': os.getenv('FC', 'gfortran'),
'mpif90': os.getenv('F90', 'gfortran'),
}
if self.java:
expected['mpijavac'] = 'javac'
# actual pattern for gfortran is "GNU Fortran"
for key in ['mpifort', 'mpif90']:
if expected[key] == 'gfortran':
Expand Down