-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add necessary switching headers - Provide device namespace macro via compiler definitions - Add necessary (namespace) aliases - adapt math lib includes and namespaces - uniformize files
- Loading branch information
Showing
229 changed files
with
1,793 additions
and
1,449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_ACCESSOR_CUDA_HIP_HELPER_HPP_ | ||
#define GKO_ACCESSOR_CUDA_HIP_HELPER_HPP_ | ||
|
||
|
||
#include <utility> | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "accessor/hip_helper.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "accessor/cuda_helper.hpp" | ||
#endif | ||
|
||
|
||
namespace gko { | ||
namespace acc { | ||
|
||
|
||
template <typename AccType> | ||
GKO_ACC_INLINE auto as_device_range(AccType&& acc) | ||
{ | ||
#ifdef GKO_COMPILING_HIP | ||
return as_hip_range(std::forward<AccType>(acc)); | ||
#else // GKO_COMPILING_CUDA | ||
return as_cuda_range(std::forward<AccType>(acc)); | ||
#endif | ||
} | ||
|
||
|
||
} // namespace acc | ||
} // namespace gko | ||
|
||
|
||
#endif // GKO_ACCESSOR_CUDA_HIP_HELPER_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_BLAS_BINDINGS_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_BLAS_BINDINGS_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/base/hipblas_bindings.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/base/cublas_bindings.hpp" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_BLAS_BINDINGS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_CONFIG_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_CONFIG_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/base/config.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/base/config.hpp" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_CONFIG_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_POINTER_MODE_GUARD_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_POINTER_MODE_GUARD_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/base/pointer_mode_guard.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/base/pointer_mode_guard.hpp" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_POINTER_MODE_GUARD_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_RANDLIB_BINDINGS_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_RANDLIB_BINDINGS_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/base/hiprand_bindings.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/base/curand_bindings.hpp" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_RANDLIB_BINDINGS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_RUNTIME_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_RUNTIME_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include <hip/hip_runtime.h> | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_RUNTIME_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_SPARSELIB_BINDINGS_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_SPARSELIB_BINDINGS_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/base/hipsparse_bindings.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/base/cusparse_bindings.hpp" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_SPARSELIB_BINDINGS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_BASE_THRUST_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_BASE_THRUST_HPP_ | ||
|
||
|
||
#include <thrust/execution_policy.h> | ||
|
||
|
||
#include <ginkgo/config.hpp> | ||
#include <ginkgo/core/base/executor.hpp> | ||
|
||
|
||
#if defined(GKO_COMPILING_CUDA) || \ | ||
(defined(GKO_COMPILING_HIP) && !GINKGO_HIP_PLATFORM_HCC) | ||
#include <thrust/system/cuda/detail/execution_policy.h> | ||
#else | ||
#include <thrust/system/hip/detail/execution_policy.h> | ||
#endif | ||
|
||
|
||
namespace gko { | ||
namespace kernels { | ||
namespace GKO_DEVICE_NAMESPACE { | ||
|
||
|
||
#ifdef GKO_COMPILING_CUDA | ||
inline auto thrust_policy(std::shared_ptr<const CudaExecutor> exec) | ||
{ | ||
return thrust::cuda::par.on(exec->get_stream()); | ||
} | ||
#else | ||
inline auto thrust_policy(std::shared_ptr<const HipExecutor> exec) | ||
{ | ||
#if GINKGO_HIP_PLATFORM_HCC | ||
return thrust::hip::par.on(exec->get_stream()); | ||
#else | ||
return thrust::cuda::par.on(exec->get_stream()); | ||
#endif | ||
} | ||
#endif | ||
|
||
|
||
} // namespace GKO_DEVICE_NAMESPACE | ||
} // namespace kernels | ||
} // namespace gko | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_BASE_THRUST_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifdef GKO_COMPILING_CUDA | ||
#include "cuda/base/types.hpp" | ||
#else | ||
#include "hip/base/types.hip.hpp" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_COMPONENTS_COOPERATIVE_GROUPS_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_COMPONENTS_COOPERATIVE_GROUPS_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/components/cooperative_groups.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/components/cooperative_groups.cuh" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_COMPONENTS_COOPERATIVE_GROUPS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_COMPONENTS_FORMAT_CONVERSION_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_COMPONENTS_FORMAT_CONVERSION_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/components/format_conversion.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/components/format_conversion.cuh" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_COMPONENTS_FORMAT_CONVERSION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_COMMON_CUDA_HIP_COMPONENTS_MEMORY_HPP_ | ||
#define GKO_COMMON_CUDA_HIP_COMPONENTS_MEMORY_HPP_ | ||
|
||
|
||
#ifdef GKO_COMPILING_HIP | ||
#include "hip/components/memory.hip.hpp" | ||
#else // GKO_COMPILING_CUDA | ||
#include "cuda/components/memory.cuh" | ||
#endif | ||
|
||
|
||
#endif // GKO_COMMON_CUDA_HIP_COMPONENTS_MEMORY_HPP_ |
Oops, something went wrong.