Skip to content

Commit

Permalink
Adjust CUDA and Eigen settings to reduce compilation warnings
Browse files Browse the repository at this point in the history
- Enable Eigen GPU support when CUDA is used
- Set specific CUDA source files and compiler flags
- Add compiler flags to suppress certain warnings
  • Loading branch information
Glacialte committed Oct 1, 2024
1 parent a290871 commit f1b68ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ if(NOT eigen_fetch_POPULATED)
add_subdirectory(${eigen_fetch_SOURCE_DIR})
endif(NOT eigen_fetch_POPULATED)

if(SCALUQ_USE_CUDA)
set(EIGEN_USE_GPU ON CACHE BOOL "Enable Eigen GPU support" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_USE_GPU")
endif()

# nanobind
if(SKBUILD)
find_package(Python 3.8
Expand Down
12 changes: 12 additions & 0 deletions scaluq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
cmake_minimum_required(VERSION 3.21)

if(SCALUQ_USE_CUDA)
set_source_files_properties(
update_ops_dense_matrix.cpp
update_ops_sparse_matrix.cpp
PROPERTIES LANGUAGE CUDA
)

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_60")

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored")
endif()

target_sources(scaluq PRIVATE
circuit/circuit.cpp
gate/update_ops_dense_matrix.cpp
Expand Down

0 comments on commit f1b68ed

Please sign in to comment.