Skip to content

Commit

Permalink
Moving from DPC++ compiler to ICX/ICPX usage (uxlfoundation#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
akabalov authored Oct 13, 2022
1 parent c502dec commit 941f6ee
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
27 changes: 20 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,31 @@ else()
if(ENABLE_CUBLAS_BACKEND OR ENABLE_CURAND_BACKEND OR ENABLE_ROCBLAS_BACKEND)
set(CMAKE_CXX_COMPILER "clang++")
elseif(ENABLE_MKLGPU_BACKEND)
set(CMAKE_CXX_COMPILER "dpcpp")
if(UNIX)
set(CMAKE_CXX_COMPILER "icpx")
else()
set(CMAKE_CXX_COMPILER "icx")
endif()
else()
find_program(DPCPP_PATH dpcpp)
if(DPCPP_PATH)
message(STATUS "CXX compiler: dpcpp was found in PATH, using dpcpp")
set(CMAKE_CXX_COMPILER "dpcpp")
if(UNIX)
find_program(ICPX_ICX_PATH icpx)
else()
find_program(ICPX_ICX_PATH icx)
endif()
if(ICPX_ICX_PATH)
if(UNIX)
message(STATUS "CXX compiler: icpx was found in PATH, using icpx")
set(CMAKE_CXX_COMPILER "icpx")
else()
message(STATUS "CXX compiler: icx was found in PATH, using icx")
set(CMAKE_CXX_COMPILER "icx")
endif()
else()
if(WIN32)
message(STATUS "CXX compiler: dpcpp was not found in PATH, using clang-cl instead")
message(STATUS "CXX compiler: icx was not found in PATH, using clang-cl instead")
set(CMAKE_CXX_COMPILER "clang-cl")
else()
message(STATUS "CXX compiler: dpcpp was not found in PATH, using clang++ instead")
message(STATUS "CXX compiler: icpx was not found in PATH, using clang++ instead")
set(CMAKE_CXX_COMPILER "clang++")
endif()
endif()
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ oneapi::mkl::blas::column_major::gemm(gpu_queue, transA, transB, m, ...);
```
How to build an application with run-time dispatching:
if OS is Linux, use icpx compiler. If OS is Windows, use icx compiler.
Linux example:
```cmd
$> dpcpp -fsycl –I$ONEMKL/include app.cpp
$> dpcpp -fsycl app.o –L$ONEMKL/lib –lonemkl
$> icpx -fsycl –I$ONEMKL/include app.cpp
$> icpx -fsycl app.o –L$ONEMKL/lib –lonemkl
```

- **Compile-time dispatching**: The application uses a templated backend selector API where the template parameters specify the required backends and third-party libraries and the application is linked with the required oneMKL backend wrapper libraries (libraries can be static or dynamic).
Expand Down Expand Up @@ -120,7 +122,7 @@ $> clang++ -fsycl –I$ONEMKL/include app.cpp
$> clang++ -fsycl app.o –L$ONEMKL/lib –lonemkl_blas_mklcpu –lonemkl_blas_cublas
```

*Refer to [Selecting a Compiler](https://oneapi-src.github.io/oneMKL/selecting_a_compiler.html) for the choice between `dpcpp` and `clang++` compilers.*
*Refer to [Selecting a Compiler](https://oneapi-src.github.io/oneMKL/selecting_a_compiler.html) for the choice between `icpx/icx` and `clang++` compilers.*

### Supported Configurations:

Expand Down
2 changes: 1 addition & 1 deletion deps/googletest/cmake/internal_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ macro(config_compiler_and_linker)
set(cxx_base_flags "-Wall -Wshadow -Wconversion")
set(cxx_exception_flags "-fexceptions")
set(cxx_no_exception_flags "-fno-exceptions")
set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls")
set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Winline -Wredundant-decls")
set(cxx_no_rtti_flags "-fno-rtti")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow -Werror")
Expand Down
8 changes: 5 additions & 3 deletions docs/selecting_a_compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ You must choose a compiler according to the required backend of your
application.

* If your application requires Intel GPU, use
`Intel(R) oneAPI DPC++ Compiler <https://software.intel.com/en-us/oneapi/dpc-compiler>`_ ``dpcpp``.
`Intel(R) oneAPI DPC++ Compiler <https://software.intel.com/en-us/oneapi/dpc-compiler>`_ ``icpx`` on Linux or ``icx`` on Windows.
* If your application requires NVIDIA GPU, use the latest release of
``clang++`` from `Intel project for LLVM* technology <https://github.com/intel/llvm/releases>`_.
* If your application requires AMD GPU, use ``hipSYCL`` from the `hipSYCL repository <https://github.com/illuhad/hipSYCL>`_
or use the latest release of ``clang++`` from `Intel project for LLVM* technology <https://github.com/intel/llvm/releases>`_.
* If no Intel GPU, NVIDIA GPU, or AMD GPU is required, you can use either
* If no Intel GPU, NVIDIA GPU, or AMD GPU is required, on Linux you can use either
`Intel(R) oneAPI DPC++ Compiler <https://software.intel.com/en-us/oneapi/dpc-compiler>`_
``dpcpp``, ``clang++``, or ``hipSYCL`` on Linux and ``clang-cl`` on Windows from
``icpx``, ``clang++``, or ``hipSYCL`` and on Windows you can use either
`Intel(R) oneAPI DPC++ Compiler <https://software.intel.com/en-us/oneapi/dpc-compiler>`_
``icx``, or ``clang-cl`` from
`Intel project for LLVM* technology <https://github.com/intel/llvm/releases>`_.

0 comments on commit 941f6ee

Please sign in to comment.