Skip to content
Snippets Groups Projects
Commit 1bfaaed9 authored by CHAMONT David's avatar CHAMONT David
Browse files

Reorganisation generale

parent 8806f59b
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 4 deletions
File moved
File moved
File moved
#!/bin/bash #!/bin/bash
./build/sycl-square.exe time ./build/main.exe
set(SOURCE_FILE sycl-square.cpp) set(SOURCE_FILE main.cpp)
set(TARGET_NAME sycl-square.exe) set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -Wall") set(COMPILE_FLAGS "-fsycl -Wall")
set(LINK_FLAGS "-fsycl") set(LINK_FLAGS "-fsycl")
......
File moved
# 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)
File moved
File moved
#!/bin/bash #!/bin/bash
./build/sycl-stencil.exe time ./build/main.exe
set(SOURCE_FILE sycl-stencil.cpp) set(SOURCE_FILE main.cpp)
set(TARGET_NAME sycl-stencil.exe) set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -Wall") set(COMPILE_FLAGS "-fsycl -Wall")
set(LINK_FLAGS "-fsycl") set(LINK_FLAGS "-fsycl")
......
#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;
}
# 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)
#!/bin/bash
cd build
make all
#!/bin/bash
rm -rf build
mkdir -p build
cd build
cmake ..
#!/bin/bash
time ./build/main.exe
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