Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
82 changes: 82 additions & 0 deletions easybuild/easyblocks/h/hpcc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
##
# Copyright 2009-2023 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# https://github.com/easybuilders/easybuild
#
# EasyBuild 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 v2.
#
# EasyBuild 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 EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for building and installing HPCC, implemented as an easyblock

@author: Samuel Moors (Vrije Universiteit Brussel)
"""

import os
import shutil

from easybuild.easyblocks.hpl import EB_HPL
from easybuild.tools.build_log import EasyBuildError


class EB_HPCC(EB_HPL):
"""
Support for building HPCC (HPC Challenge)
- create Make.UNKNOWN
- build with make and install
"""

def configure_step(self):
"""
Create Make.UNKNOWN file to build from
"""
super(EB_HPCC, self).configure_step(subdir='hpl')

def build_step(self):
"""
Build with make and correct make options
"""
super(EB_HPCC, self).build_step(topdir='../../..')

def install_step(self):
"""
Install by copying files to install dir
"""
srcdir = self.cfg['start_dir']
destdir = os.path.join(self.installdir, 'bin')
srcfile = None
try:
os.makedirs(destdir)
for filename in ["hpcc", "_hpccinf.txt"]:
srcfile = os.path.join(srcdir, filename)
shutil.copy2(srcfile, destdir)
except OSError as err:
raise EasyBuildError("Copying %s to installation dir %s failed: %s", srcfile, destdir, err)

def sanity_check_step(self):
"""
Custom sanity check for HPL
"""

custom_paths = {
'files': ["bin/hpcc"],
'dirs': []
}

super(EB_HPL, self).sanity_check_step(custom_paths)
15 changes: 10 additions & 5 deletions easybuild/easyblocks/h/hpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import change_dir, remove_file, symlink
from easybuild.tools.run import run_cmd


Expand All @@ -62,7 +63,7 @@ def configure_step(self, subdir=None):
setupdir = os.path.join(basedir, 'setup')

try:
os.chdir(setupdir)
change_dir(setupdir)
except OSError as err:
raise EasyBuildError("Failed to change to to dir %s: %s", setupdir, err)

Expand All @@ -71,16 +72,18 @@ def configure_step(self, subdir=None):
run_cmd(cmd, log_all=True, simple=True, log_output=True)

try:
os.symlink(os.path.join(setupdir, 'Make.UNKNOWN'), os.path.join(makeincfile))
remove_file(os.path.join(makeincfile))
symlink(os.path.join(setupdir, 'Make.UNKNOWN'), os.path.join(makeincfile))
except OSError as err:
raise EasyBuildError("Failed to symlink Make.UNKNOWN from %s to %s: %s", setupdir, makeincfile, err)

# go back
os.chdir(self.cfg['start_dir'])
change_dir(self.cfg['start_dir'])

def build_step(self):
def build_step(self, topdir=None):
"""
Build with make and correct make options
- provide topdir argument so this can be reused in HPCC easyblock
"""

for envvar in ['MPICC', 'LIBLAPACK_MT', 'CPPFLAGS', 'LDFLAGS', 'CFLAGS']:
Expand All @@ -89,7 +92,9 @@ def build_step(self):
raise EasyBuildError("Required environment variable %s not found (no toolchain used?).", envvar)

# build dir
extra_makeopts = 'TOPdir="%s" ' % self.cfg['start_dir']
if not topdir:
topdir = self.cfg['start_dir']
extra_makeopts = 'TOPdir="%s" ' % topdir

# compilers
extra_makeopts += 'CC="%(mpicc)s" MPICC="%(mpicc)s" LINKER="%(mpicc)s" ' % {'mpicc': os.getenv('MPICC')}
Expand Down