From 6747ed5868d6763a2cd174a678eb2fd091682363 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Sat, 20 Mar 2021 18:28:17 -0500
Subject: [PATCH] Compile a shared tensor_runtime library without openmp symbol
 missing

---
 hpvm/projects/hpvm-tensor-rt/CMakeLists.txt | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
index 6dece96805..cb52f7d901 100644
--- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
+++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
@@ -78,17 +78,16 @@ endforeach()
 
 # -- Adding tensor_runtime targets
 function(add_tensor_runtime target_name)
-  add_library(${target_name} ${RUNTIME_SRCS})
+  add_library(${target_name} SHARED ${RUNTIME_SRCS})
   set_property(TARGET ${target_name} PROPERTY CUDA_ARCHITECTURES 60)
   target_compile_options(
     ${target_name} PRIVATE
-    $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr -maxrregcount 32>
-    $<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CONFIG:DEBUG>>:-lineinfo -Xcompiler -ggdb>
-    $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${OpenMP_CXX_FLAGS}>
+    --expt-relaxed-constexpr -maxrregcount 32 -Xcompiler ${OpenMP_CXX_FLAGS}
+    $<$<CONFIG:DEBUG>:-lineinfo -Xcompiler -ggdb>
   )
   target_include_directories(${target_name} PUBLIC ${INCLUDES})
   target_link_directories(${target_name} PUBLIC ${LINK_DIR})
-  target_link_libraries(${target_name} PUBLIC ${LINK_LIBS})
+  target_link_libraries(${target_name} PUBLIC ${LINK_LIBS} ${OpenMP_CXX_FLAGS})
   target_compile_definitions(${target_name} PRIVATE ${DEFS} ${ARGN})
 endfunction(add_tensor_runtime)
 
-- 
GitLab