Date: Saturday, January 7, 2023 @ 21:26:46 Author: tpkessler Revision: 1381790
Migrate rccl from AUR to community Added: rccl/ rccl/repos/ rccl/trunk/ rccl/trunk/PKGBUILD rccl/trunk/test.cpp rccl/trunk/test.sh ----------+ PKGBUILD | 40 +++++++++++++++++++++++++++++++ test.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test.sh | 5 +++ 3 files changed, 123 insertions(+) Added: rccl/trunk/PKGBUILD =================================================================== --- rccl/trunk/PKGBUILD (rev 0) +++ rccl/trunk/PKGBUILD 2023-01-07 21:26:46 UTC (rev 1381790) @@ -0,0 +1,40 @@ +# Maintainer: Torsten Keßler <tpkessler at archlinux dot org> +# Contriubtor: Markus Näther <[email protected]> +# Contributor: acxz <akashpatel2008 at yahoo dot com> + +pkgname=rccl +pkgver=5.4.1 +pkgrel=2 +pkgdesc="ROCm Communication Collectives Library" +arch=('x86_64') +url='https://rccl.readthedocs.io/en/rocm-5.4.1/' +license=('custom') +depends=('hip' 'rocm-smi-lib') +makedepends=('rocm-cmake' 'python') +_git='https://github.com/ROCmSoftwarePlatform/rccl' +source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz") +sha256sums=('d423921c69b3d4c522c109c2f17ec1703f0fa573e2999564803da2fe788f3a00') +_dirname="$(basename $_git)-$(basename ${source[0]} .tar.gz)" + +build() { + # -fcf-protection is not supported by HIP, see + # https://docs.amd.com/bundle/ROCm-Compiler-Reference-Guide-v5.4/page/Appendix_A.html + CXXFLAGS="${CXXFLAGS} -fcf-protection=none" \ + cmake \ + -Wno-dev \ + -B build \ + -S "$_dirname" \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_CXX_COMPILER=/opt/rocm/hip/bin/hipcc \ + -DCMAKE_INSTALL_PREFIX=/opt/rocm + cmake --build build +} + +package() { + DESTDIR="$pkgdir" cmake --install build + + echo "/opt/rocm/$pkgname/lib" > "$pkgname.conf" + install -Dm644 "$pkgname.conf" "$pkgdir/etc/ld.so.conf.d/$pkgname.conf" + + install -Dm644 "$srcdir/$_dirname/LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} Added: rccl/trunk/test.cpp =================================================================== --- rccl/trunk/test.cpp (rev 0) +++ rccl/trunk/test.cpp 2023-01-07 21:26:46 UTC (rev 1381790) @@ -0,0 +1,78 @@ +#include <stdio.h> +#include <hip/hip_runtime.h> +#include <rccl/rccl.h> +#include <math.h> + +#define NDEV 1 + +int main(int argc, char* argv[]) +{ + ncclComm_t comms[NDEV]; + + int size = 100; + int devs[NDEV]; + for(int i = 0; i < NDEV; i++){ + devs[i] = i; + } + + float* hsend = (float*) malloc(size * sizeof *hsend); + float* hrecv = (float*) malloc(size * sizeof *hrecv); + + for (int i = 0; i < size; i++) { + hsend[i] = 1.0f; + hrecv[i] = 0.0f; + } + + float* sendbuff[NDEV]; + float* recvbuff[NDEV]; + hipStream_t s[NDEV]; + for (int i = 0; i < NDEV; i++) { + hipSetDevice(i); + hipMalloc(sendbuff + i, size * sizeof(float)); + hipMalloc(recvbuff + i, size * sizeof(float)); + hipMemcpy(sendbuff[i], hsend, size * sizeof *hsend, hipMemcpyHostToDevice); + hipMemcpy(recvbuff[i], hrecv, size * sizeof *hrecv, hipMemcpyHostToDevice); + hipStreamCreate(s+i); + hipDeviceSynchronize(); + } + + ncclCommInitAll(comms, NDEV, devs); + + ncclGroupStart(); + for (int i = 0; i < NDEV; i++) + ncclAllReduce(&sendbuff[i][0], &recvbuff[i][0], size, ncclFloat, ncclSum, + comms[i], s[i]); + ncclGroupEnd(); + + + for (int i = 0; i < NDEV; i++) { + hipSetDevice(i); + hipStreamSynchronize(s[i]); + } + + hipSetDevice(0); + hipMemcpy(hrecv, recvbuff[0], size * sizeof *hrecv, hipMemcpyDeviceToHost); + hipDeviceSynchronize(); + for (int i = 0; i < size; i++) { + if(fabsf(hsend[i] - hrecv[i]) > 0.001f){ + printf("At entry %i\n", i); + printf("Expected %f\n", hsend[i]); + printf("Received %f\n", hrecv[i]); + return EXIT_FAILURE; + } + } + printf("TESTS PASSED!\n"); + + for (int i = 0; i < NDEV; i++) { + hipSetDevice(i); + hipFree(sendbuff[i]); + hipFree(recvbuff[i]); + } + + for(int i = 0; i < NDEV; ++i){ + ncclCommDestroy(comms[i]); + } + + free(hsend); + free(hrecv); +} Added: rccl/trunk/test.sh =================================================================== --- rccl/trunk/test.sh (rev 0) +++ rccl/trunk/test.sh 2023-01-07 21:26:46 UTC (rev 1381790) @@ -0,0 +1,5 @@ +#! /usr/bin/env sh + +OUT=$(mktemp -d) +/opt/rocm/bin/hipcc -o "$OUT"/test test.cpp -lrccl +"$OUT"/test Property changes on: rccl/trunk/test.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property
