Skip to content

Commit

Permalink
multi_gpu: mark execution spaces as module_local and fix cmake check …
Browse files Browse the repository at this point in the history
…for number of gpus
  • Loading branch information
NaderAlAwar committed Oct 26, 2023
1 parent aed4237 commit a3a76af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ADD_OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
SET(ENABLE_MULTI_GPU "0" CACHE STRING "Build multiple copies to enable multi GPU")
SET(GPU_DIR_LIST "")

IF(${ENABLE_MULTI_GPU} GREATER 2)
IF(${ENABLE_MULTI_GPU} GREATER_EQUAL 2)
ADD_COMPILE_DEFINITIONS(ENABLE_MULTI_GPU)
MATH(EXPR LAST_GPU_ID "${ENABLE_MULTI_GPU} - 1")
FILE(GLOB TO_COPY "${CMAKE_CURRENT_LIST_DIR}/kokkos/*")
Expand Down
4 changes: 4 additions & 0 deletions include/execution_spaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ void generate_execution_space(py::module &_mod, const std::string &_name,
std::cerr << "Registering " << _msg << " as python class '" << _name
<< "'..." << std::endl;

#ifdef ENABLE_MULTI_GPU
py::class_<Sp> _space(_mod, _name.c_str(), py::module_local());
#else
py::class_<Sp> _space(_mod, _name.c_str());
#endif
_space.def(py::init([]() { return new Sp{}; }));

// Add other constructors with arguments if they exist
Expand Down

0 comments on commit a3a76af

Please sign in to comment.