Skip to content

Commit

Permalink
Merge branch 'master' into arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
NoureldinYosri authored Jan 31, 2024
2 parents cf5e7fc + 5416d95 commit 4aabe4e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
14 changes: 10 additions & 4 deletions pybind_interface/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.18)
project(qsim LANGUAGES CXX CUDA)

if(WIN32)
Expand All @@ -18,12 +18,18 @@ INCLUDE(../GetPybind11.cmake)
find_package(PythonLibs 3.7 REQUIRED)
find_package(CUDA REQUIRED)

include_directories(${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR}/include)
include_directories(${PYTHON_INCLUDE_DIRS})
if(pybind11_FOUND)
include_directories(${pybind11_INCLUDE_DIRS})
else() # means pybind11 has been fetched in GetPybind11.cmake
include_directories(${pybind11_SOURCE_DIR}/include)
endif()

cuda_add_library(qsim_cuda MODULE pybind_main_cuda.cpp)
set_target_properties(qsim_cuda PROPERTIES
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
CUDA_ARCHITECTURES "$ENV{CUDAARCHS}"
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
set_source_files_properties(pybind_main_cuda.cpp PROPERTIES LANGUAGE CUDA)

Expand Down
6 changes: 4 additions & 2 deletions pybind_interface/cuda/pybind_main_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ namespace qsim {
unsigned num_sim_threads,
unsigned num_state_threads,
unsigned num_dblocks
) : ss_params{num_state_threads, num_dblocks} {}

) {
ss_params.num_threads = num_state_threads;
ss_params.num_dblocks = num_dblocks;
}
StateSpace CreateStateSpace() const {
return StateSpace(ss_params);
}
Expand Down
4 changes: 2 additions & 2 deletions pybind_interface/custatevec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ cuda_add_library(qsim_custatevec MODULE pybind_main_custatevec.cpp)
target_link_libraries(qsim_custatevec -lcustatevec -lcublas)

set_target_properties(qsim_custatevec PROPERTIES
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
set_source_files_properties(pybind_main_custatevec.cpp PROPERTIES LANGUAGE CUDA)

Expand Down
11 changes: 6 additions & 5 deletions pybind_interface/decide/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.18)

if(WIN32)
set(CMAKE_CXX_FLAGS "/O2 /openmp")
Expand Down Expand Up @@ -26,8 +26,9 @@ if(has_nvcc)
find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development)
include_directories(${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR}/include)
set_target_properties(qsim_decide PROPERTIES
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
CUDA_ARCHITECTURES "$ENV{CUDAARCHS}"
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
set_source_files_properties(decide.cpp PROPERTIES LANGUAGE CUDA)
target_link_libraries(qsim_decide OpenMP::OpenMP_CXX)
Expand All @@ -39,8 +40,8 @@ elseif(has_hipcc)
find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development)
include_directories(${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR}/include)
set_target_properties(qsim_decide PROPERTIES
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
target_link_libraries(qsim_decide PUBLIC OpenMP::OpenMP_CXX)
else()
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def build_extension(self, ext):
"-DPYTHON_INCLUDE_DIR=" + python_include_dir,
]

additional_cmake_args = os.environ.get("CMAKE_ARGS", "")
if additional_cmake_args:
cmake_args += additional_cmake_args.split()

cfg = "Debug" if self.debug else "Release"
build_args = ["--config", cfg]

Expand Down

0 comments on commit 4aabe4e

Please sign in to comment.