Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorBaker committed Jul 5, 2023
1 parent fe98e88 commit 448fb88
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 132 deletions.
50 changes: 25 additions & 25 deletions pkgs/development/libraries/science/math/gloo/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
config,
fetchFromGitHub,
lib,
stdenv,
# nativeBuildInputs
cmake,
ninja,
pkg-config,
pkg-config, # to find libuv
# buildInputs
cudaPackages, # for cuda
openssl,
Expand All @@ -14,7 +15,6 @@
gtest,
# Configuration options
buildSharedLibs ? true,
config,
useCuda ? config.cudaSupport or false,
useLibUv ? true,
}: let
Expand Down Expand Up @@ -66,16 +66,19 @@ in
cuda_nvcc # crt/host_config.h
nccl
];
checkInputs = [gtest];

# NOTE: Gloo won't build with OpenSSL != 1.1 at the moment. See
# https://github.com/facebookincubator/gloo/issues/358 for more.
postPatch =
# Gloo won't build with OpenSSL != 1.1 at the moment. See
# https://github.com/facebookincubator/gloo/issues/358 for more.
''
substituteInPlace gloo/CMakeLists.txt \
--replace \
'find_package(OpenSSL 1.1 REQUIRED EXACT)' \
'find_package(OpenSSL REQUIRED)'
substituteInPlace gloo/test/CMakeLists.txt \
--replace \
'find_package(OpenSSL 1.1 REQUIRED EXACT)' \
'find_package(OpenSSL REQUIRED)'
''
# Gloo doesn't allow us to manually specify exactly what architectures to build for,
# so we do a bit of hack and change the list of known architectures to the one we want.
Expand All @@ -84,34 +87,31 @@ in
--replace \
'set(gloo_known_gpu_archs ' \
'set(gloo_known_gpu_archs "${cudaArchitecturesString}") #'
''
+ strings.optionalString finalAttrs.doCheck ''
substituteInPlace gloo/test/CMakeLists.txt \
--replace \
'find_package(OpenSSL 1.1 REQUIRED EXACT)' \
'find_package(OpenSSL REQUIRED)'
'';

cmakeFlags =
[
"-DBUILD_BENCHMARK=OFF" # Produces binaries in out
"-DBUILD_SHARED_LIBS=${setBuildSharedLibrary buildSharedLibs}"
"-DBUILD_TEST=${setBool finalAttrs.doCheck}"
"-DGLOO_USE_CUDA_TOOLKIT=OFF" # We use redistributables, not the toolkit
"-DUSE_CUDA=${setBool useCuda}"
"-DUSE_IBVERBS=OFF"
"-DUSE_LIBUV=${setBool useLibUv}"
"-DUSE_NCCL=${setBool useCuda}"
"-DUSE_RCCL=OFF"
"-DUSE_REDIS=OFF"
"-DUSE_TCP_OPENSSL_LINK=OFF"
"-DUSE_TCP_OPENSSL_LOAD=ON" # default for PyTorch
"-DBUILD_BENCHMARK:BOOL=OFF" # Produces binaries in out
"-DBUILD_SHARED_LIBS:STRING=${setBuildSharedLibrary buildSharedLibs}"
"-DBUILD_TEST:BOOL=${setBool finalAttrs.doCheck}"
"-DGLOO_USE_CUDA_TOOLKIT:BOOL=OFF" # We use redistributables, not the toolkit
"-DUSE_CUDA:BOOL=${setBool useCuda}"
"-DUSE_IBVERBS:BOOL=OFF"
"-DUSE_LIBUV:BOOL=${setBool useLibUv}"
"-DUSE_NCCL:BOOL=${setBool useCuda}"
"-DUSE_RCCL:BOOL=OFF"
"-DUSE_REDIS:BOOL=OFF"
"-DUSE_TCP_OPENSSL_LINK:BOOL=OFF"
"-DUSE_TCP_OPENSSL_LOAD:BOOL=ON" # default for PyTorch
]
++ lists.optionals useCuda [
"-DCMAKE_C_COMPILER=${backendStdenv.cc}/bin/cc"
"-DCMAKE_CXX_COMPILER=${backendStdenv.cc}/bin/c++"
"-DCMAKE_C_COMPILER:FILEPATH=${backendStdenv.cc}/bin/cc"
"-DCMAKE_CXX_COMPILER:FILEPATH=${backendStdenv.cc}/bin/c++"
];

doCheck = false;
checkInputs = [gtest];

meta = with lib; {
description = "Collective communications library with various primitives for multi-machine training";
homepage = "https://github.com/facebookincubator/gloo";
Expand Down
Loading

0 comments on commit 448fb88

Please sign in to comment.