Something went wrong on our end
Select Git revision
policy_capabilities
-
Stephen Smalley authoredStephen Smalley authored
CMakeLists.txt 3.44 KiB
cmake_minimum_required(VERSION 3.18.4)
project(lantern)
# Specify CXX standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
#set(CMAKE_CXX_FLAGS -"Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CUDA_FLAGS_RELEASE "-O3")
option(PRUNING "Enable pruning" OFF)
add_subdirectory(./onnx)
add_subdirectory(./googletest)
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
find_package(CUDA)
find_package(Boost REQUIRED)
# for parallel algorithms (c++17 and up)
#find_package(TBB REQUIRED)
set(inference_sources lantern/inference/Graph.cc)
set(core_sources lantern/tensor/Factory.cc
lantern/tensor/Shape.cc
lantern/tensor/Tensor.cc
lantern/tensor/Types.cc
lantern/tensor/Util.cc)
set(accel_sources lantern/tensor/accel/RuntimeCheck.cc) # this will be changed later on
set(cpu_sources lantern/tensor/accel/rawcpu/CPUBackend.cc
lantern/tensor/accel/rawcpu/CPUTensor.cc)
set(cuda_sources lantern/tensor/accel/cuda/CUDATensor.cu
lantern/tensor/accel/cuda/CUDABackend.cu
#lantern/tensor/accel/cuda/optim/tiling/CUDATilingTensor.cu
)
set(test_sources test/matmul_test.cc test/main.cc)
set_source_files_properties(${cuda_sources} PROPERTIES LANGUAGE CUDA)
#set_source_files_properties(lantern/tensor/accel/cuda/optim/CUDATilingTensor.cu PROPERTIES LANGUAGE CUDA)
add_library(ops SHARED
lantern/csrc/ops.cc
${core_sources}
${accel_sources}
${cpu_sources})
add_executable(main
main.cc
${core_sources}
${accel_sources}
${cpu_sources})
add_executable(mainInference
mainInference.cc
${core_sources}
${accel_sources}
${cpu_sources}
${inference_sources}
)
add_executable(pruning
pruning.cc
${core_sources}
${accel_sources}
${cpu_sources}
${inference_sources}
)
add_executable(test test/main.cc
${core_sources}
${accel_sources}
${cpu_sources}
${test_sources})
add_executable(matmul matmul.cc
${core_sources}
${accel_sources}
${cpu_sources}
)
if (PRUNING)
target_compile_definitions(mainInference PRIVATE PRUNING)
endif()
if(CUDA_FOUND)
enable_language(CUDA)
add_executable(cudaMain
cudaMain.cc
${core_sources}
${accel_sources}
${cuda_sources})
add_executable(cast
cast.cc
${core_sources}
${accel_sources}
${cuda_sources})
target_sources(ops PRIVATE ${cuda_sources})
target_sources(mainInference PRIVATE ${cuda_sources})
target_sources(pruning PRIVATE ${cuda_sources})
target_sources(test PRIVATE ${cuda_sources})
target_sources(matmul PRIVATE ${cuda_sources})
set_target_properties(cudaMain ops mainInference test cast pruning matmul
PROPERTIES
#CUDA_SEPARABLE_COMPILATION ON
#CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION ON
CUDA_ARCHITECTURES "70")
add_compile_definitions(CUDA_)
endif()
target_link_libraries(mainInference PRIVATE onnx ${OpenCV_LIBS})
target_link_libraries(pruning PRIVATE onnx ${OpenCV_LIBS})
target_link_libraries(test PRIVATE gtest)
include_directories(${CMAKE_SOURCE_DIR})