Skip to content

Commit

Permalink
Merge pull request #2337 from branfosj/20210218110544_new_pr_HLAhDiQQgW
Browse files Browse the repository at this point in the history
new easyblock for NCCL (built from source)
  • Loading branch information
smoors authored Jun 7, 2021
2 parents 05a4c2f + f121a40 commit fe86bfd
Showing 1 changed file with 66 additions and 0 deletions.
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()

0 comments on commit fe86bfd

Please sign in to comment.