commit:     048319112eead2da41fa2865524f46425161910c
Author:     wangjiezhe <wangjiezhe <AT> gmail <DOT> com>
AuthorDate: Mon May  8 10:43:34 2023 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Mon May  8 21:00:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04831911

sci-libs/gloo: add cuda use flag

Signed-off-by: wangjiezhe <wangjiezhe <AT> gmail.com>
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-libs/gloo/Manifest                             |  1 -
 sci-libs/gloo/files/gloo-2022.05.18-gentoo.patch   | 14 +------
 sci-libs/gloo/files/gloo-2023.01.17-cuda.patch     | 13 ++++++
 sci-libs/gloo/gloo-2022.05.18-r1.ebuild            | 49 ----------------------
 ...2023.01.17.ebuild => gloo-2023.01.17-r1.ebuild} | 19 ++++++++-
 sci-libs/gloo/metadata.xml                         |  1 +
 6 files changed, 33 insertions(+), 64 deletions(-)

diff --git a/sci-libs/gloo/Manifest b/sci-libs/gloo/Manifest
index c103eafd9ee1..07e768131dfa 100644
--- a/sci-libs/gloo/Manifest
+++ b/sci-libs/gloo/Manifest
@@ -1,2 +1 @@
-DIST gloo-2022.05.18.tar.gz 251778 BLAKE2B 
90bd97cff437d030b87c333ebb6679f199491b97826f09278b7a6740d781ca750af4e8eda18f29a4311462473146aae1fd0686443a0eb2c73e8ba34e6837b0af
 SHA512 
356b4bd4480fda0f9db039babd223c17ed24c35945877bdb6c5b28eb45ee8ce08def73d308bc906c478c4c9d485bb0f74080d90c7a4fafe84818df0a97a7f6e2
 DIST gloo-2023.01.17.tar.gz 252199 BLAKE2B 
66b5fc6786a4c07aa639a30036a21d86f43c1577a950934f558051f241d198dd3e0d7bd9da39835c5e3d617a754164cb77ae30b9bc284b0119436bf0a26f5000
 SHA512 
d39102ed00c813576066b755730e367337f2558a4223fe8dd127bd48882db6a97c67522782f7e7b00c36198ccd2096e61e84382358783d2edb1ca4ee55123344

diff --git a/sci-libs/gloo/files/gloo-2022.05.18-gentoo.patch 
b/sci-libs/gloo/files/gloo-2022.05.18-gentoo.patch
index 09f7588a1858..1344d42a0c3f 100644
--- a/sci-libs/gloo/files/gloo-2022.05.18-gentoo.patch
+++ b/sci-libs/gloo/files/gloo-2022.05.18-gentoo.patch
@@ -12,7 +12,7 @@
  set(GLOO_VERSION_PATCH 0)
 --- a/gloo/CMakeLists.txt      2022-06-09 08:41:09.883773600 +0200
 +++ b/gloo/CMakeLists.txt      2022-06-09 08:42:39.045637103 +0200
