From d802fa3fb1da61bf144d2482af9582c566dc6da5 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Sat, 4 Feb 2017 10:45:39 +0100 Subject: [PATCH 1/8] Usage: cmake -DIMPALA_DIR=/path/to/impala-config.cmake -DBACKEND=opencl --- CMakeLists.txt | 26 +++++++++++++++----------- aobench/CMakeLists.txt | 4 ++-- bilateral_grid/CMakeLists.txt | 4 ++-- harris_corner/CMakeLists.txt | 4 ++-- image_sharpening/CMakeLists.txt | 4 ++-- sorting_networks/CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 24 ++++++++++++------------ vcycle/CMakeLists.txt | 4 ++-- 8 files changed, 39 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ba037d..423efeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,13 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(STINCILLA CXX) enable_testing() -find_package(AnyDSL-runtime REQUIRED) -include(${ANYDSL_RUNTIME_CMAKE_DIR}/Runtime.cmake) -include_directories(${ANYDSL_RUNTIME_DIR}/src) +find_package(IMPALA REQUIRED) +# include(${ANYDSL_RUNTIME_CMAKE_DIR}/Runtime.cmake) +# include_directories(${ANYDSL_RUNTIME_DIR}/src) + +if(NOT BACKEND) + set(BACKEND cpu) +endif() if(BACKEND STREQUAL "cpu" OR BACKEND STREQUAL "avx") set(DEVICE "cpu") @@ -25,31 +29,31 @@ add_subdirectory(sorting_networks) add_subdirectory(vcycle) # simple CPU-based examples -anydsl_runtime_wrap(MATMUL_PROGRAM +wrap_impala_sources(MATMUL_PROGRAM BACKEND cpu FILES utils.impala matmul.impala) add_executable(matmul ${MATMUL_PROGRAM}) -target_link_libraries(matmul ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(matmul ${IMPALA_RUNTIME_LIBRARIES}) add_test("matmul" matmul) # examples based on the "mapping" -anydsl_runtime_wrap(GAUSSIAN_PROGRAM +wrap_impala_sources(GAUSSIAN_PROGRAM BACKEND ${BACKEND} FILES utils.impala mapping_${DEVICE}.impala gaussian.impala) add_executable(gaussian ${GAUSSIAN_PROGRAM}) -target_link_libraries(gaussian ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(gaussian ${IMPALA_RUNTIME_LIBRARIES}) add_test("gaussian" gaussian) -anydsl_runtime_wrap(BILATERAL_PROGRAM +wrap_impala_sources(BILATERAL_PROGRAM BACKEND ${BACKEND} FILES utils.impala mapping_${DEVICE}.impala bilateral.impala) add_executable(bilateral ${BILATERAL_PROGRAM}) -target_link_libraries(bilateral ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(bilateral ${IMPALA_RUNTIME_LIBRARIES}) add_test("bilateral" bilateral) -anydsl_runtime_wrap(JACOBI_PROGRAM +wrap_impala_sources(JACOBI_PROGRAM BACKEND ${BACKEND} FILES utils.impala mapping_${DEVICE}.impala jacobi.impala) add_executable(jacobi ${JACOBI_PROGRAM}) -target_link_libraries(jacobi ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(jacobi ${IMPALA_RUNTIME_LIBRARIES}) add_test("jacobi" jacobi) diff --git a/aobench/CMakeLists.txt b/aobench/CMakeLists.txt index e3e62f8..8dadf3c 100644 --- a/aobench/CMakeLists.txt +++ b/aobench/CMakeLists.txt @@ -1,7 +1,7 @@ -anydsl_runtime_wrap(AOBENCH_PROGRAM +wrap_impala_sources(AOBENCH_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala mapping_${DEVICE}.impala aobench.impala) add_executable(aobench main.cpp ${AOBENCH_PROGRAM}) -target_link_libraries(aobench ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(aobench ${IMPALA_RUNTIME_LIBRARIES}) set_target_properties(aobench PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) add_test("aobench" aobench) diff --git a/bilateral_grid/CMakeLists.txt b/bilateral_grid/CMakeLists.txt index 8e2f936..91d4fc5 100644 --- a/bilateral_grid/CMakeLists.txt +++ b/bilateral_grid/CMakeLists.txt @@ -1,8 +1,8 @@ -anydsl_runtime_wrap(BILATERAL_GRID_PROGRAM +wrap_impala_sources(BILATERAL_GRID_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala mapping_${DEVICE}.impala bilateral_grid.impala) add_executable(bilateral_grid main.cpp ${BILATERAL_GRID_PROGRAM}) -target_link_libraries(bilateral_grid ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(bilateral_grid ${IMPALA_RUNTIME_LIBRARIES}) set_target_properties(bilateral_grid PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) add_test("bilateral_grid" bilateral_grid) configure_file(../common/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COPYONLY) diff --git a/harris_corner/CMakeLists.txt b/harris_corner/CMakeLists.txt index 3b4d939..0b4a563 100644 --- a/harris_corner/CMakeLists.txt +++ b/harris_corner/CMakeLists.txt @@ -1,8 +1,8 @@ -anydsl_runtime_wrap(HARRIS_CORNER_PROGRAM +wrap_impala_sources(HARRIS_CORNER_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala ../mapping_${DEVICE}.impala harris_corner.impala) add_executable(harris_corner main.cpp ${HARRIS_CORNER_PROGRAM}) -target_link_libraries(harris_corner ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(harris_corner ${IMPALA_RUNTIME_LIBRARIES}) set_target_properties(harris_corner PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) add_test("harris_corner" harris_corner) configure_file(../common/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COPYONLY) diff --git a/image_sharpening/CMakeLists.txt b/image_sharpening/CMakeLists.txt index 5731690..9c59350 100644 --- a/image_sharpening/CMakeLists.txt +++ b/image_sharpening/CMakeLists.txt @@ -1,8 +1,8 @@ -anydsl_runtime_wrap(SHARPENING_PROGRAM +wrap_impala_sources(SHARPENING_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala sharpening.impala) add_executable(sharpening main.cpp ${SHARPENING_PROGRAM}) -target_link_libraries(sharpening ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(sharpening ${IMPALA_RUNTIME_LIBRARIES}) set_target_properties(sharpening PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) add_test("sharpening" sharpening) configure_file(goldhill.pgm ${CMAKE_CURRENT_BINARY_DIR}/goldhill.pgm COPYONLY) diff --git a/sorting_networks/CMakeLists.txt b/sorting_networks/CMakeLists.txt index 4c3bd10..eec57f4 100644 --- a/sorting_networks/CMakeLists.txt +++ b/sorting_networks/CMakeLists.txt @@ -1,6 +1,6 @@ -anydsl_runtime_wrap(MEDIAN_PROGRAM +wrap_impala_sources(MEDIAN_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala mapping_${DEVICE}.impala oddeven.impala median.impala) add_executable(median ${MEDIAN_PROGRAM}) -target_link_libraries(median ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(median ${IMPALA_RUNTIME_LIBRARIES}) add_test("median" median) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5966578..0e05c93 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,45 +1,45 @@ -anydsl_runtime_wrap(STENCIL_INT_PROGRAM +wrap_impala_sources(STENCIL_INT_PROGRAM BACKEND cpu FILES stencil_dsl.impala) add_executable(stencil_dsl ${STENCIL_INT_PROGRAM}) -target_link_libraries(stencil_dsl ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(stencil_dsl ${IMPALA_RUNTIME_LIBRARIES}) add_test("stencil_dsl" stencil_dsl) if(NOT (BACKEND STREQUAL "cpu" OR BACKEND STREQUAL "avx")) - anydsl_runtime_wrap(MULTI_GPU_PROGRAM + wrap_impala_sources(MULTI_GPU_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala multi_gpu.impala) add_executable(multi_gpu ${MULTI_GPU_PROGRAM}) - target_link_libraries(multi_gpu ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) + target_link_libraries(multi_gpu ${IMPALA_RUNTIME_LIBRARIES}) add_test("multi_gpu" multi_gpu) - anydsl_runtime_wrap(ALLOC_GPU_PROGRAM + wrap_impala_sources(ALLOC_GPU_PROGRAM BACKEND ${BACKEND} FILES alloc_gpu.impala) add_executable(alloc_gpu ${ALLOC_GPU_PROGRAM}) - target_link_libraries(alloc_gpu ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) + target_link_libraries(alloc_gpu ${IMPALA_RUNTIME_LIBRARIES}) add_test("alloc_gpu" alloc_gpu) - anydsl_runtime_wrap(ALLOC_GPU_UNIFIED_PROGRAM + wrap_impala_sources(ALLOC_GPU_UNIFIED_PROGRAM BACKEND ${BACKEND} FILES alloc_gpu_unified.impala) add_executable(alloc_gpu_unified ${ALLOC_GPU_UNIFIED_PROGRAM}) - target_link_libraries(alloc_gpu_unified ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) + target_link_libraries(alloc_gpu_unified ${IMPALA_RUNTIME_LIBRARIES}) add_test("alloc_gpu_unified" alloc_gpu_unified) - anydsl_runtime_wrap(RESERVE_SHARED_PROGRAM + wrap_impala_sources(RESERVE_SHARED_PROGRAM BACKEND ${BACKEND} FILES reserve_shared.impala) add_executable(reserve_shared ${RESERVE_SHARED_PROGRAM}) - target_link_libraries(reserve_shared ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) + target_link_libraries(reserve_shared ${IMPALA_RUNTIME_LIBRARIES}) add_test("reserve_shared" reserve_shared) if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") - anydsl_runtime_wrap(HALF_FLOAT_GPU_PROGRAM + wrap_impala_sources(HALF_FLOAT_GPU_PROGRAM BACKEND ${BACKEND} FILES half_float_gpu.impala) add_executable(half_float_gpu ${HALF_FLOAT_GPU_PROGRAM}) - target_link_libraries(half_float_gpu ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) + target_link_libraries(half_float_gpu ${IMPALA_RUNTIME_LIBRARIES}) add_test("half_float_gpu" half_float_gpu) endif() endif() diff --git a/vcycle/CMakeLists.txt b/vcycle/CMakeLists.txt index 5a35972..2e5f0dd 100644 --- a/vcycle/CMakeLists.txt +++ b/vcycle/CMakeLists.txt @@ -1,8 +1,8 @@ -anydsl_runtime_wrap(VCYCLE_PROGRAM +wrap_impala_sources(VCYCLE_PROGRAM BACKEND ${BACKEND} FILES ../utils.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala vcycle.impala) add_executable(vcycle main.cpp ${VCYCLE_PROGRAM}) -target_link_libraries(vcycle ${ANYDSL_RUNTIME_LIBRARY} ${ANYDSL_RUNTIME_LIBRARIES}) +target_link_libraries(vcycle ${IMPALA_RUNTIME_LIBRARIES}) set_target_properties(vcycle PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) add_test("vcycle" vcycle) configure_file(../common/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COPYONLY) From 97a73cb8ea675cb328e3b59a55dd9ca103174279 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Mon, 6 Feb 2017 10:28:38 +0100 Subject: [PATCH 2/8] Refactor common function add_test_sample() --- CMakeLists.txt | 46 +++++++++++++-------------------- aobench/CMakeLists.txt | 9 +++---- bilateral_grid/CMakeLists.txt | 9 +++---- harris_corner/CMakeLists.txt | 9 +++---- image_sharpening/CMakeLists.txt | 9 +++---- sorting_networks/CMakeLists.txt | 8 ++---- vcycle/CMakeLists.txt | 9 +++---- 7 files changed, 35 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 423efeb..650bbd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,6 @@ project(STINCILLA CXX) enable_testing() find_package(IMPALA REQUIRED) -# include(${ANYDSL_RUNTIME_CMAKE_DIR}/Runtime.cmake) -# include_directories(${ANYDSL_RUNTIME_DIR}/src) if(NOT BACKEND) set(BACKEND cpu) @@ -20,6 +18,20 @@ endif() set(STINCILLA_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/common/pnm_image) include_directories(${STINCILLA_COMMON_INCLUDE_DIRS}) +function (add_test_sample _name _backend) + CMAKE_PARSE_ARGUMENTS ( "PARGS" "" "" "CXX;IMPALA" ${ARGN} ) + set(_infiles ${PARGS_IMPALA}) + set(_cxxfiles ${PARGS_CXX}) + if (NOT (_infiles OR _cxxfiles)) + set(_infiles ${PARGS_UNPARSED_ARGUMENTS}) + endif() + source_group("Impala Files" REGULAR_EXPRESSION "[.]impala$") + wrap_impala_sources(_outfiles BACKEND ${_backend} OUTPUT_NAME ${_name} FILES ${_infiles}) + add_executable(${_name} ${_outfiles} ${_infiles} ${_cxxfiles}) + target_link_libraries(${_name} ${IMPALA_RUNTIME_LIBRARIES}) + add_test("${_name}" ${_name}) +endfunction() + add_subdirectory(aobench) add_subdirectory(bilateral_grid) add_subdirectory(harris_corner) @@ -29,31 +41,9 @@ add_subdirectory(sorting_networks) add_subdirectory(vcycle) # simple CPU-based examples -wrap_impala_sources(MATMUL_PROGRAM - BACKEND cpu - FILES utils.impala matmul.impala) -add_executable(matmul ${MATMUL_PROGRAM}) -target_link_libraries(matmul ${IMPALA_RUNTIME_LIBRARIES}) -add_test("matmul" matmul) +add_test_sample(matmul cpu utils.impala matmul.impala) # examples based on the "mapping" -wrap_impala_sources(GAUSSIAN_PROGRAM - BACKEND ${BACKEND} - FILES utils.impala mapping_${DEVICE}.impala gaussian.impala) -add_executable(gaussian ${GAUSSIAN_PROGRAM}) -target_link_libraries(gaussian ${IMPALA_RUNTIME_LIBRARIES}) -add_test("gaussian" gaussian) - -wrap_impala_sources(BILATERAL_PROGRAM - BACKEND ${BACKEND} - FILES utils.impala mapping_${DEVICE}.impala bilateral.impala) -add_executable(bilateral ${BILATERAL_PROGRAM}) -target_link_libraries(bilateral ${IMPALA_RUNTIME_LIBRARIES}) -add_test("bilateral" bilateral) - -wrap_impala_sources(JACOBI_PROGRAM - BACKEND ${BACKEND} - FILES utils.impala mapping_${DEVICE}.impala jacobi.impala) -add_executable(jacobi ${JACOBI_PROGRAM}) -target_link_libraries(jacobi ${IMPALA_RUNTIME_LIBRARIES}) -add_test("jacobi" jacobi) +add_test_sample(gaussian ${BACKEND} utils.impala mapping_${DEVICE}.impala gaussian.impala) +add_test_sample(bilateral ${BACKEND} utils.impala mapping_${DEVICE}.impala bilateral.impala) +add_test_sample(jacobi ${BACKEND} utils.impala mapping_${DEVICE}.impala jacobi.impala) diff --git a/aobench/CMakeLists.txt b/aobench/CMakeLists.txt index 8dadf3c..ecb798a 100644 --- a/aobench/CMakeLists.txt +++ b/aobench/CMakeLists.txt @@ -1,7 +1,4 @@ -wrap_impala_sources(AOBENCH_PROGRAM - BACKEND ${BACKEND} - FILES ../utils.impala mapping_${DEVICE}.impala aobench.impala) -add_executable(aobench main.cpp ${AOBENCH_PROGRAM}) -target_link_libraries(aobench ${IMPALA_RUNTIME_LIBRARIES}) +add_test_sample(aobench ${BACKEND} + CXX main.cpp + IMPALA ../utils.impala mapping_${DEVICE}.impala aobench.impala) set_target_properties(aobench PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -add_test("aobench" aobench) diff --git a/bilateral_grid/CMakeLists.txt b/bilateral_grid/CMakeLists.txt index 91d4fc5..a44b7de 100644 --- a/bilateral_grid/CMakeLists.txt +++ b/bilateral_grid/CMakeLists.txt @@ -1,8 +1,5 @@ -wrap_impala_sources(BILATERAL_GRID_PROGRAM - BACKEND ${BACKEND} - FILES ../utils.impala mapping_${DEVICE}.impala bilateral_grid.impala) -add_executable(bilateral_grid main.cpp ${BILATERAL_GRID_PROGRAM}) -target_link_libraries(bilateral_grid ${IMPALA_RUNTIME_LIBRARIES}) +add_test_sample(bilateral_grid ${BACKEND} + CXX main.cpp + IMPALA ../utils.impala mapping_${DEVICE}.impala bilateral_grid.impala) set_target_properties(bilateral_grid PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -add_test("bilateral_grid" bilateral_grid) configure_file(../common/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COPYONLY) diff --git a/harris_corner/CMakeLists.txt b/harris_corner/CMakeLists.txt index 0b4a563..e0380f5 100644 --- a/harris_corner/CMakeLists.txt +++ b/harris_corner/CMakeLists.txt @@ -1,8 +1,5 @@ -wrap_impala_sources(HARRIS_CORNER_PROGRAM - BACKEND ${BACKEND} - FILES ../utils.impala ../mapping_${DEVICE}.impala harris_corner.impala) -add_executable(harris_corner main.cpp ${HARRIS_CORNER_PROGRAM}) -target_link_libraries(harris_corner ${IMPALA_RUNTIME_LIBRARIES}) +add_test_sample(harris_corner ${BACKEND} + CXX main.cpp + IMPALA ../utils.impala ../mapping_${DEVICE}.impala harris_corner.impala) set_target_properties(harris_corner PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -add_test("harris_corner" harris_corner) configure_file(../common/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COPYONLY) diff --git a/image_sharpening/CMakeLists.txt b/image_sharpening/CMakeLists.txt index 9c59350..0fcb09e 100644 --- a/image_sharpening/CMakeLists.txt +++ b/image_sharpening/CMakeLists.txt @@ -1,8 +1,5 @@ -wrap_impala_sources(SHARPENING_PROGRAM - BACKEND ${BACKEND} - FILES ../utils.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala sharpening.impala) -add_executable(sharpening main.cpp ${SHARPENING_PROGRAM}) -target_link_libraries(sharpening ${IMPALA_RUNTIME_LIBRARIES}) +add_test_sample(sharpening ${BACKEND} + CXX main.cpp + IMPALA ../utils.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala sharpening.impala) set_target_properties(sharpening PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -add_test("sharpening" sharpening) configure_file(goldhill.pgm ${CMAKE_CURRENT_BINARY_DIR}/goldhill.pgm COPYONLY) diff --git a/sorting_networks/CMakeLists.txt b/sorting_networks/CMakeLists.txt index eec57f4..1008f78 100644 --- a/sorting_networks/CMakeLists.txt +++ b/sorting_networks/CMakeLists.txt @@ -1,6 +1,2 @@ -wrap_impala_sources(MEDIAN_PROGRAM - BACKEND ${BACKEND} - FILES ../utils.impala mapping_${DEVICE}.impala oddeven.impala median.impala) -add_executable(median ${MEDIAN_PROGRAM}) -target_link_libraries(median ${IMPALA_RUNTIME_LIBRARIES}) -add_test("median" median) +add_test_sample(median ${BACKEND} + ../utils.impala mapping_${DEVICE}.impala oddeven.impala median.impala) diff --git a/vcycle/CMakeLists.txt b/vcycle/CMakeLists.txt index 2e5f0dd..e8f580e 100644 --- a/vcycle/CMakeLists.txt +++ b/vcycle/CMakeLists.txt @@ -1,8 +1,5 @@ -wrap_impala_sources(VCYCLE_PROGRAM - BACKEND ${BACKEND} - FILES ../utils.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala vcycle.impala) -add_executable(vcycle main.cpp ${VCYCLE_PROGRAM}) -target_link_libraries(vcycle ${IMPALA_RUNTIME_LIBRARIES}) +add_test_sample(vcycle ${BACKEND} + CXX main.cpp + IMPALA ../utils.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala vcycle.impala) set_target_properties(vcycle PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -add_test("vcycle" vcycle) configure_file(../common/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COPYONLY) From 3b980365cc83ced6fa46da24d9835aacc68f8602 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Mon, 6 Feb 2017 10:29:19 +0100 Subject: [PATCH 3/8] Add polyfill of drand48() to aobench for msvc --- aobench/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aobench/main.cpp b/aobench/main.cpp index f587411..e896b0a 100644 --- a/aobench/main.cpp +++ b/aobench/main.cpp @@ -11,6 +11,17 @@ void saveppm(uint8_t* img, int width, int height) { write_pnm_image(img, width, height, "aobench.ppm", pnm_t::P6); } +// polyfill of non-standard drand48() +#ifdef _MSC_VER + +#include +static std::mt19937_64 std_gen64; +static std::uniform_real_distribution std_dist64(0., 1.); +extern "C" void srand48(int64_t seed) { std_gen64.seed(seed); } +extern "C" double drand48() { return std_dist64(std_gen64); } + +#endif // _MSC_VER + /************************************************************************* * Main function * *************************************************************************/ From 994e35518374d5fd0fe9d2f64c7619f8ebd656f8 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Mon, 6 Mar 2017 19:33:24 +0100 Subject: [PATCH 4/8] Fix missing input file --- sorting_networks/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorting_networks/CMakeLists.txt b/sorting_networks/CMakeLists.txt index 05fed05..5800a98 100644 --- a/sorting_networks/CMakeLists.txt +++ b/sorting_networks/CMakeLists.txt @@ -1,2 +1,2 @@ add_test_sample(median - ../utils.impala ../stencil_lib.impala mapping_${DEVICE}.impala oddeven.impala median.impala) + ../utils.impala ../stencil_lib.impala ../mapping_${DEVICE}.impala mapping_${DEVICE}.impala oddeven.impala median.impala) From 56b737726a36b5131b4738663f6c0c84cf03d748 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Wed, 8 Mar 2017 15:33:46 +0100 Subject: [PATCH 5/8] Fix gpu memory tests and replace with common add_test_sample() macro --- test/CMakeLists.txt | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a7698a..e073c4d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,29 +5,13 @@ target_link_libraries(stencil_dsl ${IMPALA_RUNTIME_LIBRARIES}) add_test("stencil_dsl" stencil_dsl) if(NOT (BACKEND STREQUAL "cpu" OR BACKEND STREQUAL "avx")) - wrap_impala_sources(MULTI_GPU_PROGRAM - FILES ../${BACKEND_FILE} ../utils.impala multi_gpu.impala) - add_executable(multi_gpu ${MULTI_GPU_PROGRAM}) - target_link_libraries(multi_gpu ${IMPALA_RUNTIME_LIBRARIES}) - add_test("multi_gpu" multi_gpu) + add_test_sample(multi_gpu ../utils.impala multi_gpu.impala) - wrap_impala_sources(ALLOC_GPU_PROGRAM - FILES ../${BACKEND_FILE} alloc_gpu.impala) - add_executable(alloc_gpu ${ALLOC_GPU_PROGRAM}) - target_link_libraries(alloc_gpu ${IMPALA_RUNTIME_LIBRARIES}) - add_test("alloc_gpu" alloc_gpu) + add_test_sample(alloc_gpu alloc_gpu.impala) - wrap_impala_sources(ALLOC_GPU_UNIFIED_PROGRAM - FILES ../${BACKEND_FILE} alloc_gpu_unified.impala) - add_executable(alloc_gpu_unified ${ALLOC_GPU_UNIFIED_PROGRAM}) - target_link_libraries(alloc_gpu_unified ${IMPALA_RUNTIME_LIBRARIES}) - add_test("alloc_gpu_unified" alloc_gpu_unified) + add_test_sample(alloc_gpu_unified alloc_gpu_unified.impala) - wrap_impala_sources(RESERVE_SHARED_PROGRAM - FILES ../${BACKEND_FILE} reserve_shared.impala) - add_executable(reserve_shared ${RESERVE_SHARED_PROGRAM}) - target_link_libraries(reserve_shared ${IMPALA_RUNTIME_LIBRARIES}) - add_test("reserve_shared" reserve_shared) + add_test_sample(reserve_shared reserve_shared.impala) if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") wrap_impala_sources(HALF_FLOAT_GPU_PROGRAM From c37f8d3f65901001863b114b88d20ec0040e9af2 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Wed, 8 Mar 2017 15:34:46 +0100 Subject: [PATCH 6/8] Add macro add_test_sample() for half_float_gpu --- test/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e073c4d..68e3148 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,10 +14,11 @@ if(NOT (BACKEND STREQUAL "cpu" OR BACKEND STREQUAL "avx")) add_test_sample(reserve_shared reserve_shared.impala) if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") - wrap_impala_sources(HALF_FLOAT_GPU_PROGRAM - FILES ../${BACKEND_FILE} half_float_gpu.impala) - add_executable(half_float_gpu ${HALF_FLOAT_GPU_PROGRAM}) - target_link_libraries(half_float_gpu ${IMPALA_RUNTIME_LIBRARIES}) - add_test("half_float_gpu" half_float_gpu) + # wrap_impala_sources(HALF_FLOAT_GPU_PROGRAM + # FILES ../${BACKEND_FILE} half_float_gpu.impala) + # add_executable(half_float_gpu ${HALF_FLOAT_GPU_PROGRAM}) + # target_link_libraries(half_float_gpu ${IMPALA_RUNTIME_LIBRARIES}) + # add_test("half_float_gpu" half_float_gpu) + add_test_sample(half_float_gpu half_float_gpu.impala) endif() endif() From c75d21dbba964415cb44747aa90ab42df2f74ee7 Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Wed, 8 Mar 2017 15:35:45 +0100 Subject: [PATCH 7/8] Add polyfill implementation of mrand48() for msvc to aobench --- aobench/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aobench/main.cpp b/aobench/main.cpp index e896b0a..50a317a 100644 --- a/aobench/main.cpp +++ b/aobench/main.cpp @@ -20,6 +20,9 @@ static std::uniform_real_distribution std_dist64(0., 1.); extern "C" void srand48(int64_t seed) { std_gen64.seed(seed); } extern "C" double drand48() { return std_dist64(std_gen64); } +static std::uniform_int_distribution std_disti64(-(1 << 31), 1 << 31); +extern "C" int64_t mrand48() { return std_disti64(std_gen64); } + #endif // _MSC_VER /************************************************************************* From 5d13f6c58d4c33c62fa5ae5975f9a6cbae2bd20d Mon Sep 17 00:00:00 2001 From: Stefan Lemme Date: Wed, 8 Mar 2017 15:36:19 +0100 Subject: [PATCH 8/8] Adjust ignore filter to build* --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 53fd9a9..037b5c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -build +build* *.ll *.bc