From 4d49dc04b2a745fdcd355bfb6a23abdd087e5872 Mon Sep 17 00:00:00 2001 From: Nicholas Sielicki Date: Thu, 15 Aug 2024 09:23:47 -0700 Subject: [PATCH] ci: add srpm generation --- .github/workflows/srpm.yaml | 19 ++++++++ .gitignore | 1 + .packit.yml | 20 ++++++++ .version | 1 + Makefile.am | 1 + configure.ac | 2 +- libnccl-net-ofi.spec | 94 +++++++++++++++++++++++++++++++++++++ 7 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/srpm.yaml create mode 100644 .packit.yml create mode 100644 .version create mode 100644 libnccl-net-ofi.spec diff --git a/.github/workflows/srpm.yaml b/.github/workflows/srpm.yaml new file mode 100644 index 000000000..689629ff4 --- /dev/null +++ b/.github/workflows/srpm.yaml @@ -0,0 +1,19 @@ +name: generate SRPM +on: [push, pull_request] +jobs: + srpm: + runs-on: ubuntu-latest + container: + image: fedora:rawhide + options: --privileged + steps: + - run: dnf install -y packit git nodejs + - uses: actions/checkout@v4 + - run: git config --global --add safe.directory /__w/aws-ofi-nccl/aws-ofi-nccl + - run: packit srpm + - uses: actions/upload-artifact@v4 + with: + name: "libnccl-net-ofi.src.rpm" + path: "*.src.rpm" + if-no-files-found: 'error' + compression-level: '0' diff --git a/.gitignore b/.gitignore index 7f8ecadfc..7a54bc9ca 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ m4/lt~obsolete.m4 .idea/ .devenv/ .direnv +*.src.rpm diff --git a/.packit.yml b/.packit.yml new file mode 100644 index 000000000..3425859c3 --- /dev/null +++ b/.packit.yml @@ -0,0 +1,20 @@ +--- +# vi:ts=2 sw=2 et: +# +# Docs: https://packit.dev/docs/ + + +srpm_build_deps: + - git + +actions: + get-current-version: + - bash -c "cat .version" + create-archive: + - bash -c "git archive --prefix=libnccl-net-ofi/ --format=tgz --output=libnccl-net-ofi_${PACKIT_PROJECT_VERSION}.tar.gz HEAD src/ include/ doc/ m4/ tests/ topology/ configure.ac Makefile.am LICENSE NOTICE .version && echo libnccl-net-ofi_${PACKIT_PROJECT_VERSION}.tar.gz" + +specfile_path: libnccl-net-ofi.spec +upstream_package_name: libnccl-net-ofi +downstream_package_name: libnccl-net-ofi +release_suffix: "{PACKIT_PROJECT_BRANCH}" +update_release: false diff --git a/.version b/.version new file mode 100644 index 000000000..f32954fbd --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.12.0pre diff --git a/Makefile.am b/Makefile.am index f2fdfa8d2..8b9c600d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,7 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include src topology tests EXTRA_DIST = \ + .version \ autogen.sh \ CODE_OF_CONDUCT.md \ CONTRIBUTING.md \ diff --git a/configure.ac b/configure.ac index 6e68a27e1..2965ccd5a 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ # # Initialization -AC_INIT([aws-ofi-nccl], [GitHub-dev], [al-ofi-nccl-team@amazon.com], , [http://github.com/aws/aws-ofi-nccl]) +AC_INIT([aws-ofi-nccl], m4_normalize(m4_include([.version])), [al-ofi-nccl-team@amazon.com], , [http://github.com/aws/aws-ofi-nccl]) AC_PREREQ([2.69]) AC_CONFIG_SRCDIR([src/nccl_ofi_net.c]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/libnccl-net-ofi.spec b/libnccl-net-ofi.spec new file mode 100644 index 000000000..b529954ed --- /dev/null +++ b/libnccl-net-ofi.spec @@ -0,0 +1,94 @@ +# Whether to build with cuda support. Default: on if neuron +%if "%{with_cuda}" == "1" && "%{with_neuron}" == "1" +%{error:Neuron and CUDA must not be enabled together} +%endif + +%if "%{with_cuda}" == "0" && "%{with_neuron}" == "0" +%{error:One of Neuron or CUDA must be enabled} +%endif + +%if "%{with_cuda}" == "1" +%{!?target: %global target nccl} +%endif +%if "%{with_neuron}" == "1" +%{!?target: %global target nccom} +%endif + +%global pname_base lib%{!?with_neuron:nccl}%{?with_neuron:nccom}-net-ofi +%global pname %{pname_base}%{?with_platform_aws:-aws} + +%if "%{with_platform_aws}" +%global _prefix /opt/amazon/%{pname_base} +%endif + +# (CUDA only) what toolkit package to declare a build dependency on. Default: 12-6 +%{!?_cuda_toolkit_version: %global _cuda_toolkit_version 12-6} + +Name: %{pname} +Version: null +Release: 0%{dist} +Summary: NCCL + libfabric compatibility layer +License: Apache-2.0 +URL: https://github.com/aws/aws-ofi-nccl +Source0: null +%if "%{_vendor}" == "debbuild" +Group: devel +%else +Group: Development/Tools%{?suse_version:/Building} +BuildRequires: hwloc-devel +BuildRequires: libfabric-%{?with_platform_aws:aws-}devel +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +%if "%{with_cuda}" == "1" +BuildRequires: cuda-cudart-devel-%{_cuda_toolkit_version} +%endif +%endif +Requires: hwloc +Requires: libfabric%{?with_platform_aws:-aws} + +%description +This is a plugin which lets EC2 developers use libfabric as network provider +while running NCCL applications. + + +%prep +%setup +%build +autoreconf -ivf +%configure \ + --prefix="%{_prefix}" \ + --disable-tests \ + --with-mpi=no \ +%if "%{with_cuda}" == "1" + --with-cuda=/usr/local/cuda-12 \ + --enable-neuron=no \ +%else + --with-cuda=no \ + --enable-neuron=yes \ +%endif +%if "%{with_platform_aws}" == "1" + --enable-platform-aws \ + --with-libfabric=/opt/amazon/efa +%else + --disable-platform-aws +%endif +%make_build + + +%install +%make_install +find %{buildroot} -name '*.la' -exec rm -f {} ';' +%ldconfig_scriptlets + + +%files +%{_libdir}/*.so +%{_datadir}/aws-ofi-nccl/xml/*.xml +%license LICENSE NOTICE +%doc + + +%changelog +* Thu Aug 08 2024 Nicholas Sielicki +Initial Package