Skip to content

Commit

Permalink
handle hip_runtime.h uniformly
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed May 19, 2024
1 parent 2dc04aa commit 2a767da
Show file tree
Hide file tree
Showing 43 changed files with 58 additions and 44 deletions.
14 changes: 14 additions & 0 deletions common/cuda_hip/base/runtime.hpp
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_
1 change: 1 addition & 0 deletions cuda/base/batch_multi_vector_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/base/range_accessors.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "cuda/base/batch_struct.hpp"
#include "cuda/base/config.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/base/kernel_launch.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


#include "accessor/cuda_helper.hpp"
#include "common/cuda_hip/base/runtime.hpp"
#include "cuda/base/types.hpp"
#include "cuda/components/thread_ids.cuh"

Expand Down
3 changes: 3 additions & 0 deletions cuda/base/kernel_launch_solver.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#endif


#include "common/cuda_hip/base/runtime.hpp"


namespace gko {
namespace kernels {
namespace cuda {
Expand Down
1 change: 1 addition & 0 deletions cuda/components/reduction.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/base/executor.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/array_access.hpp"
#include "cuda/base/config.hpp"
#include "cuda/base/types.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/factorization/factorization_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <ginkgo/core/base/array.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/array_access.hpp"
#include "core/components/prefix_sum_kernels.hpp"
#include "core/matrix/csr_builder.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/factorization/par_ilu_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <ginkgo/core/matrix/coo.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "cuda/base/math.hpp"
#include "cuda/base/types.hpp"
#include "cuda/components/memory.cuh"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/batch_csr_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/matrix/batch_csr.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "cuda/base/batch_struct.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/batch_dense_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/matrix/batch_dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "cuda/base/batch_struct.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/batch_ell_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/matrix/batch_ell.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "cuda/base/batch_struct.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/coo_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/matrix/dense_kernels.hpp"
#include "cuda/base/config.hpp"
#include "cuda/base/cusparse_bindings.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/dense_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <ginkgo/core/matrix/sparsity_csr.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/utils.hpp"
#include "core/components/prefix_sum_kernels.hpp"
#include "cuda/base/config.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/diagonal_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "cuda/base/config.hpp"
#include "cuda/base/types.hpp"
#include "cuda/components/cooperative_groups.cuh"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/ell_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "accessor/cuda_helper.hpp"
#include "accessor/reduced_row_major.hpp"
#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/mixed_precision_types.hpp"
#include "core/components/fill_array_kernels.hpp"
#include "core/components/prefix_sum_kernels.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/fbcsr_kernels.template.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "common/unified/base/kernel_launch.hpp"
#include "core/base/array_access.hpp"
#include "core/base/block_sizes.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/sellp_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/components/prefix_sum_kernels.hpp"
#include "cuda/base/config.hpp"
#include "cuda/base/cusparse_bindings.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/matrix/sparsity_csr_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "accessor/cuda_helper.hpp"
#include "accessor/reduced_row_major.hpp"
#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/mixed_precision_types.hpp"
#include "core/components/fill_array_kernels.hpp"
#include "core/components/format_conversion_kernels.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/preconditioner/isai_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <ginkgo/core/matrix/csr.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/components/prefix_sum_kernels.hpp"
#include "core/matrix/csr_builder.hpp"
#include "cuda/base/config.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/preconditioner/jacobi_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <ginkgo/core/base/exception_helpers.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/extended_float.hpp"
#include "core/preconditioner/jacobi_utils.hpp"
#include "core/synthesizer/implementation_selection.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/solver/batch_bicgstab_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/base/math.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "core/solver/batch_dispatch.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/solver/idr_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ginkgo/core/base/math.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/components/fill_array_kernels.hpp"
#include "cuda/base/config.hpp"
#include "cuda/base/cublas_bindings.hpp"
Expand Down
1 change: 1 addition & 0 deletions cuda/solver/multigrid_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <ginkgo/core/base/types.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/array_access.hpp"
#include "core/components/fill_array_kernels.hpp"
#include "cuda/base/types.hpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/base/batch_multi_vector_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "core/base/batch_multi_vector_kernels.hpp"


#include <hip/hip_runtime.h>
#include <thrust/functional.h>
#include <thrust/transform.h>

Expand All @@ -14,6 +13,7 @@
#include <ginkgo/core/base/range_accessors.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "hip/base/batch_struct.hip.hpp"
#include "hip/base/config.hip.hpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/base/kernel_launch.hip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#endif


#include <hip/hip_runtime.h>
#include <thrust/tuple.h>


#include "accessor/hip_helper.hpp"
#include "common/cuda_hip/base/runtime.hpp"
#include "hip/base/types.hip.hpp"
#include "hip/components/thread_ids.hip.hpp"

Expand Down
2 changes: 1 addition & 1 deletion hip/base/kernel_launch_solver.hip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#endif


#include <hip/hip_runtime.h>
#include "common/cuda_hip/base/runtime.hpp"


namespace gko {
Expand Down
4 changes: 1 addition & 3 deletions hip/components/reduction.hip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
#include <type_traits>


#include <hip/hip_runtime.h>


#include <ginkgo/core/base/array.hpp>
#include <ginkgo/core/base/executor.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/array_access.hpp"
#include "hip/base/config.hip.hpp"
#include "hip/base/types.hip.hpp"
Expand Down
4 changes: 1 addition & 3 deletions hip/factorization/factorization_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
#include "core/factorization/factorization_kernels.hpp"


#include <hip/hip_runtime.h>


#include <ginkgo/core/base/array.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/array_access.hpp"
#include "core/components/prefix_sum_kernels.hpp"
#include "core/matrix/csr_builder.hpp"
Expand Down
4 changes: 1 addition & 3 deletions hip/factorization/par_ilu_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
#include "core/factorization/par_ilu_kernels.hpp"


#include <hip/hip_runtime.h>


#include <ginkgo/core/base/std_extensions.hpp>
#include <ginkgo/core/matrix/coo.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "hip/base/math.hip.hpp"
#include "hip/base/types.hip.hpp"
#include "hip/components/memory.hip.hpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/matrix/batch_csr_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "core/matrix/batch_csr_kernels.hpp"


#include <hip/hip_runtime.h>
#include <thrust/functional.h>


Expand All @@ -14,6 +13,7 @@
#include <ginkgo/core/matrix/batch_csr.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "hip/base/batch_struct.hip.hpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/matrix/batch_dense_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "core/matrix/batch_dense_kernels.hpp"


#include <hip/hip_runtime.h>
#include <thrust/functional.h>


Expand All @@ -14,6 +13,7 @@
#include <ginkgo/core/matrix/batch_dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "hip/base/batch_struct.hip.hpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/matrix/batch_ell_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "core/matrix/batch_ell_kernels.hpp"


#include <hip/hip_runtime.h>
#include <thrust/functional.h>


Expand All @@ -14,6 +13,7 @@
#include <ginkgo/core/matrix/batch_ell.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/batch_struct.hpp"
#include "core/matrix/batch_struct.hpp"
#include "hip/base/batch_struct.hip.hpp"
Expand Down
4 changes: 1 addition & 3 deletions hip/matrix/coo_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
#include "core/matrix/coo_kernels.hpp"


#include <hip/hip_runtime.h>


#include <ginkgo/core/base/exception_helpers.hpp>
#include <ginkgo/core/base/math.hpp>
#include <ginkgo/core/base/types.hpp>
#include <ginkgo/core/matrix/csr.hpp>
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/matrix/dense_kernels.hpp"
#include "hip/base/config.hip.hpp"
#include "hip/base/hipsparse_bindings.hip.hpp"
Expand Down
4 changes: 1 addition & 3 deletions hip/matrix/dense_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#include "core/matrix/dense_kernels.hpp"


#include <hip/hip_runtime.h>


#include <ginkgo/core/base/math.hpp>
#include <ginkgo/core/base/range_accessors.hpp>
#include <ginkgo/core/matrix/coo.hpp>
Expand All @@ -20,6 +17,7 @@
#include <ginkgo/core/matrix/sparsity_csr.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/utils.hpp"
#include "core/components/prefix_sum_kernels.hpp"
#include "hip/base/config.hip.hpp"
Expand Down
4 changes: 1 addition & 3 deletions hip/matrix/diagonal_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
#include "core/matrix/diagonal_kernels.hpp"


#include <hip/hip_runtime.h>


#include <ginkgo/core/matrix/csr.hpp>
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "hip/base/config.hip.hpp"
#include "hip/base/types.hip.hpp"
#include "hip/components/cooperative_groups.hip.hpp"
Expand Down
4 changes: 1 addition & 3 deletions hip/matrix/ell_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#include <array>


#include <hip/hip_runtime.h>


#include <ginkgo/core/base/exception_helpers.hpp>
#include <ginkgo/core/base/math.hpp>
#include <ginkgo/core/base/types.hpp>
Expand All @@ -20,6 +17,7 @@

#include "accessor/hip_helper.hpp"
#include "accessor/reduced_row_major.hpp"
#include "common/cuda_hip/base/runtime.hpp"
#include "core/base/mixed_precision_types.hpp"
#include "core/components/fill_array_kernels.hpp"
#include "core/components/prefix_sum_kernels.hpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/matrix/fbcsr_kernels.template.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <algorithm>


#include <hip/hip_runtime.h>
#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/device_ptr.h>
Expand All @@ -25,6 +24,7 @@
#include <ginkgo/core/matrix/dense.hpp>


#include "common/cuda_hip/base/runtime.hpp"
#include "common/unified/base/kernel_launch.hpp"
#include "core/base/array_access.hpp"
#include "core/base/block_sizes.hpp"
Expand Down
Loading

0 comments on commit 2a767da

Please sign in to comment.