From 59c6c3f23f80201559b529d00dc8c27482912dee Mon Sep 17 00:00:00 2001 From: Yifan Zhao <yifanz16@illinois.edu> Date: Tue, 22 Dec 2020 05:17:46 -0600 Subject: [PATCH] Compile soc_simulator and gpu_profiler automatically --- hpvm/projects/hpvm-tensor-rt/CMakeLists.txt | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt index 3b1fbf8f93..489d38313b 100644 --- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt +++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.17) -project (hpvm-tensor-rt) +project(hpvm-tensor-rt) find_package(CUDA 6.5 REQUIRED) set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") set(CUDA_PROPAGATE_HOST_FLAGS OFF) @@ -71,16 +71,18 @@ foreach(FILE ${RUNTIME_SRCS_FILENAME}) list(APPEND RUNTIME_SRCS "tensor_runtime/src/${FILE}") endforeach() -# Default link libraries -find_library(GPU_PROFILER_LIB - NAMES libgpu_profiler.a - HINTS ../gpu_profiler/lib -) -find_library(SOC_SIMULATOR_LIB - NAMES libpromise_profiler.a - HINTS ../soc_simulator/lib -) -set(LINK_LIBS cudnn cufft stdc++fs curand) +# Compile gpu_profiler and soc_simulator +# Conditionally add gpu_profiler project if we're building independently +# (not building the whole hpvm) +get_filename_component(root_dir ${CMAKE_SOURCE_DIR} REALPATH) +get_filename_component(our_dir ${CMAKE_CURRENT_SOURCE_DIR} REALPATH) +if(${root_dir} STREQUAL ${our_dir}) + message("Compiling hpvm-tensor-rt independently") + message("Also compiling gpu_profiler and soc_simulator") + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../gpu_profiler ${CMAKE_CURRENT_BINARY_DIR}/gpu_profiler) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../soc_simulator ${CMAKE_CURRENT_BINARY_DIR}/soc_simulator) +endif() +set(LINK_LIBS gpu_profiler promise_profiler cudnn cufft stdc++fs curand) if(USE_GFLAGS) list(APPEND LINK_LIBS gflags) endif() -- GitLab