From c0d893109b40bd42c90752a68bc73164288172af Mon Sep 17 00:00:00 2001 From: Bailey Chittle Date: Tue, 27 Sep 2022 11:38:46 -0400 Subject: [PATCH 1/4] attempting to compile with intel dpc++, getting some errors --- CMakeLists.txt | 8 ++++---- benchmarks/CMakeLists.txt | 4 ++-- examples/CMakeLists.txt | 4 ++-- tests/pstl-tests/CMakeLists.txt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfdba1b..d443966 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project (SyclSTL) enable_testing() option(PARALLEL_STL_BENCHMARKS "Build the internal benchmarks" OFF) -option(USE_COMPUTECPP "Use ComputeCPP" ON) +option(USE_COMPUTECPP "Use ComputeCPP" OFF) message(STATUS " Path to CMAKE source directory: ${CMAKE_SOURCE_DIR} ") set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/) @@ -27,8 +27,8 @@ if (USE_COMPUTECPP) else() - message(STATUS " Using triSYCL CMake") - include(FindTriSYCL) + message(STATUS " Using alternate CMake") + # include(FindTriSYCL) endif() @@ -37,7 +37,7 @@ include_directories("include") add_subdirectory (src) add_subdirectory (examples) -add_subdirectory (tests) +# add_subdirectory (tests) if (PARALLEL_STL_BENCHMARKS) add_subdirectory (benchmarks) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 16d3ab7..107414e 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -12,8 +12,8 @@ foreach(file ${EXAMPLE_FILES}) target_link_libraries(${SOURCE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT}) - add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp) + # add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} + # ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp) endforeach() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9e73aa2..bde996f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(file ${BENCHMARK_FILES}) target_compile_options(${SOURCE_NAME} PUBLIC ${HOST_COMPILER_OPTIONS}) target_link_libraries(${SOURCE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT}) - add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp ) + # add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} + # ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp ) endforeach() diff --git a/tests/pstl-tests/CMakeLists.txt b/tests/pstl-tests/CMakeLists.txt index a02392f..8aad04d 100644 --- a/tests/pstl-tests/CMakeLists.txt +++ b/tests/pstl-tests/CMakeLists.txt @@ -9,8 +9,8 @@ function(compile_test source) PUBLIC "${CMAKE_THREAD_LIBS_INIT}") add_dependencies(${test_name} gtest_main) add_dependencies(${test_name} gtest) - add_sycl_to_target(${test_name} ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/${source}) + # add_sycl_to_target(${test_name} ${CMAKE_CURRENT_BINARY_DIR} + # ${CMAKE_CURRENT_SOURCE_DIR}/${source}) add_test(test.${test_name} ${test_name}) endfunction() From 6be56ebfe0099686edbe4aab851db953c7a26dbd Mon Sep 17 00:00:00 2001 From: Bailey Chittle Date: Tue, 27 Sep 2022 11:43:59 -0400 Subject: [PATCH 2/4] still getting errors, even when modularized --- benchmarks/CMakeLists.txt | 1 + examples/CMakeLists.txt | 1 + tests/pstl-tests/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 107414e..07cb786 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -14,6 +14,7 @@ foreach(file ${EXAMPLE_FILES}) # add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} # ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp) + target_compile_options(${SOURCE_NAME} PRIVATE -fsycl) endforeach() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index bde996f..6950936 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,5 +15,6 @@ foreach(file ${BENCHMARK_FILES}) # add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} # ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp ) + target_compile_options(${SOURCE_NAME} PRIVATE -fsycl) endforeach() diff --git a/tests/pstl-tests/CMakeLists.txt b/tests/pstl-tests/CMakeLists.txt index 8aad04d..e94aaac 100644 --- a/tests/pstl-tests/CMakeLists.txt +++ b/tests/pstl-tests/CMakeLists.txt @@ -11,6 +11,7 @@ function(compile_test source) add_dependencies(${test_name} gtest) # add_sycl_to_target(${test_name} ${CMAKE_CURRENT_BINARY_DIR} # ${CMAKE_CURRENT_SOURCE_DIR}/${source}) + target_compile_options(${test_name} PRIVATE -fsycl) add_test(test.${test_name} ${test_name}) endfunction() From bfe6593a6ac5157533edb646d57c643dafaebd39 Mon Sep 17 00:00:00 2001 From: Bailey Chittle Date: Tue, 27 Sep 2022 13:40:13 -0400 Subject: [PATCH 3/4] code compiles with some changes, but does not execute properly --- benchmarks/sycl_reduce.cpp | 2 +- examples/CMakeLists.txt | 3 ++- include/sycl/algorithm/buffer_algorithms.hpp | 6 +++--- include/sycl/algorithm/sort.hpp | 2 +- include/sycl/execution_policy | 2 +- include/sycl/helpers/sycl_namegen.hpp | 3 +-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/benchmarks/sycl_reduce.cpp b/benchmarks/sycl_reduce.cpp index 4671c9a..2ebcbc6 100644 --- a/benchmarks/sycl_reduce.cpp +++ b/benchmarks/sycl_reduce.cpp @@ -56,7 +56,7 @@ benchmark<>::time_units_t benchmark_reduce(const unsigned numReps, cl::sycl::queue q(cds); auto device = q.get_device(); const cl::sycl::id<3> maxWorkItemSizes = - device.get_info(); + device.get_info>(); const auto local = std::min( device.get_info(), maxWorkItemSizes[0]); diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6950936..eec4b25 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,6 +15,7 @@ foreach(file ${BENCHMARK_FILES}) # add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} # ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp ) - target_compile_options(${SOURCE_NAME} PRIVATE -fsycl) +add_definitions(-fsycl) +add_link_options(-fsycl) endforeach() diff --git a/include/sycl/algorithm/buffer_algorithms.hpp b/include/sycl/algorithm/buffer_algorithms.hpp index 5c4adf2..14b5fdd 100644 --- a/include/sycl/algorithm/buffer_algorithms.hpp +++ b/include/sycl/algorithm/buffer_algorithms.hpp @@ -87,8 +87,8 @@ sycl_algorithm_descriptor compute_mapreduce_descriptor(cl::sycl::device device, size_t max_work_group = device.get_info(); - const cl::sycl::id<3>max_work_item_sizes = - device.get_info(); + const auto max_work_item_sizes = + device.get_info>(); const auto max_work_item = min( device.get_info(), max_work_item_sizes[0]); @@ -344,7 +344,7 @@ sycl_algorithm_descriptor compute_mapscan_descriptor(cl::sycl::device device, size_t nb_work_group = up_rounded_division(size, size_per_work_group); const cl::sycl::id<3> max_work_item_sizes = - device.get_info(); + device.get_info>(); const auto max_work_item = min( device.get_info(), max_work_item_sizes[0]); diff --git a/include/sycl/algorithm/sort.hpp b/include/sycl/algorithm/sort.hpp index 026425e..b1b6518 100644 --- a/include/sycl/algorithm/sort.hpp +++ b/include/sycl/algorithm/sort.hpp @@ -155,7 +155,7 @@ void sequential_sort(cl::sycl::queue q, cl::sycl::buffer buf, size_t vectorSize) { auto f = [buf, vectorSize](cl::sycl::handler &h) mutable { auto a = buf.template get_access(h); - h.single_task(sort_kernel_sequential(a, vectorSize)); + // h.single_task(sort_kernel_sequential(a, vectorSize)); }; q.submit(f); } diff --git a/include/sycl/execution_policy b/include/sycl/execution_policy index be47cf9..5232fa0 100644 --- a/include/sycl/execution_policy +++ b/include/sycl/execution_policy @@ -106,7 +106,7 @@ class sycl_execution_policy { cl::sycl::nd_range<1> calculateNdRange(size_t problemSize) { const auto& d = m_q.get_device(); const cl::sycl::id<3> maxWorkItemSizes = - d.template get_info(); + d.template get_info>(); const auto localSize = std::min(problemSize, std::min( d.template get_info(), diff --git a/include/sycl/helpers/sycl_namegen.hpp b/include/sycl/helpers/sycl_namegen.hpp index 75a40ec..e2d0b76 100644 --- a/include/sycl/helpers/sycl_namegen.hpp +++ b/include/sycl/helpers/sycl_namegen.hpp @@ -35,7 +35,7 @@ #define _EXPERIMENTAL_DETAIL_SYCL_NAMEGEN__ namespace cl { -namespace sycl { +using namespace sycl; namespace helpers { /** @@ -47,6 +47,5 @@ template class NameGen {}; } } -} #endif // _EXPERIMENTAL_DETAIL_SYCL_NAMEGEN__ \ No newline at end of file From 9917823a1f93873d92237ea2784e8f23195b9f86 Mon Sep 17 00:00:00 2001 From: Bailey Chittle Date: Tue, 27 Sep 2022 14:40:34 -0400 Subject: [PATCH 4/4] code compiles in release mode, can get benchmarks --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d443966..b1cc63d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project (SyclSTL) enable_testing() -option(PARALLEL_STL_BENCHMARKS "Build the internal benchmarks" OFF) +option(PARALLEL_STL_BENCHMARKS "Build the internal benchmarks" ON) option(USE_COMPUTECPP "Use ComputeCPP" OFF) message(STATUS " Path to CMAKE source directory: ${CMAKE_SOURCE_DIR} ") @@ -39,6 +39,8 @@ add_subdirectory (src) add_subdirectory (examples) # add_subdirectory (tests) +add_definitions(-fsycl) +add_link_options(-fsycl) if (PARALLEL_STL_BENCHMARKS) add_subdirectory (benchmarks) endif()