加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
zhouxingbin 提交于 2023-12-29 15:34 . 修改CMake install
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 17)
project(ChipSum VERSION 1.2)
configure_file(ChipSumConfig.h.in ChipSumConfig.h)
set(CMAKE_CXX_FLAGS "-Wall"${CMAKE_CXX_FLAGS})
set(CHIPSUM_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CHIPSUM_SOURCES "")
set(CHIPSUM_HEADERS "")
add_subdirectory("chipsum")
set(ChipSum_ENABLE_KokkosKernels ON)
if(ChipSum_ENABLE_KokkosKernels)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tpls/kokkos-kernels-build/lib)
set(KokkosKernels_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tpls/kokkos-kernels-build/lib)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tpls/kokkos-kernels-build/lib64)
set(KokkosKernels_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tpls/kokkos-kernels-build/lib64)
endif()
add_definitions("-DChipSum_USE_KokkosKernels=on")
set(KokkosKernels_DIR ${KokkosKernels_LIB_DIR}/cmake/KokkosKernels)
find_package(KokkosKernels REQUIRED)
set(CMAKE_CXX_COMPILER ${Kokkos_CXX_COMPILER})
list(APPEND CHIPSUM_LIBS "Kokkos::kokkoskernels")
endif()
#INCLUDE CUSPARSE
find_package(CUDA)
if(CUDA_FOUND)
list(APPEND CHIPSUM_LIBS "cusparse")
endif()
#INCLUDE ROCSPARSE
FIND_PACKAGE(ROCM)
if(ROCM_FOUND)
list(APPEND CHIPSUM_LIBS "rocsparse")
endif()
add_definitions("-fopenmp")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/chipsum/solver)
add_library(chipsum ${CHIPSUM_SOURCES} ${CHIPSUM_HEADERS})
list(APPEND CHIPSUM_LIBS chipsum)
install(TARGETS chipsum DESTINATION lib)
install(FILES ChipSum.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
set(CHIPSUM_ENABLE_TEST ON)
set(CHIPSUM_ENABLE_EXAMPLE ON)
set(CHIPSUM_ENABLE_PERF_TEST ON)
set(CHIPSUM_ENABLE_UNIT_TEST ON)
if(CHIPSUM_ENABLE_TEST)
add_subdirectory("tests")
endif()
if(CHIPSUM_ENABLE_EXAMPLE)
add_subdirectory("examples")
endif()
if(CHIPSUM_ENABLE_PERF_TEST)
add_subdirectory("perf_test")
endif()
if(CHIPSUM_ENABLE_UNIT_TEST)
add_subdirectory("unit_test")
endif()
#"examples/vector/axpby.cpp" "examples/matrix/lu.cpp" "tests/test1.cpp" "perf_test/perf_axpby.cpp"
add_executable(ChipSum "perf_test/perf_dot.cpp")
install(TARGETS ChipSum DESTINATION bin)
target_link_libraries(ChipSum PUBLIC ${CHIPSUM_LIBS})
target_include_directories(ChipSum PUBLIC ${PROJECT_BINARY_DIR})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化