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

enhance Rosetta easyblock to build with serialization support #2843

Open
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 30 additions & 26 deletions easybuild/easyblocks/r/rosetta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright 2009-2022 Ghent University
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
Expand Down Expand Up @@ -30,25 +30,35 @@
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
@author: Ali Kerrache (University of Manitoba)
"""
import fileinput
import os
import re
import shutil
import sys
import easybuild.tools.toolchain as toolchain

from easybuild.easyblocks.icc import get_icc_version
from easybuild.framework.easyblock import EasyBlock
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import change_dir, extract_file, mkdir, write_file
from easybuild.tools.modules import get_software_version
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import get_shared_lib_ext

from distutils.version import LooseVersion
from easybuild.framework.easyconfig import CUSTOM

class EB_Rosetta(EasyBlock):
"""Support for building/installing Rosetta."""

@staticmethod
def extra_options():
extra_vars = {
'serialization': [False, "Enable mpi,serialization build for Rosetta.", CUSTOM],
}
return EasyBlock.extra_options(extra_vars)

def __init__(self, *args, **kwargs):
"""Add extra config options specific to Rosetta."""
super(EB_Rosetta, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -109,7 +119,10 @@ def configure_step(self):
self.cfg.update('buildopts', "cxx=%s cxx_ver=%s" % (self.cxx, cxx_ver))

if self.toolchain.options.get('usempi', None):
self.cfg.update('buildopts', 'extras=mpi')
if self.cfg['serialization']:
self.cfg.update('buildopts', 'extras=mpi,serialization')
else:
self.cfg.update('buildopts', 'extras=mpi')
defines.extend(['USEMPI', 'MPICH_IGNORE_CXX_SEEK'])

# make sure important environment variables are passed down
Expand All @@ -121,20 +134,16 @@ def configure_step(self):
self.log.debug("List of extra environment variables to pass down: %s" % str(env_vars))

# create user.settings file
paths = os.getenv('PATH')
paths = paths.split(':') if paths else []
ld_library_paths = os.getenv('LD_LIBRARY_PATH')
ld_library_paths = ld_library_paths.split(':') if ld_library_paths else []
cpaths = os.getenv('CPATH')
cpaths = cpaths.split(':') if cpaths else []
paths = os.getenv('PATH').split(':')
#ld_library_paths = os.getenv('LD_LIBRARY_PATH').split(':')
Copy link

Choose a reason for hiding this comment

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

block comment should start with '# '

Copy link
Author

Choose a reason for hiding this comment

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

This one was fixed in the previous PR #2744

cpaths = os.getenv('CPATH').split(':')
Copy link

Choose a reason for hiding this comment

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

local variable 'cpaths' is assigned to but never used

flags = [str(f).strip('-') for f in self.toolchain.variables['CXXFLAGS'].copy()]

txt = '\n'.join([
"import os",
"settings = {",
" 'user': {",
" 'prepends': {",
" 'library_path': %s," % str(ld_library_paths),
" 'include_path': %s," % str(cpaths),
" },",
" 'appends': {",
" 'program_path': %s," % str(paths),
Expand All @@ -145,18 +154,7 @@ def configure_step(self):
" 'defines': %s," % str(defines),
" },",
" 'overrides': {",
" 'cc': '%s'," % os.getenv('CC'),
" 'cxx': '%s'," % os.getenv('CXX'),
" 'ENV': {",
" 'INTEL_LICENSE_FILE': '%s'," % os.getenv('INTEL_LICENSE_FILE'), # Intel license file
" 'PATH': %s," % str(paths),
" 'LD_LIBRARY_PATH': %s," % str(ld_library_paths),
Copy link
Member

Choose a reason for hiding this comment

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

@alikerr These look like unintended changes to the exiting easyblock?

])
txt += '\n'
for (key, val) in env_vars.items():
txt += " '%s': '%s',\n" % (key, val)
txt += '\n'.join([
" },",
" 'ENV': os.environ,",
" },",
" 'removes': {",
" },",
Expand Down Expand Up @@ -250,8 +248,11 @@ def extract_and_copy(dirname_tmpl, optional=False, symlinks=False):
if os.path.exists(os.path.join(self.cfg['start_dir'], 'main', 'database')):
extract_and_copy(os.path.join('main', 'database') + '%s')
else:
extract_and_copy('rosetta_database%s')

self.looseversion = LooseVersion(self.version)
if self.looseversion <= LooseVersion('3.12'):
extract_and_copy('rosetta_database%s')
else:
extract_and_copy('database%s')
extract_and_copy('demos%s', optional=True, symlinks=True)
extract_and_copy('documentation%s', optional=True, symlinks=True)
extract_and_copy('BioTools%s', optional=True)
Expand All @@ -276,7 +277,10 @@ def sanity_check_step(self):

infix = ''
if self.toolchain.options.get('usempi', None):
infix = 'mpi.'
if self.cfg['serialization']:
infix = 'mpiserialization.'
else:
infix = 'mpi.'

binaries = ["AbinitioRelax", "backrub", "cluster", "combine_silent", "extract_pdbs",
"idealize_jd2", "packstat", "relax", "score_jd2", "score"]
Expand Down