File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 3.11 )
1+ cmake_minimum_required (VERSION 3.18 )
22project (qsim LANGUAGES CXX CUDA )
33
44if (WIN32 )
@@ -18,12 +18,18 @@ INCLUDE(../GetPybind11.cmake)
1818find_package (PythonLibs 3.7 REQUIRED )
1919find_package (CUDA REQUIRED )
2020
21- include_directories (${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR} /include )
21+ include_directories (${PYTHON_INCLUDE_DIRS} )
22+ if (pybind11_FOUND)
23+ include_directories (${pybind11_INCLUDE_DIRS} )
24+ else () # means pybind11 has been fetched in GetPybind11.cmake
25+ include_directories (${pybind11_SOURCE_DIR} /include )
26+ endif ()
2227
2328cuda_add_library (qsim_cuda MODULE pybind_main_cuda.cpp )
2429set_target_properties (qsim_cuda PROPERTIES
25- PREFIX "${PYTHON_MODULE_PREFIX} "
26- SUFFIX "${PYTHON_MODULE_EXTENSION} "
30+ CUDA_ARCHITECTURES "$ENV{CUDAARCHS} "
31+ PREFIX "${PYTHON_MODULE_PREFIX} "
32+ SUFFIX "${PYTHON_MODULE_EXTENSION} "
2733)
2834set_source_files_properties (pybind_main_cuda.cpp PROPERTIES LANGUAGE CUDA )
2935
Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ namespace qsim {
2727 unsigned num_sim_threads,
2828 unsigned num_state_threads,
2929 unsigned num_dblocks
30- ) : ss_params{num_state_threads, num_dblocks} {}
31-
30+ ) {
31+ ss_params.num_threads = num_state_threads;
32+ ss_params.num_dblocks = num_dblocks;
33+ }
3234 StateSpace CreateStateSpace () const {
3335 return StateSpace (ss_params);
3436 }
Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ cuda_add_library(qsim_custatevec MODULE pybind_main_custatevec.cpp)
4040target_link_libraries (qsim_custatevec -lcustatevec -lcublas )
4141
4242set_target_properties (qsim_custatevec PROPERTIES
43- PREFIX "${PYTHON_MODULE_PREFIX} "
44- SUFFIX "${PYTHON_MODULE_EXTENSION} "
43+ PREFIX "${PYTHON_MODULE_PREFIX} "
44+ SUFFIX "${PYTHON_MODULE_EXTENSION} "
4545)
4646set_source_files_properties (pybind_main_custatevec.cpp PROPERTIES LANGUAGE CUDA )
4747
Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 3.11 )
1+ cmake_minimum_required (VERSION 3.18 )
22
33if (WIN32 )
44 set (CMAKE_CXX_FLAGS "/O2 /openmp" )
@@ -26,8 +26,9 @@ if(has_nvcc)
2626 find_package (Python3 3.7 REQUIRED COMPONENTS Interpreter Development )
2727 include_directories (${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR} /include )
2828 set_target_properties (qsim_decide PROPERTIES
29- PREFIX "${PYTHON_MODULE_PREFIX} "
30- SUFFIX "${PYTHON_MODULE_EXTENSION} "
29+ CUDA_ARCHITECTURES "$ENV{CUDAARCHS} "
30+ PREFIX "${PYTHON_MODULE_PREFIX} "
31+ SUFFIX "${PYTHON_MODULE_EXTENSION} "
3132 )
3233 set_source_files_properties (decide.cpp PROPERTIES LANGUAGE CUDA )
3334 target_link_libraries (qsim_decide OpenMP::OpenMP_CXX )
@@ -39,8 +40,8 @@ elseif(has_hipcc)
3940 find_package (Python3 3.7 REQUIRED COMPONENTS Interpreter Development )
4041 include_directories (${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR} /include )
4142 set_target_properties (qsim_decide PROPERTIES
42- PREFIX "${PYTHON_MODULE_PREFIX} "
43- SUFFIX "${PYTHON_MODULE_EXTENSION} "
43+ PREFIX "${PYTHON_MODULE_PREFIX} "
44+ SUFFIX "${PYTHON_MODULE_EXTENSION} "
4445 )
4546 target_link_libraries (qsim_decide PUBLIC OpenMP::OpenMP_CXX )
4647else ()
Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ def build_extension(self, ext):
4848 "-DPYTHON_INCLUDE_DIR=" + python_include_dir ,
4949 ]
5050
51+ additional_cmake_args = os .environ .get ("CMAKE_ARGS" , "" )
52+ if additional_cmake_args :
53+ cmake_args += additional_cmake_args .split ()
54+
5155 cfg = "Debug" if self .debug else "Release"
5256 build_args = ["--config" , cfg ]
5357
You can’t perform that action at this time.
0 commit comments