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 custom easyblock for NCCL (built from source) #2337

Merged
Merged
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
66 changes: 66 additions & 0 deletions easybuild/easyblocks/n/nccl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
##
# Copyright 2021-2021 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 NCCL, implemented as an easyblock

@author: Simon Branford (University of Birmingham)
"""
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.config import build_option


class EB_NCCL(ConfigureMake):
"""Support for building NCCL."""

def configure_step(self):
"""NCCL has no configure step"""
pass

def build_step(self):
"""Build NCCL"""
# NCCL builds for all supported CUDA compute capabilities by default
# If cuda_compute_capabilities is specified then we override this with the selected options

# list of CUDA compute capabilities to use can be specifed in three ways (where 3 overrules 2 overrules 1):
# (1) in the easyconfig file, via the custom cuda_compute_capabilities;
# (2) via the EasyBuild environment variable EASYBUILD_CUDA_COMPUTE_CAPABILITIES;
# (3) in the EasyBuild configuration, via --cuda-compute-capabilities configuration option;
cuda_cc = build_option('cuda_compute_capabilities') or self.cfg['cuda_compute_capabilities']

nvcc_gencode = []
for cc in cuda_cc:
add = cc.replace('.', '')
nvcc_gencode.append('-gencode=arch=compute_%s,code=sm_%s' % (add, add))

if nvcc_gencode:
self.cfg.update('buildopts', 'NVCC_GENCODE="%s"' % ' '.join(nvcc_gencode))

super(EB_NCCL, self).build_step()

def install_step(self):
"""Install NCCL"""
self.cfg.update('installopts', "PREFIX=%s" % self.installdir)

super(EB_NCCL, self).install_step()