-@@ -176,7 +176,7 @@
+@@ -181,7 +181,7 @@
  # want to statically link with Gloo and not install any artifacts.
  if(GLOO_INSTALL)
    install(TARGETS gloo EXPORT GlooTargets
@@ -23,7 +23,7 @@
          DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
 --- a/gloo/test/CMakeLists.txt 2022-06-10 22:17:03.682856314 +0200
 +++ b/gloo/test/CMakeLists.txt 2022-06-10 22:17:49.671242697 +0200
-@@ -68,3 +68,4 @@
+@@ -73,3 +73,4 @@
    gloo_hip_add_executable(gloo_test_hip ${GLOO_TEST_HIP_SRCS})
    target_link_libraries(gloo_test_hip gloo_hip gtest OpenSSL::SSL 
OpenSSL::Crypto)
  endif()
@@ -62,16 +62,6 @@
    endif()
  endif()
  
---- a/gloo/transport/tcp/device.cc     2022-08-02 11:25:32.404166606 +0200
-+++ b/gloo/transport/tcp/device.cc     2022-08-02 11:25:48.706963018 +0200
-@@ -12,6 +12,7 @@
- #include <netdb.h>
- #include <netinet/in.h>
- #include <string.h>
-+#include <array>
- 
- #include "gloo/common/linux.h"
- #include "gloo/common/logging.h"
 --- a/gloo/transport/tcp/tls/pair.cc   2022-10-04 21:14:04.099150060 +0200
 +++ b/gloo/transport/tcp/tls/pair.cc   2022-10-04 21:14:22.330886610 +0200
 @@ -17,6 +17,7 @@

diff --git a/sci-libs/gloo/files/gloo-2023.01.17-cuda.patch 
b/sci-libs/gloo/files/gloo-2023.01.17-cuda.patch
new file mode 100644
index 000000000000..1a894d3e4251
--- /dev/null
+++ b/sci-libs/gloo/files/gloo-2023.01.17-cuda.patch
@@ -0,0 +1,13 @@
+diff --git a/gloo/CMakeLists.txt b/gloo/CMakeLists.txt
+index 9ee82df..3b3affb 100644
+--- a/gloo/CMakeLists.txt
++++ b/gloo/CMakeLists.txt
+@@ -184,7 +184,7 @@ if(GLOO_INSTALL)
+           DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   if(USE_CUDA)
+     install(TARGETS gloo_cuda EXPORT GlooTargets
+-        DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   endif()
+   if(USE_ROCM)
+     install(TARGETS gloo_hip EXPORT GlooTargets

diff --git a/sci-libs/gloo/gloo-2022.05.18-r1.ebuild 
b/sci-libs/gloo/gloo-2022.05.18-r1.ebuild
deleted file mode 100644
index f22733551794..000000000000
--- a/sci-libs/gloo/gloo-2022.05.18-r1.ebuild
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2022-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit cmake
-
-CommitId=5b143513263133af2b95547e97c07cebeb72bf72
-
-DESCRIPTION="library of floating-point neural network inference operators"
-HOMEPAGE="https://github.com/facebookincubator/gloo/";
-SRC_URI="https://github.com/facebookincubator/${PN}/archive/${CommitId}.tar.gz
-       -> ${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64"
-IUSE="libuv mpi redis ssl test"
-
-RDEPEND="
-       libuv? ( dev-libs/libuv )
-       mpi? ( virtual/mpi )
-       redis? (
-               dev-db/redis
-               dev-libs/hiredis
-       )
-       ssl? ( dev-libs/openssl:0/1.1 )
-"
-DEPEND="${RDEPEND}
-"
-
-BDEPEND="test? ( dev-cpp/gtest )"
-RESTRICT="test" # For some test the network is needed
-
-S="${WORKDIR}"/${PN}-${CommitId}
-
-PATCHES=(
-       "${FILESDIR}"/${P}-gentoo.patch
-)
-
-src_configure() {
-       local mycmakeargs=(
-               -DBUILD_TEST=$(usex test ON OFF)
-               -DUSE_LIBUV=$(usex libuv ON OFF)
-               -DUSE_MPI=$(usex mpi ON OFF)
-               -DUSE_REDIS=$(usex redis ON OFF)
-               -DUSE_TCP_OPENSSL_LINK=$(usex ssl ON OFF)
-       )
-       cmake_src_configure
-}

diff --git a/sci-libs/gloo/gloo-2023.01.17.ebuild 
b/sci-libs/gloo/gloo-2023.01.17-r1.ebuild
similarity index 72%
rename from sci-libs/gloo/gloo-2023.01.17.ebuild
rename to sci-libs/gloo/gloo-2023.01.17-r1.ebuild
index f9c90704924d..a2c76198f848 100644
--- a/sci-libs/gloo/gloo-2023.01.17.ebuild
+++ b/sci-libs/gloo/gloo-2023.01.17-r1.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
-inherit cmake
+inherit cmake cuda
 
 CommitId=10909297fedab0a680799211a299203e53515032
 
@@ -14,9 +14,10 @@ 
SRC_URI="https://github.com/facebookincubator/${PN}/archive/${CommitId}.tar.gz
 LICENSE="MIT"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="libuv mpi redis ssl test"
+IUSE="cuda libuv mpi redis ssl test"
 
 RDEPEND="
+       cuda? ( <dev-util/nvidia-cuda-toolkit-12:= )
        libuv? ( dev-libs/libuv )
        mpi? ( virtual/mpi )
        redis? (
@@ -35,15 +36,29 @@ S="${WORKDIR}"/${PN}-${CommitId}
 
 PATCHES=(
        "${FILESDIR}"/${PN}-2022.05.18-gentoo.patch
+       "${FILESDIR}"/${P}-cuda.patch
 )
 
+src_prepare() {
+       eapply_user
+       cmake_src_prepare
+       use cuda && cuda_add_sandbox
+}
+
 src_configure() {
        local mycmakeargs=(
                -DBUILD_TEST=$(usex test ON OFF)
+               -DUSE_CUDA=$(usex cuda ON OFF)
+               -DGLOO_USE_CUDA_TOOLKIT=$(usex cuda ON OFF)
                -DUSE_LIBUV=$(usex libuv ON OFF)
                -DUSE_MPI=$(usex mpi ON OFF)
                -DUSE_REDIS=$(usex redis ON OFF)
                -DUSE_TCP_OPENSSL_LINK=$(usex ssl ON OFF)
        )
+       if use cuda; then
+               mycmakeargs+=(
+                       -DCMAKE_CUDA_FLAGS="$(cuda_gccdir -f | tr -d \")"
+               )
+       fi
        cmake_src_configure
 }

diff --git a/sci-libs/gloo/metadata.xml b/sci-libs/gloo/metadata.xml
index 453b2878b484..e83d24904d0f 100644
--- a/sci-libs/gloo/metadata.xml
+++ b/sci-libs/gloo/metadata.xml
@@ -9,6 +9,7 @@
                <remote-id type="github">facebookincubator/gloo</remote-id>
        </upstream>
        <use>
+               <flag name="cuda">Enable CUDA support</flag>
                <flag name="libuv">Enable libuv support</flag>
                <flag name="redis">Enable Redis backend for storage via 
<pkg>dev-libs/hiredis</pkg></flag>
        </use>

Reply via email to