Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ set(NVFUSER_CUTLASS "${NVFUSER_ROOT}/cutlass")
set(NVFUSER_THIRD_PARTY_DIR "${NVFUSER_ROOT}/third_party")

option(NVFUSER_STANDALONE_BUILD_WITH_UCC "" OFF)
option(NVFUSER_STANDALONE_BUILD_WITH_NIXL "" OFF)
option(NVFUSER_EXPLICIT_ERROR_CHECK "" OFF)
option(NVFUSER_ENABLE_DEPENDENCY_REPORT "Enable Python-based dependency reporting and log capture" ON)

Expand Down Expand Up @@ -248,6 +249,7 @@ list(APPEND NVFUSER_SRCS
${NVFUSER_SRCS_DIR}/multidevice/ipc_utils.cpp
${NVFUSER_SRCS_DIR}/multidevice/device_mesh.cpp
${NVFUSER_SRCS_DIR}/multidevice/executor.cpp
${NVFUSER_SRCS_DIR}/multidevice/nixl.cpp
${NVFUSER_SRCS_DIR}/multidevice/execution_utils.cpp
${NVFUSER_SRCS_DIR}/multidevice/propagation.cpp
${NVFUSER_SRCS_DIR}/multidevice/resharding.cpp
Expand Down Expand Up @@ -583,6 +585,37 @@ if(NVFUSER_STANDALONE_BUILD_WITH_UCC)
target_compile_definitions(codegen_internal PRIVATE NVFUSER_BUILD_WITH_UCC)
endif()

if(NVFUSER_STANDALONE_BUILD_WITH_NIXL)
# User may need to set NIXL_PREFIX to the NIXL install directory.
find_path(NIXL_INCLUDE_DIR nixl.h
HINTS $ENV{NIXL_PREFIX}/include ENV CPATH
)
find_library(NIXL_LIBRARY nixl
HINTS $ENV{NIXL_PREFIX}/lib $ENV{NIXL_PREFIX}/lib64 $ENV{NIXL_PREFIX}/lib/x86_64-linux-gnu
)
find_library(NIXL_BUILD_LIBRARY nixl_build
HINTS $ENV{NIXL_PREFIX}/lib $ENV{NIXL_PREFIX}/lib64 $ENV{NIXL_PREFIX}/lib/x86_64-linux-gnu
)

if(NOT NIXL_INCLUDE_DIR OR NOT NIXL_LIBRARY)
message(FATAL_ERROR "NIXL not found. Set NIXL_PREFIX to the NIXL install directory.")
endif()

message(STATUS "Found NIXL: ${NIXL_LIBRARY} (include: ${NIXL_INCLUDE_DIR})")
if(NIXL_BUILD_LIBRARY)
message(STATUS "Found NIXL build lib: ${NIXL_BUILD_LIBRARY}")
endif()

add_library(__nvfuser_nixl INTERFACE)
target_include_directories(__nvfuser_nixl INTERFACE ${NIXL_INCLUDE_DIR})
target_link_libraries(__nvfuser_nixl INTERFACE ${NIXL_LIBRARY})
if(NIXL_BUILD_LIBRARY)
target_link_libraries(__nvfuser_nixl INTERFACE ${NIXL_BUILD_LIBRARY})
endif()
target_link_libraries(codegen_internal PRIVATE __nvfuser_nixl)
target_compile_definitions(codegen_internal PRIVATE USE_NIXL)
endif()

add_dependencies(codegen_internal flatc build_flatbuffer_config)

# installing nvfuser headers
Expand Down Expand Up @@ -1031,6 +1064,7 @@ if(BUILD_TEST)
${NVFUSER_ROOT}/tests/cpp/test_multidevice_lower_communication.cpp
${NVFUSER_ROOT}/tests/cpp/test_multidevice_lower_communication_cuda.cpp
${NVFUSER_ROOT}/tests/cpp/test_multidevice_matmul.cpp
${NVFUSER_ROOT}/tests/cpp/test_multidevice_nixl.cpp
${NVFUSER_ROOT}/tests/cpp/test_multidevice_pipeline.cpp
${NVFUSER_ROOT}/tests/cpp/test_multidevice_sharding.cpp
${NVFUSER_ROOT}/tests/cpp/test_multidevice_stream_parallel_type.cpp
Expand Down Expand Up @@ -1332,6 +1366,11 @@ if(NVFUSER_STANDALONE_BUILD_WITH_UCC)
message(STATUS " UCX_DIR : $ENV{UCX_DIR}")
endif()
message(STATUS " NVFUSER_STANDALONE_BUILD_WITH_UCC : ${NVFUSER_STANDALONE_BUILD_WITH_UCC}")
message(STATUS " NVFUSER_STANDALONE_BUILD_WITH_NIXL : ${NVFUSER_STANDALONE_BUILD_WITH_NIXL}")
if(NVFUSER_STANDALONE_BUILD_WITH_NIXL)
message(STATUS " NIXL_INCLUDE_DIR: ${NIXL_INCLUDE_DIR}")
message(STATUS " NIXL_LIBRARY : ${NIXL_LIBRARY}")
endif()
message(STATUS " NVFUSER_BUILD_WITH_ASAN : ${NVFUSER_BUILD_WITH_ASAN}")
message(STATUS " NVFUSER_DISTRIBUTED : ${NVFUSER_DISTRIBUTED}")
message(STATUS " NVFUSER_CPP_STANDARD : ${NVFUSER_CPP_STANDARD}")
Expand Down
3 changes: 3 additions & 0 deletions csrc/multidevice/communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ std::ostream& operator<<(std::ostream& out, const CommunicatorBackend& cb) {
case CommunicatorBackend::kCuda:
out << "CUDA";
break;
case CommunicatorBackend::kNixl:
out << "NIXL";
break;
}
return out;
}
Expand Down
13 changes: 12 additions & 1 deletion csrc/multidevice/communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <ATen/core/ivalue.h>
#include <c10/util/intrusive_ptr.h>

#include <cstdint>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

#include <cstring>

#ifdef NVFUSER_DISTRIBUTED
#include <torch/csrc/distributed/c10d/Backend.hpp>
#include <torch/csrc/distributed/c10d/TCPStore.hpp>
Expand Down Expand Up @@ -116,13 +119,20 @@ class NVF_API Communicator {
return ucc_available_;
} else if (backend == CommunicatorBackend::kNccl) {
return nccl_available_;
} else if (backend == CommunicatorBackend::kNixl) {
#ifdef USE_NIXL
return true;
#else
return false;
#endif
Comment on lines +123 to +127
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic LGTM but for consistency in the implementation please mimick what is done with nccl_available_ and ucc_available_

}
return false;
}

c10d::TCPStore* getTcpStore() {
return store_.get();
}
}


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line here and below

private:
Communicator(
Expand Down Expand Up @@ -155,4 +165,5 @@ class NVF_API Communicator {
std::unordered_map<std::string, c10::intrusive_ptr<c10d::Backend>> backends_;
};


} // namespace nvfuser
2 changes: 1 addition & 1 deletion csrc/multidevice/multidevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ using DeviceType = c10::Device;
using Team = std::vector<DeviceIdxType>;

// Supported backends.
enum class CommunicatorBackend { kNccl, kUcc, kCuda };
enum class CommunicatorBackend { kNccl, kUcc, kCuda, kNixl };
} // namespace nvfuser
Loading
Loading