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

Protect GPU kernels with appropriate nemespaces. #107

Merged
merged 30 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
37a598c
Protect GPU kernels with appropriate nemespaces.
pelesh Dec 9, 2023
2e4dcef
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
ab7db37
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
8d981b9
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
a1c9377
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
5957a3d
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
9314c1d
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
950926f
[skip ci] Update resolve/hip/hipKernels.hip
pelesh Dec 11, 2023
9720d3a
[skip ci] Update resolve/hip/hipKernels.hip
pelesh Dec 11, 2023
0c3148c
[skip ci] Update resolve/hip/hipKernels.hip
pelesh Dec 11, 2023
883173d
[skip ci] Update resolve/hip/hipKernels.hip
pelesh Dec 11, 2023
28383cb
[skip ci] Update resolve/hip/hipKernels.hip
pelesh Dec 11, 2023
c9447dd
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
5c01fd0
[skip ci] Update resolve/hip/hipKernels.hip
pelesh Dec 11, 2023
c10b484
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
43fb60c
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
b502b43
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
e5a40d6
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
a3f3c67
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
3dc3a02
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
538fc74
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
906fed6
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
325f5d2
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
9666e5a
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
e99e10c
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
f2930ed
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
2ddb83c
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
7895449
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
996e7d8
[skip ci] Update resolve/cuda/cudaKernels.cu
pelesh Dec 11, 2023
b787246
Minor formatting adjustments.
pelesh Dec 11, 2023
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
3 changes: 1 addition & 2 deletions resolve/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@

set(ReSolve_CUDA_SRC
cudaKernels.cu
cudaVectorKernels.cu
VectorKernels.cu
MemoryUtils.cu
)

set(ReSolve_CUDA_HEADER_INSTALL
cudaKernels.h
cudaVectorKernels.h
CudaMemory.hpp
cuda_check_errors.hpp
)
Expand Down
47 changes: 47 additions & 0 deletions resolve/cuda/VectorKernels.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @file cudaVectorKernels.cu
* @author Slaven Peles ([email protected])
* @brief Contains implementation of CUDA vector kernels and their wrappers.
* @date 2023-12-08
*
* @note Kernel wrappers implemented here are intended for use in hardware
* agnostic code.
*/

#include <resolve/vector/VectorKernels.hpp>


namespace ReSolve { namespace vector {

namespace kernels {

/**
* @brief CUDA kernel that sets values of an array to a constant.
*
* @param[in] n - length of the array
* @param[in] val - the value the array is set to
* @param[out] arr - a pointer to the array
*
* @pre `arr` is allocated to size `n`
* @post `arr` elements are set to `val`
*/
__global__ void set_const(index_type n, real_type val, real_type* arr)
{
index_type i = blockIdx.x * blockDim.x + threadIdx.x;
if(i < n)
{
arr[i] = val;
}
}

} // namespace kernels

void set_array_const(index_type n, real_type val, real_type* arr)
{
index_type num_blocks;
index_type block_size = 512;
num_blocks = (n + block_size - 1) / block_size;
kernels::set_const<<<num_blocks, block_size>>>(n, val, arr);
}

}} // namespace ReSolve::vector
Loading