Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel gpu support #38

Merged
merged 6 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,63 @@ jobs:

- name: Install test for HIP backend
run: |
docker run -v ${{github.workspace}}:/work ${{ env.container }} ./install_test/bin/install_hip.sh /tmp ${{matrix.backend.name}}
docker run -v ${{github.workspace}}:/work ${{ env.container }} ./install_test/bin/install_hip.sh /tmp ${{matrix.backend.name}}

build_intel:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

env:
#architecture: INTEL_PVC
architecture: AMPERE80
#CMAKE_CXX_COMPILER: icpx
CMAKE_CXX_COMPILER: /opt/intel/oneapi/compiler/latest/bin/compiler/clang++
container: intel_env

strategy:
matrix:
backend: [ {name: INTEL, option: ""}, {name: INTEL_HOST_DEVICE, option: "-DKokkosFFT_ENABLE_HOST_AND_DEVICE=ON"} ]

steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with: { tool-cache: true, large-packages: false }

- name: Checkout built branch
uses: actions/checkout@v3
with:
submodules: recursive

- name: Update submodules
run: git submodule update --remote --recursive

- name: Build docker
run: docker build -t ${{ env.container }} docker/intel

- name: Configure CMake for SYCL backend
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
docker run -v ${{github.workspace}}:/work ${{ env.container }} /bin/bash -c \
". /opt/intel/oneapi/setvars.sh --include-intel-llvm && cmake -B build_${{matrix.backend.name}} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=${{env.CMAKE_CXX_COMPILER}} \
-DCMAKE_CXX_STANDARD=17 \
-DKokkosFFT_INTERNAL_Kokkos=ON \
-DKOKKOS_IMPL_SYCL_DEVICE_GLOBAL_SUPPORTED=0 \
-DKokkos_ARCH_NATIVE=ON \
-DCMAKE_CXX_FLAGS="-fsycl-device-code-split=per_kernel -Wno-deprecated-declarations -Werror -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-cuda-version -Wno-sycl-target" \
-DKokkos_ENABLE_SYCL=ON \
-DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DKokkos_ENABLE_UNSUPPORTED_ARCHS=ON \
-DKokkos_ARCH_${{env.architecture}}=ON \
-DBUILD_TESTING=ON ${{matrix.backend.option}}"

- name: Build
# Build your program with the given configuration
run: |
docker run -v ${{github.workspace}}:/work ${{ env.container }} /bin/bash -c ". /opt/intel/oneapi/setvars.sh --include-intel-llvm && cmake --build build_${{matrix.backend.name}} --config ${{env.BUILD_TYPE}} -j 2"
8 changes: 8 additions & 0 deletions common/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ elseif(Kokkos_ENABLE_HIP)
target_link_libraries(common INTERFACE FFTW::Float FFTW::Double FFTW::FloatOpenMP FFTW::DoubleOpenMP)
target_compile_definitions(common INTERFACE ENABLE_HOST_AND_DEVICE)
endif()
elseif(Kokkos_ENABLE_SYCL)
find_package(MKL REQUIRED COMPONENTS SYCL)
target_link_libraries(common INTERFACE MKL::MKL_SYCL)
if(KokkosFFT_ENABLE_HOST_AND_DEVICE)
find_package(FFTW MODULE REQUIRED)
target_link_libraries(common INTERFACE FFTW::Float FFTW::Double FFTW::FloatOpenMP FFTW::DoubleOpenMP)
target_compile_definitions(common INTERFACE ENABLE_HOST_AND_DEVICE)
endif()
elseif(Kokkos_ENABLE_OPENMP)
find_package(FFTW MODULE REQUIRED)
target_link_libraries(common INTERFACE FFTW::Float FFTW::Double FFTW::FloatOpenMP FFTW::DoubleOpenMP)
Expand Down
10 changes: 5 additions & 5 deletions common/src/KokkosFFT_Cuda_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ struct FFTDataType {
cufftDoubleComplex, fftw_complex>;
};

template <typename ExecutionSpace, typename T>
template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using fftwHandle =
std::conditional_t<std::is_same_v<KokkosFFT::Impl::real_type_t<T>, float>,
fftwf_plan, fftw_plan>;
using fftwHandle = std::conditional_t<
std::is_same_v<KokkosFFT::Impl::real_type_t<T1>, float>, fftwf_plan,
fftw_plan>;
using type = std::conditional_t<std::is_same_v<ExecutionSpace, Kokkos::Cuda>,
cufftHandle, fftwHandle>;
};
Expand Down Expand Up @@ -151,7 +151,7 @@ struct FFTDataType {
using complex128 = cufftDoubleComplex;
};

template <typename ExecutionSpace, typename T>
template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using type = cufftHandle;
};
Expand Down
10 changes: 5 additions & 5 deletions common/src/KokkosFFT_HIP_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ struct FFTDataType {
hipfftDoubleComplex, fftw_complex>;
};

template <typename ExecutionSpace, typename T>
template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using fftwHandle =
std::conditional_t<std::is_same_v<KokkosFFT::Impl::real_type_t<T>, float>,
fftwf_plan, fftw_plan>;
using fftwHandle = std::conditional_t<
std::is_same_v<KokkosFFT::Impl::real_type_t<T1>, float>, fftwf_plan,
fftw_plan>;
using type = std::conditional_t<std::is_same_v<ExecutionSpace, Kokkos::HIP>,
hipfftHandle, fftwHandle>;
};
Expand Down Expand Up @@ -151,7 +151,7 @@ struct FFTDataType {
using complex128 = hipfftDoubleComplex;
};

template <typename ExecutionSpace, typename T>
template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using type = hipfftHandle;
};
Expand Down
8 changes: 4 additions & 4 deletions common/src/KokkosFFT_OpenMP_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ struct FFTDataType {
using complex128 = fftw_complex;
};

template <typename ExecutionSpace, typename T>
template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using type =
std::conditional_t<std::is_same_v<KokkosFFT::Impl::real_type_t<T>, float>,
fftwf_plan, fftw_plan>;
using type = std::conditional_t<
std::is_same_v<KokkosFFT::Impl::real_type_t<T1>, float>, fftwf_plan,
fftw_plan>;
};

template <typename ExecutionSpace>
Expand Down
Loading
Loading