diff --git a/maint/oss_build.sh b/maint/oss_build.sh new file mode 100755 index 000000000..f3186ab71 --- /dev/null +++ b/maint/oss_build.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -x + +hash="" +# guess default DEV_SIGNATURE +is_git=$(git rev-parse --is-inside-work-tree) +if [ $is_git ]; then + hash="git-"$(git rev-parse --short HEAD) +fi + +BUILDDIR=${BUILDDIR:=/tmp/nccl-exp/2.18.3/build} +NVCC_ARCH=${NVCC_ARCH:="a100,h100"} +CUDA_HOME=${CUDA_HOME:="/usr/local/cuda"} +# TODO: automatically get hg id or git hash +DEV_SIGNATURE=${DEV_SIGNATURE:="$hash"} + +echo "BUILDDIR=${BUILDDIR}" +echo "NVCC_ARCH=${NVCC_ARCH}" +echo "CUDA_HOME=${CUDA_HOME}" +echo "DEV_SIGNATURE=${DEV_SIGNATURE}" + +IFS=',' read -ra arch_array <<< "$NVCC_ARCH" +arch_gencode="" +for arch in "${arch_array[@]}" +do + case "$arch" in + "p100") + arch_gencode="$arch_gencode -gencode=arch=compute_60,code=sm_60" + ;; + "v100") + arch_gencode="$arch_gencode -gencode=arch=compute_70,code=sm_70" + ;; + "a100") + arch_gencode="$arch_gencode -gencode=arch=compute_80,code=sm_80" + ;; + "h100") + arch_gencode="$arch_gencode -gencode=arch=compute_90,code=sm_90" + ;; + esac +done + +echo "NVCC_GENCODE=$arch_gencode" + +# build libnccl +export BUILDDIR=$BUILDDIR +make src.clean && make -j src.build NVCC_GENCODE="$arch_gencode" CUDA_HOME="$CUDA_HOME" DEV_SIGNATURE="$DEV_SIGNATURE" + +# sanity check +pushd examples +export NCCL_HOME=$BUILDDIR +make clean && make all +NCCL_DEBUG=WARN LD_LIBRARY_PATH=$BUILDDIR/lib $BUILDDIR/examples/HelloWorld +popd diff --git a/src/Makefile b/src/Makefile index 77b693e21..62573fff7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -83,6 +83,7 @@ $(INCDIR)/nccl.h : nccl.h.in ../makefiles/version.mk -e "s/\$${nccl:Patch}/$(NCCL_PATCH)/g" \ -e "s/\$${nccl:Suffix}/$(NCCL_SUFFIX)/g" \ -e "s/\$${nccl:Version}/$(NCCL_VERSION)/g" \ + -e "s/\$${nccl:DevSignature}/$(DEV_SIGNATURE)/g" \ $< > $@ $(LIBDIR)/$(LIBTARGET): $(LIBOBJ) $(DEVICELIB) diff --git a/src/nccl.h.in b/src/nccl.h.in index fb0beb135..b1127c3aa 100644 --- a/src/nccl.h.in +++ b/src/nccl.h.in @@ -16,7 +16,7 @@ #define NCCL_MAJOR ${nccl:Major} #define NCCL_MINOR ${nccl:Minor} #define NCCL_PATCH ${nccl:Patch} -#define NCCL_SUFFIX "${nccl:Suffix}" +#define NCCL_SUFFIX "${nccl:Suffix} ${nccl:DevSignature}" #define IS_NCCL_EXP #define NCCL_VERSION_CODE ${nccl:Version}