Skip to content
Closed
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
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@ option(ENABLE_MKLGPU_BACKEND "" ON)
if(ENABLE_MKLCPU_BACKEND)
option(ENABLE_MKLCPU_THREAD_TBB "" ON)
endif()
option(ENABLE_CUBLAS_BACKEND "" OFF)

option(ENABLE_CUSOLVER_BACKEND "" OFF)

# blas
option(ENABLE_CUBLAS_BACKEND "" OFF)
option(ENABLE_ROCBLAS_BACKEND "" OFF)
option(ENABLE_NETLIB_BACKEND "" OFF)

# rand
option(ENABLE_CURAND_BACKEND "" OFF)
option(ENABLE_ROCRAND_BACKEND "" OFF)

# lapack
option(ENABLE_CUSOLVER_BACKEND "" OFF)
option(ENABLE_ROCSOLVER_BACKEND "" OFF)
option(ENABLE_NETLIB_BACKEND "" OFF)

# dft
option(ENABlE_CUFFT_BACKEND "enable the cuFFT backend for DFT" OFF)


set(ONEMKL_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Name of the SYCL compiler")
set(HIP_TARGETS "" CACHE STRING "Target HIP architectures")

Expand Down Expand Up @@ -89,7 +98,8 @@ if(ENABLE_MKLCPU_BACKEND
list(APPEND DOMAINS_LIST "rng")
endif()
if(ENABLE_MKLGPU_BACKEND
OR ENABLE_MKLCPU_BACKEND)
OR ENABLE_MKLCPU_BACKEND
OR ENABLE_CUFFT_BACKEND)
list(APPEND DOMAINS_LIST "dft")
endif()

Expand All @@ -99,8 +109,8 @@ if(CMAKE_CXX_COMPILER OR NOT ONEMKL_SYCL_IMPLEMENTATION STREQUAL "dpc++")
string(REPLACE "\\" "/" CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
endif()
else()
if(ENABLE_CUBLAS_BACKEND OR ENABLE_CURAND_BACKEND OR ENABLE_ROCBLAS_BACKEND
OR ENABLE_ROCRAND_BACKEND OR ENABLE_ROCSOLVER_BACKEND)
if(ENABLE_CUBLAS_BACKEND OR ENABLE_CURAND_BACKEND OR ENABlE_CUFFT_BACKEND
OR ENABLE_ROCBLAS_BACKEND OR ENABLE_ROCRAND_BACKEND OR ENABLE_ROCSOLVER_BACKEND)
set(CMAKE_CXX_COMPILER "clang++")
elseif(ENABLE_MKLGPU_BACKEND)
if(UNIX)
Expand Down
1 change: 1 addition & 0 deletions include/oneapi/mkl/detail/backends.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum class backend {
netlib,
rocblas,
rocrand,
cufft,
unsupported
};

Expand Down
6 changes: 6 additions & 0 deletions include/oneapi/mkl/detail/backends_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ static std::map<domain, std::map<device, std::vector<const char*>>> libraries =
{
#ifdef ENABLE_MKLGPU_BACKEND
LIB_NAME("dft_mklgpu")
#endif
} },
{ device::nvidiagpu,
{
#ifdef ENABLE_CUFFT_BACKEND
LIB_NAME("dft_cufft")
#endif
} } } },

Expand Down
2 changes: 1 addition & 1 deletion include/oneapi/mkl/dft/detail/commit_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class commit_impl {
virtual void* get_handle() noexcept = 0;

private:
mkl::backend backend_;
sycl::queue queue_;
mkl::backend backend_;
};

} // namespace oneapi::mkl::dft::detail
Expand Down
48 changes: 48 additions & 0 deletions include/oneapi/mkl/dft/detail/cufft/onemkl_dft_cufft.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright 2023 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*
*
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

#ifndef _ONEMKL_DFT_CUFFT_HPP_
#define _ONEMKL_DFT_CUFFT_HPP_

#if __has_include(<sycl/sycl.hpp>)
#include <sycl/sycl.hpp>
#else
#include <CL/sycl.hpp>
#endif

#include "oneapi/mkl/detail/export.hpp"
#include "oneapi/mkl/dft/detail/types_impl.hpp"

namespace oneapi::mkl::dft {

namespace detail {
// Forward declarations
class commit_impl;

template <precision prec, domain dom>
class descriptor;
} // namespace detail

namespace cufft {
#include "oneapi/mkl/dft/detail/dft_ct.hxx"
} // namespace cufft

} // namespace oneapi::mkl::dft

#endif // _ONEMKL_DFT_CUFFT_HPP_
4 changes: 4 additions & 0 deletions include/oneapi/mkl/dft/detail/descriptor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class descriptor {
void commit(backend_selector<backend::mklgpu> selector);
#endif

#ifdef ENABLE_CUFFT_BACKEND
void commit(backend_selector<backend::cufft> selector);
#endif

const dft_values<prec, dom>& get_values() const noexcept {
return values_;
};
Expand Down
1 change: 1 addition & 0 deletions src/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#cmakedefine ENABLE_CUBLAS_BACKEND
#cmakedefine ENABLE_CUSOLVER_BACKEND
#cmakedefine ENABLE_CUFFT_BACKEND
#cmakedefine ENABLE_ROCBLAS_BACKEND
#cmakedefine ENABLE_ROCRAND_BACKEND
#cmakedefine ENABLE_ROCSOLVER_BACKEND
Expand Down
4 changes: 4 additions & 0 deletions src/dft/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ endif()
if(ENABLE_MKLCPU_BACKEND)
add_subdirectory(mklcpu)
endif()

if(ENABLE_CUFFT_BACKEND)
add_subdirectory(cufft)
endif()
74 changes: 74 additions & 0 deletions src/dft/backends/cufft/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#===============================================================================
# Copyright 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions
# and limitations under the License.
#
#
# SPDX-License-Identifier: Apache-2.0
#===============================================================================

set(LIB_NAME onemkl_dft_cufft)
set(LIB_OBJ ${LIB_NAME}_obj)

find_package(CUDAToolkit REQUIRED)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT
descriptor.cpp
commit.cpp
forward.cpp
backward.cpp
compute_signature.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: mkl_dft_cufft_wrappers.cpp>
)

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
${MKL_INCLUDE}
)

target_compile_options(${LIB_OBJ} PRIVATE ${ONEMKL_BUILD_COPT} ${MKL_COPT} -Wall)# -Wextra -Wno-conversion -Wno-shadow)

target_link_libraries(${LIB_OBJ} PRIVATE CUDA::cudart CUDA::cufft)

target_link_libraries(${LIB_OBJ} PUBLIC ONEMKL::SYCL::SYCL ${MKL_LINK_SYCL})

set_target_properties(${LIB_OBJ} PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(${LIB_NAME} PUBLIC ${LIB_OBJ})

#Set oneMKL libraries as not transitive for dynamic
if(BUILD_SHARED_LIBS)
set_target_properties(${LIB_NAME} PROPERTIES
INTERFACE_LINK_LIBRARIES ONEMKL::SYCL::SYCL
)
endif()

# Add major version to the library
set_target_properties(${LIB_NAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
)

# Add dependencies rpath to the library
list(APPEND CMAKE_BUILD_RPATH $<TARGET_FILE_DIR:${LIB_NAME}>)

# Add the library to install package
install(TARGETS ${LIB_OBJ} EXPORT oneMKLTargets)
install(TARGETS ${LIB_NAME} EXPORT oneMKLTargets
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
Loading