adapt CMake and Readme
This commit is contained in:
parent
9633302226
commit
8145d533dd
@ -4,8 +4,33 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
|
|
||||||
project(sycl_example)
|
project(sycl_example)
|
||||||
|
|
||||||
|
option(USE_INTELSYCL "Use Intel oneAPI compiler" OFF)
|
||||||
|
option(USE_ACPP "Use AdaptiveCpp compiler" OFF)
|
||||||
|
|
||||||
|
if(USE_INTELSYCL AND USE_ACPP)
|
||||||
|
message(FATAL_ERROR "Only one SYCL compiler can be selected.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(USE_INTELSYCL)
|
||||||
|
find_package(IntelSYCL REQUIRED)
|
||||||
|
elseif(USE_ACPP)
|
||||||
find_package(AdaptiveCpp REQUIRED)
|
find_package(AdaptiveCpp REQUIRED)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Set either -DUSE_INTELSYCL or -DUSE_ACPP.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
find_library(LIB_XXHASH xxhash)
|
find_library(LIB_XXHASH xxhash)
|
||||||
|
|
||||||
|
message(STATUS "${IntelSYCL_FOUND}")
|
||||||
|
|
||||||
|
if ((NOT(AdaptiveCpp_FOUND)) AND (NOT(IntelSYCL_FOUND)))
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Could not find either AdaptiveCpp or IntelDPCPP.
|
||||||
|
Install one of them and provide -D<Compiler>_DIR=/path/to/cmake/config.
|
||||||
|
Configuration not possible.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
25
README.org
25
README.org
@ -35,6 +35,28 @@ To use the project, you'll need the following prerequisites:
|
|||||||
|
|
||||||
* Compilation
|
* Compilation
|
||||||
|
|
||||||
|
** Using Intel oneAPI
|
||||||
|
|
||||||
|
Finally, I've made to code run with Intel's oneAPI and adapated the CMake
|
||||||
|
generation process.
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
# Make sure to source Intels vars together with the inbuild llvm!
|
||||||
|
. /opt/intel/oneapi/setvars.sh --include-intel-llvm
|
||||||
|
|
||||||
|
# Create a build directory and navigate to it
|
||||||
|
mkdir build && cd build
|
||||||
|
|
||||||
|
# Adjust the path to AdaptiveCpp and your target devices according to your system
|
||||||
|
CXX=$(which clang++) cmake .. -DUSE_INTELSYCL=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE="Release"
|
||||||
|
|
||||||
|
# Compile the executable
|
||||||
|
make
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Using AdaptiveCpp
|
||||||
|
|
||||||
Regrettably, integrating Intel's oneAPI with the AMD GPU plugin proves to be
|
Regrettably, integrating Intel's oneAPI with the AMD GPU plugin proves to be
|
||||||
quite challenging on Arch Linux, primarily due to the plugin's dependency on an
|
quite challenging on Arch Linux, primarily due to the plugin's dependency on an
|
||||||
older version of ROCm than what's available in the official repositories. While
|
older version of ROCm than what's available in the official repositories. While
|
||||||
@ -59,7 +81,8 @@ To generate Makefiles for AdaptiveCpp, you can follow these steps:
|
|||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
|
|
||||||
# Adjust the path to AdaptiveCpp and your target devices according to your system
|
# Adjust the path to AdaptiveCpp and your target devices according to your system
|
||||||
cmake .. -DAdaptiveCpp_DIR=/opt/AdaptiveCpp/ROCm/lib/cmake/AdaptiveCpp \
|
cmake .. -DUSE_ACPP=ON \
|
||||||
|
-DAdaptiveCpp_DIR=/opt/AdaptiveCpp/ROCm/lib/cmake/AdaptiveCpp \
|
||||||
-DACPP_TARGETS="omp.accelerated;hip.integrated-multipass;gfx90c" \
|
-DACPP_TARGETS="omp.accelerated;hip.integrated-multipass;gfx90c" \
|
||||||
-DCMAKE_BUILD_TYPE="Release"
|
-DCMAKE_BUILD_TYPE="Release"
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
add_executable(sycl_comp sycl_comp.cpp)
|
add_executable(sycl_comp sycl_comp.cpp)
|
||||||
add_sycl_to_target(TARGET sycl_comp)
|
|
||||||
|
add_sycl_to_target(TARGET sycl_comp SOURCES sycl_comp.cpp)
|
||||||
|
|
||||||
target_link_libraries(sycl_comp PRIVATE ${LIB_XXHASH})
|
target_link_libraries(sycl_comp PRIVATE ${LIB_XXHASH})
|
||||||
|
|
||||||
option(SYCL_EX_COMPILE_SEQUENTIAL_BENCH
|
option(SYCL_EX_COMPILE_SEQUENTIAL_BENCH
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user