From 1bfaaed97571cec27f1a327c307d25d8afb8d666 Mon Sep 17 00:00:00 2001 From: David Chamont <chamont@in2p3.fr> Date: Thu, 6 Jul 2023 07:04:30 -0700 Subject: [PATCH] Reorganisation generale --- .../chatgpt-grayscott-alpaka.cpp | 0 .../chatgpt-grayscott-kokkos.cpp | 0 .../chatgpt-grayscott-sycl-2.cpp | 0 .../chatgpt-grayscott-sycl.cpp | 0 {SyclSquare => SquareBuffers}/CMakeLists.txt | 0 {SyclSquare => SquareBuffers}/build.bash | 0 {SyclSquare => SquareBuffers}/cmake.bash | 0 SquareBuffers/run.bash | 2 + .../src/CMakeLists.txt | 4 +- .../src/main.cpp | 0 SquareDevice/CMakeLists.txt | 12 ++ {SyclStencil => SquareDevice}/build.bash | 0 {SyclStencil => SquareDevice}/cmake.bash | 0 SquareDevice/run.bash | 2 + .../src/CMakeLists.txt | 4 +- SquareDevice/src/main.cpp | 52 ++++++ SquareShared/CMakeLists.txt | 12 ++ SquareShared/build.bash | 3 + SquareShared/cmake.bash | 5 + SquareShared/run.bash | 2 + SquareShared/src/CMakeLists.txt | 10 + SquareShared/src/main.cpp | 52 ++++++ .../CMakeLists.txt | 0 StencilBuffers/build.bash | 3 + StencilBuffers/cmake.bash | 5 + StencilBuffers/run.bash | 2 + StencilBuffers/src/CMakeLists.txt | 10 + .../src/stencil-ba.cpp | 0 SyclGrayScott/run.bash | 2 +- SyclGrayScott/src/sycl-gray-scott.cpp | 173 ++++++++++-------- SyclSquare/run.bash | 2 - SyclStencil/run.bash | 2 - 32 files changed, 273 insertions(+), 86 deletions(-) rename {ChatGpt => GrayScottChatGpt}/chatgpt-grayscott-alpaka.cpp (100%) rename {ChatGpt => GrayScottChatGpt}/chatgpt-grayscott-kokkos.cpp (100%) rename {ChatGpt => GrayScottChatGpt}/chatgpt-grayscott-sycl-2.cpp (100%) rename {ChatGpt => GrayScottChatGpt}/chatgpt-grayscott-sycl.cpp (100%) rename {SyclSquare => SquareBuffers}/CMakeLists.txt (100%) rename {SyclSquare => SquareBuffers}/build.bash (100%) rename {SyclSquare => SquareBuffers}/cmake.bash (100%) create mode 100755 SquareBuffers/run.bash rename {SyclSquare => SquareBuffers}/src/CMakeLists.txt (82%) rename SyclSquare/src/sycl-square.cpp => SquareBuffers/src/main.cpp (100%) create mode 100755 SquareDevice/CMakeLists.txt rename {SyclStencil => SquareDevice}/build.bash (100%) rename {SyclStencil => SquareDevice}/cmake.bash (100%) create mode 100755 SquareDevice/run.bash rename {SyclStencil => SquareDevice}/src/CMakeLists.txt (82%) create mode 100644 SquareDevice/src/main.cpp create mode 100755 SquareShared/CMakeLists.txt create mode 100755 SquareShared/build.bash create mode 100755 SquareShared/cmake.bash create mode 100755 SquareShared/run.bash create mode 100755 SquareShared/src/CMakeLists.txt create mode 100644 SquareShared/src/main.cpp rename {SyclStencil => StencilBuffers}/CMakeLists.txt (100%) create mode 100755 StencilBuffers/build.bash create mode 100755 StencilBuffers/cmake.bash create mode 100755 StencilBuffers/run.bash create mode 100755 StencilBuffers/src/CMakeLists.txt rename SyclStencil/src/sycl-stencil.cpp => StencilBuffers/src/stencil-ba.cpp (100%) delete mode 100755 SyclSquare/run.bash delete mode 100755 SyclStencil/run.bash diff --git a/ChatGpt/chatgpt-grayscott-alpaka.cpp b/GrayScottChatGpt/chatgpt-grayscott-alpaka.cpp similarity index 100% rename from ChatGpt/chatgpt-grayscott-alpaka.cpp rename to GrayScottChatGpt/chatgpt-grayscott-alpaka.cpp diff --git a/ChatGpt/chatgpt-grayscott-kokkos.cpp b/GrayScottChatGpt/chatgpt-grayscott-kokkos.cpp similarity index 100% rename from ChatGpt/chatgpt-grayscott-kokkos.cpp rename to GrayScottChatGpt/chatgpt-grayscott-kokkos.cpp diff --git a/ChatGpt/chatgpt-grayscott-sycl-2.cpp b/GrayScottChatGpt/chatgpt-grayscott-sycl-2.cpp similarity index 100% rename from ChatGpt/chatgpt-grayscott-sycl-2.cpp rename to GrayScottChatGpt/chatgpt-grayscott-sycl-2.cpp diff --git a/ChatGpt/chatgpt-grayscott-sycl.cpp b/GrayScottChatGpt/chatgpt-grayscott-sycl.cpp similarity index 100% rename from ChatGpt/chatgpt-grayscott-sycl.cpp rename to GrayScottChatGpt/chatgpt-grayscott-sycl.cpp diff --git a/SyclSquare/CMakeLists.txt b/SquareBuffers/CMakeLists.txt similarity index 100% rename from SyclSquare/CMakeLists.txt rename to SquareBuffers/CMakeLists.txt diff --git a/SyclSquare/build.bash b/SquareBuffers/build.bash similarity index 100% rename from SyclSquare/build.bash rename to SquareBuffers/build.bash diff --git a/SyclSquare/cmake.bash b/SquareBuffers/cmake.bash similarity index 100% rename from SyclSquare/cmake.bash rename to SquareBuffers/cmake.bash diff --git a/SquareBuffers/run.bash b/SquareBuffers/run.bash new file mode 100755 index 0000000..2cd7eb1 --- /dev/null +++ b/SquareBuffers/run.bash @@ -0,0 +1,2 @@ +#!/bin/bash +time ./build/main.exe diff --git a/SyclSquare/src/CMakeLists.txt b/SquareBuffers/src/CMakeLists.txt similarity index 82% rename from SyclSquare/src/CMakeLists.txt rename to SquareBuffers/src/CMakeLists.txt index 65d3d94..fe04241 100755 --- a/SyclSquare/src/CMakeLists.txt +++ b/SquareBuffers/src/CMakeLists.txt @@ -1,5 +1,5 @@ -set(SOURCE_FILE sycl-square.cpp) -set(TARGET_NAME sycl-square.exe) +set(SOURCE_FILE main.cpp) +set(TARGET_NAME main.exe) set(COMPILE_FLAGS "-fsycl -Wall") set(LINK_FLAGS "-fsycl") diff --git a/SyclSquare/src/sycl-square.cpp b/SquareBuffers/src/main.cpp similarity index 100% rename from SyclSquare/src/sycl-square.cpp rename to SquareBuffers/src/main.cpp diff --git a/SquareDevice/CMakeLists.txt b/SquareDevice/CMakeLists.txt new file mode 100755 index 0000000..36103fa --- /dev/null +++ b/SquareDevice/CMakeLists.txt @@ -0,0 +1,12 @@ +# Direct CMake to use icpx rather than the default C++ compiler/linker +set(CMAKE_CXX_COMPILER icpx) + +cmake_minimum_required (VERSION 3.4) + +project(SyclSquare CXX) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +add_subdirectory (src) diff --git a/SyclStencil/build.bash b/SquareDevice/build.bash similarity index 100% rename from SyclStencil/build.bash rename to SquareDevice/build.bash diff --git a/SyclStencil/cmake.bash b/SquareDevice/cmake.bash similarity index 100% rename from SyclStencil/cmake.bash rename to SquareDevice/cmake.bash diff --git a/SquareDevice/run.bash b/SquareDevice/run.bash new file mode 100755 index 0000000..2cd7eb1 --- /dev/null +++ b/SquareDevice/run.bash @@ -0,0 +1,2 @@ +#!/bin/bash +time ./build/main.exe diff --git a/SyclStencil/src/CMakeLists.txt b/SquareDevice/src/CMakeLists.txt similarity index 82% rename from SyclStencil/src/CMakeLists.txt rename to SquareDevice/src/CMakeLists.txt index e4f20e0..fe04241 100755 --- a/SyclStencil/src/CMakeLists.txt +++ b/SquareDevice/src/CMakeLists.txt @@ -1,5 +1,5 @@ -set(SOURCE_FILE sycl-stencil.cpp) -set(TARGET_NAME sycl-stencil.exe) +set(SOURCE_FILE main.cpp) +set(TARGET_NAME main.exe) set(COMPILE_FLAGS "-fsycl -Wall") set(LINK_FLAGS "-fsycl") diff --git a/SquareDevice/src/main.cpp b/SquareDevice/src/main.cpp new file mode 100644 index 0000000..ff77c3d --- /dev/null +++ b/SquareDevice/src/main.cpp @@ -0,0 +1,52 @@ +#include <CL/sycl.hpp> +#include <array> +#include <iostream> + +#define SIZE 10 + +using namespace cl::sycl; + +int main() { + + // Loop through available platforms and devices + for (auto const& this_platform : platform::get_platforms() ) { + std::cout << "Found platform: " + << this_platform.get_info<info::platform::name>() << "\n"; + for (auto const& this_device : this_platform.get_devices() ) { + std::cout << " Device: " + << this_device.get_info<info::device::name>() << "\n"; + } + } + + // Create SYCL queue + queue q; + std::cout << "Running on device: " + << q.get_device().get_info<info::device::name>() << "\n"; + std::cout << "\n"; + + auto * input = sycl::malloc_shared<float>(SIZE, q); + auto * output = sycl::malloc_shared<float>(SIZE, q); + + // Initialize input array + for (std::size_t i = 0; i < SIZE; i++) { + input[i] = i + 1; + } + + // Submit command group for execution + q.parallel_for(SIZE, [=](id<1> idx) { + output[idx] = input[idx] * input[idx]; + }); + q.wait(); + + // Print the result + for (int i = 0; i < SIZE; i++) { + std::cout << output[i] << " "; + } + std::cout << std::endl; + + // Release resources + sycl::free(input, q); + sycl::free(output, q); + + return 0; +} diff --git a/SquareShared/CMakeLists.txt b/SquareShared/CMakeLists.txt new file mode 100755 index 0000000..36103fa --- /dev/null +++ b/SquareShared/CMakeLists.txt @@ -0,0 +1,12 @@ +# Direct CMake to use icpx rather than the default C++ compiler/linker +set(CMAKE_CXX_COMPILER icpx) + +cmake_minimum_required (VERSION 3.4) + +project(SyclSquare CXX) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +add_subdirectory (src) diff --git a/SquareShared/build.bash b/SquareShared/build.bash new file mode 100755 index 0000000..49344dd --- /dev/null +++ b/SquareShared/build.bash @@ -0,0 +1,3 @@ +#!/bin/bash +cd build +make all diff --git a/SquareShared/cmake.bash b/SquareShared/cmake.bash new file mode 100755 index 0000000..869411d --- /dev/null +++ b/SquareShared/cmake.bash @@ -0,0 +1,5 @@ +#!/bin/bash +rm -rf build +mkdir -p build +cd build +cmake .. diff --git a/SquareShared/run.bash b/SquareShared/run.bash new file mode 100755 index 0000000..2cd7eb1 --- /dev/null +++ b/SquareShared/run.bash @@ -0,0 +1,2 @@ +#!/bin/bash +time ./build/main.exe diff --git a/SquareShared/src/CMakeLists.txt b/SquareShared/src/CMakeLists.txt new file mode 100755 index 0000000..fe04241 --- /dev/null +++ b/SquareShared/src/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCE_FILE main.cpp) +set(TARGET_NAME main.exe) + +set(COMPILE_FLAGS "-fsycl -Wall") +set(LINK_FLAGS "-fsycl") + +add_executable(${TARGET_NAME} ${SOURCE_FILE}) +set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}") +set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "${LINK_FLAGS}") +#add_custom_target(all DEPENDS ${TARGET_NAME}) diff --git a/SquareShared/src/main.cpp b/SquareShared/src/main.cpp new file mode 100644 index 0000000..ff77c3d --- /dev/null +++ b/SquareShared/src/main.cpp @@ -0,0 +1,52 @@ +#include <CL/sycl.hpp> +#include <array> +#include <iostream> + +#define SIZE 10 + +using namespace cl::sycl; + +int main() { + + // Loop through available platforms and devices + for (auto const& this_platform : platform::get_platforms() ) { + std::cout << "Found platform: " + << this_platform.get_info<info::platform::name>() << "\n"; + for (auto const& this_device : this_platform.get_devices() ) { + std::cout << " Device: " + << this_device.get_info<info::device::name>() << "\n"; + } + } + + // Create SYCL queue + queue q; + std::cout << "Running on device: " + << q.get_device().get_info<info::device::name>() << "\n"; + std::cout << "\n"; + + auto * input = sycl::malloc_shared<float>(SIZE, q); + auto * output = sycl::malloc_shared<float>(SIZE, q); + + // Initialize input array + for (std::size_t i = 0; i < SIZE; i++) { + input[i] = i + 1; + } + + // Submit command group for execution + q.parallel_for(SIZE, [=](id<1> idx) { + output[idx] = input[idx] * input[idx]; + }); + q.wait(); + + // Print the result + for (int i = 0; i < SIZE; i++) { + std::cout << output[i] << " "; + } + std::cout << std::endl; + + // Release resources + sycl::free(input, q); + sycl::free(output, q); + + return 0; +} diff --git a/SyclStencil/CMakeLists.txt b/StencilBuffers/CMakeLists.txt similarity index 100% rename from SyclStencil/CMakeLists.txt rename to StencilBuffers/CMakeLists.txt diff --git a/StencilBuffers/build.bash b/StencilBuffers/build.bash new file mode 100755 index 0000000..49344dd --- /dev/null +++ b/StencilBuffers/build.bash @@ -0,0 +1,3 @@ +#!/bin/bash +cd build +make all diff --git a/StencilBuffers/cmake.bash b/StencilBuffers/cmake.bash new file mode 100755 index 0000000..869411d --- /dev/null +++ b/StencilBuffers/cmake.bash @@ -0,0 +1,5 @@ +#!/bin/bash +rm -rf build +mkdir -p build +cd build +cmake .. diff --git a/StencilBuffers/run.bash b/StencilBuffers/run.bash new file mode 100755 index 0000000..db1bdf1 --- /dev/null +++ b/StencilBuffers/run.bash @@ -0,0 +1,2 @@ +#!/bin/bash +./build/main.exe diff --git a/StencilBuffers/src/CMakeLists.txt b/StencilBuffers/src/CMakeLists.txt new file mode 100755 index 0000000..fe04241 --- /dev/null +++ b/StencilBuffers/src/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCE_FILE main.cpp) +set(TARGET_NAME main.exe) + +set(COMPILE_FLAGS "-fsycl -Wall") +set(LINK_FLAGS "-fsycl") + +add_executable(${TARGET_NAME} ${SOURCE_FILE}) +set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}") +set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "${LINK_FLAGS}") +#add_custom_target(all DEPENDS ${TARGET_NAME}) diff --git a/SyclStencil/src/sycl-stencil.cpp b/StencilBuffers/src/stencil-ba.cpp similarity index 100% rename from SyclStencil/src/sycl-stencil.cpp rename to StencilBuffers/src/stencil-ba.cpp diff --git a/SyclGrayScott/run.bash b/SyclGrayScott/run.bash index 2e5db0c..2ba8b5e 100755 --- a/SyclGrayScott/run.bash +++ b/SyclGrayScott/run.bash @@ -2,4 +2,4 @@ time ./build/sycl-gray-scott.exe 270 480 5 10000 time ./build/sycl-gray-scott.exe 540 960 5 10000 time ./build/sycl-gray-scott.exe 1080 1920 5 10000 -time ./build/sycl-gray-scott.exe 2160 3840 5 1000 +#time ./build/sycl-gray-scott.exe 2160 3840 5 1000 diff --git a/SyclGrayScott/src/sycl-gray-scott.cpp b/SyclGrayScott/src/sycl-gray-scott.cpp index d729942..99f8bc3 100644 --- a/SyclGrayScott/src/sycl-gray-scott.cpp +++ b/SyclGrayScott/src/sycl-gray-scott.cpp @@ -76,90 +76,109 @@ int main( int argc, char * argv[] ) { std::size_t nb_iterations {std::stoul(argv[4])} ; assert(nb_iterations % 2 == 0); // nb_iterations must be even - // Loop through available platforms and devices - for (auto const& this_platform : platform::get_platforms() ) { - std::cout << "Found platform: " - << this_platform.get_info<info::platform::name>() << std::endl; - for (auto const& this_device : this_platform.get_devices() ) { - std::cout << " Device: " - << this_device.get_info<info::device::name>() << std::endl; + try { + + // Loop through available platforms and devices + for (auto const& this_platform : platform::get_platforms() ) { + std::cout << "Found platform: " + << this_platform.get_info<info::platform::name>() << std::endl; + for (auto const& this_device : this_platform.get_devices() ) { + std::cout << " Device: " + << this_device.get_info<info::device::name>() << std::endl; + } } - } - // Create SYCL queue - queue q; - - // Running platform and device - std::cout << "Running on platform: " - << q.get_device().get_platform().get_info<info::platform::name>() << std::endl; - std::cout << " Device: " - << q.get_device().get_info<info::device::name>() << std::endl; - std::cout << std::endl; - - // Initialize input array - const std::size_t padded_nb_rows { nb_rows+2 }; - const std::size_t padded_nb_cols { nb_cols+2 }; - const std::size_t size { padded_nb_rows*padded_nb_cols }; - std::vector<float> u1(size); - std::vector<float> v1(size); - std::vector<float> u2(size); - std::vector<float> v2(size); - for (int i = 0; i < padded_nb_rows; i++) { - for (int j = 0; j < padded_nb_cols; j++) { - u1[i*padded_nb_cols+j] = 1.f; - v1[i*padded_nb_cols+j] = 0.f; - u2[i*padded_nb_cols+j] = 1.f; - v2[i*padded_nb_cols+j] = 0.f; + + // Create SYCL queue + queue q; + + // Running platform and device + std::cout << "Running on platform: " + << q.get_device().get_platform().get_info<info::platform::name>() << std::endl; + std::cout << " Device: " + << q.get_device().get_info<info::device::name>() << std::endl; + std::cout << std::endl; + + // Initialize input array + const std::size_t padded_nb_rows { nb_rows+2 }; + const std::size_t padded_nb_cols { nb_cols+2 }; + const std::size_t size { padded_nb_rows*padded_nb_cols }; + std::vector<float> u1(size); + std::vector<float> v1(size); + std::vector<float> u2(size); + std::vector<float> v2(size); + for (int i = 0; i < padded_nb_rows; i++) { + for (int j = 0; j < padded_nb_cols; j++) { + u1[i*padded_nb_cols+j] = 1.f; + v1[i*padded_nb_cols+j] = 0.f; + u2[i*padded_nb_cols+j] = 1.f; + v2[i*padded_nb_cols+j] = 0.f; + } } - } - const std::size_t v_row_begin { (7ul*padded_nb_rows+8ul)/16ul }; - const std::size_t v_row_end { (9ul*padded_nb_rows+8ul)/16ul }; - const std::size_t v_col_begin { (7ul*padded_nb_cols+8ul)/16ul }; - const std::size_t v_col_end { (9ul*padded_nb_cols+8ul)/16ul }; - std::cout << "v_row_begin: " << v_row_begin << std::endl; - std::cout << "v_row_end: " << v_row_end << std::endl; - std::cout << "v_col_begin: " << v_col_begin << std::endl; - std::cout << "v_col_end: " << v_col_end << std::endl; - std::cout << std::endl; - for (int i = v_row_begin; i < v_row_end; i++) { - for (int j = v_col_begin; j < v_col_end; j++) { - u1[i*padded_nb_cols+j] = 0.f; - v1[i*padded_nb_cols+j] = 1.f; + const std::size_t v_row_begin { (7ul*padded_nb_rows+8ul)/16ul }; + const std::size_t v_row_end { (9ul*padded_nb_rows+8ul)/16ul }; + const std::size_t v_col_begin { (7ul*padded_nb_cols+8ul)/16ul }; + const std::size_t v_col_end { (9ul*padded_nb_cols+8ul)/16ul }; + std::cout << "v_row_begin: " << v_row_begin << std::endl; + std::cout << "v_row_end: " << v_row_end << std::endl; + std::cout << "v_col_begin: " << v_col_begin << std::endl; + std::cout << "v_col_end: " << v_col_end << std::endl; + std::cout << std::endl; + for (int i = v_row_begin; i < v_row_end; i++) { + for (int j = v_col_begin; j < v_col_end; j++) { + u1[i*padded_nb_cols+j] = 0.f; + v1[i*padded_nb_cols+j] = 1.f; + } } - } - - // Create buffers - buffer<float,2> u1b { u1.data(),range<2>{padded_nb_rows,padded_nb_cols} }; - buffer<float,2> v1b { v1.data(),range<2>{padded_nb_rows,padded_nb_cols} }; - buffer<float,2> u2b { u2.data(),range<2>{padded_nb_rows,padded_nb_cols} }; - buffer<float,2> v2b { v2.data(),range<2>{padded_nb_rows,padded_nb_cols} }; - - // iterations - for ( std::size_t image = 0 ; image < nb_images ; ++image ) { - for ( std::size_t iter = 0 ; iter < nb_iterations ; iter += 2 ) { - submit( q, u1b, v1b, u2b, v2b, nb_rows, nb_cols ); - submit( q, u2b, v2b, u1b, v1b, nb_rows, nb_cols ); + + // Create buffers + buffer<float,2> u1b { u1.data(),range<2>{padded_nb_rows,padded_nb_cols} }; + buffer<float,2> v1b { v1.data(),range<2>{padded_nb_rows,padded_nb_cols} }; + buffer<float,2> u2b { u2.data(),range<2>{padded_nb_rows,padded_nb_cols} }; + buffer<float,2> v2b { v2.data(),range<2>{padded_nb_rows,padded_nb_cols} }; + + // iterations + for ( std::size_t image = 0 ; image < nb_images ; ++image ) { + for ( std::size_t iter = 0 ; iter < nb_iterations ; iter += 2 ) { + submit( q, u1b, v1b, u2b, v2b, nb_rows, nb_cols ); + submit( q, u2b, v2b, u1b, v1b, nb_rows, nb_cols ); + } } - } - - // Print some result - host_accessor u1ha{u1b, read_only}; - std::cout<<std::fixed<<std::setprecision(2) ; - for (std::size_t i = v_row_begin; i < v_row_end; i++) { - for (std::size_t j = v_col_begin; j < v_col_end; j++) { - std::cout << u1ha[id<2>{i,j}] << " "; + + // Print some result + const std::size_t row_center { padded_nb_rows/2ul }; + const std::size_t col_center { padded_nb_cols/2ul }; + host_accessor u1ha{u1b, read_only}; + std::cout<<std::fixed<<std::setprecision(2) ; + for (std::size_t i = (row_center-5ul) ; i < (row_center+5ul); i++) { + for (std::size_t j = (col_center-5ul); j < (col_center+5ul); j++) { + std::cout << u1ha[id<2>{i,j}] << " "; + } + std::cout << "\n"; } - std::cout << "\n"; - } - std::cout << std::endl; - host_accessor v1ha{v1b, read_only}; - std::cout<<std::fixed<<std::setprecision(2) ; - for (std::size_t i = v_row_begin; i < v_row_end; i++) { - for (std::size_t j = v_col_begin; j < v_col_end; j++) { - std::cout << v1ha[id<2>{i,j}] << " "; + std::cout << std::endl; + host_accessor v1ha{v1b, read_only}; + std::cout<<std::fixed<<std::setprecision(2) ; + for (std::size_t i = (row_center-5ul) ; i < (row_center+5ul); i++) { + for (std::size_t j = (col_center-5ul); j < (col_center+5ul); j++) { + std::cout << v1ha[id<2>{i,j}] << " "; + } + std::cout << "\n"; } - std::cout << "\n"; + std::cout << std::endl; + + } + catch (sycl::exception & e) { + std::cout << e.what() << std::endl; + std::cout << e.category() << std::endl; + std::cout << e.code() << std::endl; + } + catch (std::exception & e) { + std::cout << e.what() << std::endl; } - std::cout << std::endl; + catch (const char * e) { + std::cout << e << std::endl; + } + return 0; } diff --git a/SyclSquare/run.bash b/SyclSquare/run.bash deleted file mode 100755 index 2aa895b..0000000 --- a/SyclSquare/run.bash +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./build/sycl-square.exe diff --git a/SyclStencil/run.bash b/SyclStencil/run.bash deleted file mode 100755 index 2d07352..0000000 --- a/SyclStencil/run.bash +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./build/sycl-stencil.exe -- GitLab