From 748cdfd04fe61c3462b53ca607a2aa95e7d83f5b Mon Sep 17 00:00:00 2001 From: Chirag Pandya Date: Thu, 13 Feb 2025 09:54:45 -0800 Subject: [PATCH] Formatting changes + fix windows OSS build (#409) Summary: Add .clang-format Copied from https://github.com/pytorch/pytorch/blob/main/.clang-format Reviewed By: wconstab, fduwjj Differential Revision: D69275930 Pulled By: d4l3k --- .github/workflows/build-windows.yml | 16 ++++++++-------- .github/workflows/super-linter.yml | 2 ++ gloo/allreduce_bcube.h | 3 +++ gloo/test/base_test.cc | 19 +++++++++++++++++++ gloo/test/base_test.h | 20 ++------------------ 5 files changed, 34 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 26d0d4158..b254151da 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -49,22 +49,22 @@ jobs: cd libuv-v1.38.0 mkdir -p build cd build - mkdir -p ${{ env.gtest_lib_path }} + mkdir -p ${{ env.libuv_path }} cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.libuv_path }} msbuild INSTALL.vcxproj - name: Install googletest run: | conda activate py376_build - curl https://codeload.github.com/google/googletest/tar.gz/release-1.10.0 --output ` - googletest-release-1.10.0.tar.gz - tar xzvf googletest-release-1.10.0.tar.gz - cd googletest-release-1.10.0 + curl -L https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz ` + --output googletest-1.15.2.tar.gz + tar xzvf googletest-1.15.2.tar.gz + cd googletest-1.15.2 mkdir -p build cd build if (Test-Path -Path ${{ env.gtest_lib_path }}) { echo "Directory already exists" } else { - mkdir ${{ env.gtest_lib_path }} + mkdir -p ${{ env.gtest_lib_path }} } cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.gtest_lib_path }} -Dgtest_force_shared_crt=ON msbuild INSTALL.vcxproj @@ -76,9 +76,9 @@ jobs: mkdir -p build cd build cmake .. -DBUILD_TEST=ON -Dlibuv_ROOT=${{ env.libuv_path }} ` - -DGTEST_LIBRARY=${{ env.gtest_lib_path }}/lib/gtestd.lib ` + -DGTEST_LIBRARY=${{ env.gtest_lib_path }}/lib/gtest.lib ` -DGTEST_INCLUDE_DIR=${{ env.gtest_lib_path }}/include ` - -DGTEST_MAIN_LIBRARY=${{ env.gtest_lib_path }}/lib/gtest_maind.lib + -DGTEST_MAIN_LIBRARY=${{ env.gtest_lib_path }}/lib/gtest_main.lib msbuild ALL_BUILD.vcxproj - name: Test run: | diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index c09cf00ae..2425d12b8 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -34,3 +34,5 @@ jobs: DEFAULT_BRANCH: "main" # disable JSCPD (copy-paste checker) VALIDATE_JSCPD: false + # disable CPP + VALIDATE_CPP: false diff --git a/gloo/allreduce_bcube.h b/gloo/allreduce_bcube.h index 2ea7f0897..603176c10 100644 --- a/gloo/allreduce_bcube.h +++ b/gloo/allreduce_bcube.h @@ -15,7 +15,10 @@ #include #include #include +#include +#include #include +#include #include "gloo/algorithm.h" #include "gloo/common/error.h" diff --git a/gloo/test/base_test.cc b/gloo/test/base_test.cc index c481678ae..db320d0df 100644 --- a/gloo/test/base_test.cc +++ b/gloo/test/base_test.cc @@ -14,6 +14,25 @@ namespace test { const char* kDefaultDevice = "localhost"; +// Transports that instantiated algorithms can be tested against. +const std::vector kTransportsForClassAlgorithms = { + Transport::TCP, +#if GLOO_HAVE_TRANSPORT_TCP_TLS + Transport::TCP_TLS, +#endif +}; + +// Transports that function algorithms can be tested against. +// This is the new style of calling collectives and must be +// preferred over the instantiated style. +const std::vector kTransportsForFunctionAlgorithms = { + Transport::TCP, +#if GLOO_HAVE_TRANSPORT_TCP_TLS + Transport::TCP_TLS, +#endif + Transport::UV, +}; + std::shared_ptr<::gloo::transport::Device> createDevice(Transport transport) { #if GLOO_HAVE_TRANSPORT_TCP if (transport == Transport::TCP) { diff --git a/gloo/test/base_test.h b/gloo/test/base_test.h index 605b4b914..fe2347265 100644 --- a/gloo/test/base_test.h +++ b/gloo/test/base_test.h @@ -65,24 +65,8 @@ enum Transport { UV, }; -// Transports that instantiated algorithms can be tested against. -const std::vector kTransportsForClassAlgorithms{ - Transport::TCP, -#if GLOO_HAVE_TRANSPORT_TCP_TLS - Transport::TCP_TLS, -#endif -}; - -// Transports that function algorithms can be tested against. -// This is the new style of calling collectives and must be -// preferred over the instantiated style. -const std::vector kTransportsForFunctionAlgorithms{ - Transport::TCP, -#if GLOO_HAVE_TRANSPORT_TCP_TLS - Transport::TCP_TLS, -#endif - Transport::UV, -}; +extern const std::vector kTransportsForClassAlgorithms; +extern const std::vector kTransportsForFunctionAlgorithms; std::shared_ptr<::gloo::transport::Device> createDevice(Transport transport);