diff --git a/CMakeLists.txt b/CMakeLists.txt index b5442d7da1a..b5659ccaeb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,21 +83,13 @@ else () set(CPU_INTEL OFF) endif () -# For Windows, turn USE_DISTRIBUTED off by default. +# For non-supported platforms, turn USE_DISTRIBUTED off by default. # It is not tested and likely won't work without additional changes. -if(MSVC) +if(NOT LINUX) set(USE_DISTRIBUTED OFF CACHE STRING "Use distributed") -endif() - -# For macOS, turn USE_DISTRIBUTED off by default. -# Gloo depends on libuv, which has to be installed by the user first. -# Therefore, the user should explicitly specify -DUSE_DISTRIBUTED=1 -# to build torch.distributed, after installing the dependency. -if(APPLE) - set(USE_DISTRIBUTED OFF CACHE STRING "Use distributed") - # If USE_DISTRIBUTED is set, also set USE_LIBUV=1 for Gloo. - # It is the only transport that can be built on macOS. - if(USE_DISTRIBUTED) + # On macOS, if USE_DISTRIBUTED is enabled (specified by the user), + # then make Gloo build with the libuv transport. + if(APPLE AND USE_DISTRIBUTED) set(USE_LIBUV ON CACHE STRING "") endif() endif()