Skip to content
Snippets Groups Projects
Commit d8d55c3e authored by Yifan Zhao's avatar Yifan Zhao
Browse files

Fixed some problems in HPVM benchmark 'pipeline'

parent 85270e29
No related branches found
No related tags found
No related merge requests found
......@@ -34,5 +34,22 @@ function(add_hpvm_benchmark
add_custom_target(${target_name} DEPENDS ${output_bin_path})
endfunction(add_hpvm_benchmark)
function(add_hpvm_cpu_gpu_benchmark
target_prefix common_flags language_mode main_src util_bitcodes
)
set(all_flags_cpu ${common_flags} "-DDEVICE=CPU_TARGET")
add_hpvm_benchmark(
"${target_prefix}_cpu" "${target_prefix}-cpu" "${all_flags_cpu}" ${language_mode}
${main_src} "${util_bitcodes}"
)
if(HPVM_USE_OPENCL)
set(all_flags_gpu ${common_flags} "--opencl" "-DDEVICE=GPU_TARGET")
add_hpvm_benchmark(
"${target_prefix}_gpu" "${target_prefix}-gpu" "${all_flags_gpu}" ${language_mode}
${main_src} "${util_bitcodes}"
)
endif()
endfunction()
add_subdirectory(hpvm-cava)
add_subdirectory(pipeline)
......@@ -8,17 +8,4 @@ set(
# Sets ${util_bitcodes}
hpvm_compile_util_sources("${compiler_flags}" "${other_srcs}" "c")
set(all_flags_cpu ${compiler_flags} "-DDEVICE=CPU_TARGET" "-lpthread")
add_hpvm_benchmark(
"hpvm_cava_cpu" "hpvm-cava-cpu" "${all_flags_cpu}" "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()
add_hpvm_cpu_gpu_benchmark(hpvm_cava "${compiler_flags}" c src/main.c "${util_bitcodes}")
find_package(OpenCV 2)
if(${OpenCV_FOUND})
set(
all_flags
-O3 -I${OpenCV_INCLUDE_DIRS}
-ffast-math -fno-lax-vector-conversions -fno-vectorize -fno-slp-vectorize
-lpthread
foreach(incl_dir ${OpenCV_INCLUDE_DIRS})
list(APPEND all_flags "-I${incl_dir}")
endforeach()
foreach(link_lib ${OpenCV_LIBS})
list(APPEND all_flags "-l${link_lib}")
endforeach()
list(
APPEND all_flags -L "${OpenCV_INSTALL_PATH}/lib"
-O3 -ffast-math -fno-lax-vector-conversions -fno-vectorize -fno-slp-vectorize
)
add_hpvm_benchmark("pipeline_cpu" "pipeline-cpu" "${all_flags}" "c++" src/main.cc "")
if(HPVM_USE_OPENCL)
add_hpvm_benchmark("pipeline_gpu" "pipeline-gpu" "${all_flags};--opencl" "c++" src/main.cc "")
endif()
add_hpvm_cpu_gpu_benchmark("pipeline" "${all_flags}" c++ src/main.cc "")
else()
message(WARNING "opencv-2 not found; not compiling HPVM benchmark 'pipeline'.")
endif()
......@@ -27,6 +27,10 @@
#define HEIGHT 640
#define WIDTH 480
#ifndef DEVICE
#error "The macro 'DEVICE' must be defined to CPU_TARGET or GPU_TARGET."
#endif
std::string input_window = "GPU Pipeline - Input Video";
std::string output_window = "GPU Pipeline - Edge Mapping";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment