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

Update for the Open SYCL implementation

parent 1b18aa03
No related branches found
No related tags found
No related merge requests found
Showing
with 65 additions and 135 deletions
CMakeLists.txt
build
*.o[0-9]*
*.e[0-9]*
#!/bin/bash
clear
rm -rf build
mkdir -p build
cd build
cmake ..
set(SOURCE_FILE main.cpp)
set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda -Wall")
set(LINK_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda")
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})
......@@ -86,7 +86,7 @@ int main() {
return 0;
}
catch (sycl::exception & e) {
catch (exception & e) {
std::cout << e.what() << std::endl;
std::cout << e.code().message() << std::endl;
}
......
# Direct CMake to use icpx rather than the default C++ compiler/linker
set(CMAKE_CXX_COMPILER icpx)
cmake_minimum_required (VERSION 3.4)
project(GrayScottSyclTuto CXX)
project(BasicStencil CXX)
set(CMAKE_CXX_COMPILER icpx)
set(COMPILE_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda -Wall")
set(LINK_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
......
# Direct CMake to use icpx rather than the default C++ compiler/linker
set(CMAKE_CXX_COMPILER icpx)
cmake_minimum_required (VERSION 3.4)
project(DeviceList CXX)
set(CMAKE_CXX_COMPILER syclcc)
set(COMPILE_FLAGS "-O2 --opensycl-targets=cuda:sm_75")
set(LINK_FLAGS "-O2 --opensycl-targets=cuda:sm_75")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
......
# Direct CMake to use icpx rather than the default C++ compiler/linker
set(CMAKE_CXX_COMPILER icpx)
cmake_minimum_required (VERSION 3.4)
project(ChatGpt 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
clear
rm -rf build
mkdir -p build
cd build
cmake ..
set(SOURCE_FILE main.cpp)
set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda -Wall")
set(LINK_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda")
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})
#!/bin/bash
rm -rf build
mkdir -p build
cd build
cmake ..
set(SOURCE_FILE main.cpp)
set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda -Wall")
set(LINK_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda")
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})
# Direct CMake to use icpx rather than the default C++ compiler/linker
set(CMAKE_CXX_COMPILER icpx)
cmake_minimum_required (VERSION 3.4)
project(DeviceSelect 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
clear
rm -rf build
mkdir -p build
cd build
cmake ..
set(SOURCE_FILE main.cpp)
set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda -Wall")
set(LINK_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda")
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})
......@@ -5,6 +5,20 @@
using namespace cl::sycl;
void list_ranks() {
int rank = 0;
queue q { [&]( device const & d ) {
std::string title { "rank " } ;
title += std::to_string(rank++) ;
auto const & p = d.get_platform() ;
std::string device = d.get_info<info::device::name>();
std::cout << std::setw(12) << title << ' ' << device << std::endl;
return 0 ;
}};
}
template<typename Selector>
void try_selector( std::string const & title, Selector const & selector ) {
......@@ -35,6 +49,10 @@ int main( int argc, char * argv[] ) {
assert(argc==2) ;
std::size_t required_rank {std::stoul(argv[1])} ;
// List the devices which are investigated byt the queue constructor
std::cout << std::endl ;
list_ranks();
// Try different predefined selector
std::cout << std::endl ;
try_selector( "DEFAULT:", default_selector_v ) ;
......
......@@ -11,22 +11,27 @@ SYCL general ressources
- [International Workshop on OpenCL and SYCL](https://www.iwocl.org/)
Specific implementations
- [hipSYCL becomes OpenSYCL](https://www.phoronix.com/news/hipSYCL-Becomes-Open-SYCL)
- [HipSYCL becomes OpenSYCL](https://www.phoronix.com/news/hipSYCL-Becomes-Open-SYCL)
- [Data Parallel C++](https://link.springer.com/book/10.1007/978-1-4842-5574-2)
- [Intel DevCloud for oneAPI](https://devcloud.intel.com/oneapi/)
- [codeplay oneAPI plugins for NVIDIA and AMD](https://codeplay.com/solutions/oneapi/)
- [codeplay SYCL Academy](https://github.com/codeplaysoftware/syclacademy)
- [Codeplay oneAPI plugins for NVIDIA and AMD](https://codeplay.com/solutions/oneapi/)
- [Codeplay SYCL Academy](https://github.com/codeplaysoftware/syclacademy)
- [OpenSYCL](https://github.com/OpenSYCL/OpenSYCL)
MUST center
- [Introduction au centre de calcul MUST](https://cta-lapp.pages.in2p3.fr/COURS/INTRODUCTION_MUST/)
- [MUST center documentation](https://doc.must-datacentre.fr/)
Other useful resources
- [NVidia cards](https://en.wikipedia.org/wiki/List_of_Nvidia_graphics_processing_units)
### Requirements for this tutorial
Ideally, you should have oneAPI installed on your computer,
or have access to a center where it is. Be aware that the standard oneAPI
installation will only see the Intel hardware, unless someone additionally installed
some specific plugins, such a the [codeplay ones](https://codeplay.com/solutions/oneapi/).
You sould have **oneAPI** or **Open SYCL** installed on your computer, or have access to a center where it is.
Be aware that the standard oneAPI installation will only see the Intel hardware, unless
someone additionally installed some specific plugins, such a
the [codeplay ones](https://codeplay.com/solutions/oneapi/).
Most utility scripts assume you are running a bash shell.
......@@ -39,12 +44,17 @@ with the image provided by Intel on the Docker hub:
docker run --device=/dev/dri --network host --privileged -it --rm -v ${PWD}:/work -w /work intel/oneapi-basekit
```
You can even try this one, where have been added CUDA et the Codeplay plugin for NVidia cards:
You can even try the image below, where have been added CUDA et the Codeplay plugin for NVidia cards.
Be aware that it has been compiled with a given CUDA version aand CUDA driver version (12.2 and 535.54.03
respectively), and you should have installed the same version of CUDA and its driver on your host, or
the Docker container may not correctly communicate with the host NVidia card.
```
docker run --device=/dev/dri --network host --privileged -it --rm -v ${PWD}:/work -w /work chavid/oneapicuda:v1
docker run --device=/dev/dri --network host --privileged -it --rm -v ${PWD}:/work -w /work chavid/oneapicuda:v535.54.03
```
UNDER WORK: using the image `fodinabor/opensycl:latest`.
### Running on Intel DevCloud
Provided you have asked for an account, and make the Intel recommended local ssh installation,
......@@ -53,8 +63,9 @@ that is how you may run the demo `SquareBuffers` on an intel integrated GPU:
```
ssh devcloud
git clone https://gitlab.in2p3.fr/chamont/grayscottchallenge.git
cd GrayScottChallenge/SquareBuffers
qsub -l nodes=1:gpu:ppn=2 -d . cmake.sh
cd GrayScottChallenge
qsub -l nodes=1:gpu:ppn=2 -d . cmake-oneapi.sh
cd SquareBuffers
qsub -l nodes=1:gpu:ppn=2 -d . make.sh
qsub -l nodes=1:gpu:ppn=2 -d . run.sh
qstat
......@@ -65,7 +76,8 @@ Or, if you prefer to run on cpu:
```
...
qsub -l nodes=1:xeon:ppn=2 -d . cmake.sh
qsub -l nodes=1:xeon:ppn=2 -d . cmake-oneapi.sh
...
qsub -l nodes=1:xeon:ppn=2 -d . make.sh
qsub -l nodes=1:xeon:ppn=2 -d . run.sh
...
......@@ -109,11 +121,15 @@ v[r,c] += dv*DT;
## Check SYCL installation and init your project
Move to `SquareBuffers`, inspect all the files so to get acquainted with the
Before anything, `source env.bash` within the top directory.
Then, depending on the available SYCL implementation:
- oneAPI: `cmake-oneapi.bash`
- Open SYCL: `cmake-opensycl.bash`
Then move to `SquareBuffers`, inspect all the files so to get acquainted with the
build chain, and check that your installation is working:
```
./cmake.bash
./make.bash
./run.bash
```
......@@ -134,6 +150,12 @@ which displays a short list of available devices. Try it.
Then move to `DeviceSelect`, which demonstrates different ways to select
a device : the predefined ones, and a home-made one (lambda function)
which select the device whose rank is provided on the command line.
The specific `run.bash` of this direcotry require rank number as
argument. so to demonstrate how a device can be selected this way.
The program also lists all the devces which are insvestigated while
constructing a queue. It should be the same, or close to what was
shown by `DeviceList`... but you may discover that it is not always
the case (at least with the Open SYCL implementaiton we just tried !).
Improve `MyProject` with the selector of your choice.
......
# Direct CMake to use icpx rather than the default C++ compiler/linker
set(CMAKE_CXX_COMPILER icpx)
cmake_minimum_required (VERSION 3.4)
project(SquareBuffers 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
rm -rf build
mkdir -p build
cd build
cmake ..
#!/bin/bash
clear
cd build
make all
set(SOURCE_FILE main.cpp)
set(TARGET_NAME main.exe)
set(COMPILE_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda -Wall")
set(LINK_FLAGS "-fsycl -fsycl-targets=spir64,nvptx64-nvidia-cuda")
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})
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