From dea38432782f50d51301a260e30c4ed69419a9f0 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Thu, 1 Apr 2021 18:07:04 -0500
Subject: [PATCH] Only provide gpu variants of old HPVM bench when OpenCL
 exists

---
 hpvm/test/benchmarks/hpvm-cava/CMakeLists.txt | 12 +++++++-----
 hpvm/test/benchmarks/pipeline/CMakeLists.txt  |  4 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/hpvm/test/benchmarks/hpvm-cava/CMakeLists.txt b/hpvm/test/benchmarks/hpvm-cava/CMakeLists.txt
index 57e3bd3f33..d89a01a056 100644
--- a/hpvm/test/benchmarks/hpvm-cava/CMakeLists.txt
+++ b/hpvm/test/benchmarks/hpvm-cava/CMakeLists.txt
@@ -15,8 +15,10 @@ add_hpvm_benchmark(
   src/main.c "${util_bitcodes}"
 )
 
-set(all_flags_gpu ${compiler_flags} "-DDEVICE=GPU_TARGET" "--opencl" "-lpthread")
-add_hpvm_benchmark(
-  "hpvm_cava_gpu" "hpvm-cava-gpu" "${all_flags_gpu}" "c"
-  src/main.c "${util_bitcodes}"
-)
+if(HPVM_USE_OPENCL)
+  set(all_flags_gpu ${compiler_flags} "-DDEVICE=GPU_TARGET" "--opencl" "-lpthread")
+  add_hpvm_benchmark(
+    "hpvm_cava_gpu" "hpvm-cava-gpu" "${all_flags_gpu}" "c"
+    src/main.c "${util_bitcodes}"
+  )
+endif()
diff --git a/hpvm/test/benchmarks/pipeline/CMakeLists.txt b/hpvm/test/benchmarks/pipeline/CMakeLists.txt
index 84cb2d85af..db2b8eeab1 100644
--- a/hpvm/test/benchmarks/pipeline/CMakeLists.txt
+++ b/hpvm/test/benchmarks/pipeline/CMakeLists.txt
@@ -7,7 +7,9 @@ if(${OpenCV_FOUND})
     -lpthread
   )
   add_hpvm_benchmark("pipeline_cpu" "pipeline-cpu" "${all_flags}" "c++" src/main.cc "")
-  add_hpvm_benchmark("pipeline_gpu" "pipeline-gpu" "${all_flags};--opencl" "c++" src/main.cc "")
+  if(HPVM_USE_OPENCL)
+    add_hpvm_benchmark("pipeline_gpu" "pipeline-gpu" "${all_flags};--opencl" "c++" src/main.cc "")
+  endif()
 else()
   message(WARNING "opencv-2 not found; not compiling HPVM benchmark 'pipeline'.")
 endif()
-- 
GitLab