-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #1730 Add custom thrust/cub namespace when it is supported
This PR adds custom thrust namespace for hip and cuda when it is supported to reduce the potential conflict by thrust itself. Hip enables it after 5.7 and cuda enable it after 11.6 Related PR: #1730
- Loading branch information
Showing
24 changed files
with
212 additions
and
76 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
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
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
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
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
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,43 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_CUDA_BASE_CUBLAS_HANDLE_HPP_ | ||
#define GKO_CUDA_BASE_CUBLAS_HANDLE_HPP_ | ||
|
||
|
||
#include <cublas_v2.h> | ||
|
||
#include <ginkgo/core/base/exception_helpers.hpp> | ||
|
||
|
||
namespace gko { | ||
namespace kernels { | ||
namespace cuda { | ||
namespace cublas { | ||
|
||
|
||
inline cublasHandle_t init(cudaStream_t stream) | ||
{ | ||
cublasHandle_t handle; | ||
GKO_ASSERT_NO_CUBLAS_ERRORS(cublasCreate(&handle)); | ||
GKO_ASSERT_NO_CUBLAS_ERRORS( | ||
cublasSetPointerMode(handle, CUBLAS_POINTER_MODE_DEVICE)); | ||
GKO_ASSERT_NO_CUBLAS_ERRORS(cublasSetStream(handle, stream)); | ||
return handle; | ||
} | ||
|
||
|
||
inline void destroy(cublasHandle_t handle) | ||
{ | ||
GKO_ASSERT_NO_CUBLAS_ERRORS(cublasDestroy(handle)); | ||
} | ||
|
||
|
||
} // namespace cublas | ||
} // namespace cuda | ||
} // namespace kernels | ||
} // namespace gko | ||
|
||
|
||
#endif // GKO_CUDA_BASE_CUBLAS_HANDLE_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
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
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
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
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,48 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#ifndef GKO_HIP_BASE_HIPBLAS_HANDLE_HPP_ | ||
#define GKO_HIP_BASE_HIPBLAS_HANDLE_HPP_ | ||
|
||
|
||
#if HIP_VERSION >= 50200000 | ||
#include <hipblas/hipblas.h> | ||
#else | ||
#include <hipblas.h> | ||
#endif | ||
|
||
#include <ginkgo/core/base/exception_helpers.hpp> | ||
|
||
|
||
namespace gko { | ||
namespace kernels { | ||
namespace hip { | ||
namespace hipblas { | ||
|
||
|
||
inline hipblasContext* init(hipStream_t stream) | ||
{ | ||
hipblasHandle_t handle; | ||
GKO_ASSERT_NO_HIPBLAS_ERRORS(hipblasCreate(&handle)); | ||
GKO_ASSERT_NO_HIPBLAS_ERRORS( | ||
hipblasSetPointerMode(handle, HIPBLAS_POINTER_MODE_DEVICE)); | ||
GKO_ASSERT_NO_HIPBLAS_ERRORS(hipblasSetStream(handle, stream)); | ||
return reinterpret_cast<hipblasContext*>(handle); | ||
} | ||
|
||
|
||
inline void destroy_hipblas_handle(hipblasContext* handle) | ||
{ | ||
GKO_ASSERT_NO_HIPBLAS_ERRORS( | ||
hipblasDestroy(reinterpret_cast<hipblasHandle_t>(handle))); | ||
} | ||
|
||
|
||
} // namespace hipblas | ||
} // namespace hip | ||
} // namespace kernels | ||
} // namespace gko | ||
|
||
|
||
#endif // GKO_HIP_BASE_HIPBLAS_HANDLE_HPP_ |
Oops, something went wrong.