mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Add a no_ibv
This commit is contained in:
@@ -1,2 +1,8 @@
|
||||
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ibv.cpp)
|
||||
target_link_libraries(mlx PRIVATE rdma)
|
||||
if(MLX_BUILD_CPU
|
||||
AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin"
|
||||
AND MACOS_SDK_VERSION GREATER_EQUAL 26.2)
|
||||
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ibv.cpp)
|
||||
target_link_libraries(mlx PRIVATE rdma)
|
||||
else()
|
||||
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/no_ibv.cpp)
|
||||
endif()
|
||||
|
||||
@@ -1077,7 +1077,9 @@ class IBVGroup : public GroupImpl {
|
||||
};
|
||||
|
||||
bool is_available() {
|
||||
return true;
|
||||
if (__builtin_available(macOS 26.2, *)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<GroupImpl> init(bool strict /* = false */) {
|
||||
|
||||
20
mlx/distributed/ibv/no_ibv.cpp
Normal file
20
mlx/distributed/ibv/no_ibv.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright © 2025 Apple Inc.
|
||||
|
||||
#include "mlx/distributed/ibv/ibv.h"
|
||||
|
||||
namespace mlx::core::distributed::ibv {
|
||||
|
||||
using GroupImpl = mlx::core::distributed::detail::GroupImpl;
|
||||
|
||||
bool is_available() {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<GroupImpl> init(bool strict /* = false */) {
|
||||
if (strict) {
|
||||
throw std::runtime_error("Cannot initialize ibv distributed backend.");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace mlx::core::distributed::ibv
|
||||
Reference in New Issue
Block a user