-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
122 additions
and
0 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,10 @@ | ||
#include <iostream> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
std::cout<<"TO DO"<<std::endl; | ||
|
||
|
||
return 0; | ||
} |
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,11 @@ | ||
############################################################################### | ||
# Copyright (c) 2016-23, Lawrence Livermore National Security, LLC | ||
# and RAJA project contributors. See the RAJA/LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: (BSD-3-Clause) | ||
############################################################################### | ||
|
||
blt_add_executable( | ||
NAME 00-Kernel-Fusion | ||
SOURCES 00-Kernel-Fusion.cpp | ||
DEPENDS_ON cuda umpire RAJA) |
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,79 @@ | ||
#include <iostream> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
|
||
auto& rm = umpire::ResourceManager::getInstance(); | ||
unsigned char *cnt{nullptr}; | ||
auto allocator = rm.getAllocator("UM"); | ||
auto pool = rm.makeAllocator<umpire::strategy::QuickPool>("qpool", allocator); | ||
cnt = static_cast<unsigned char*>(pool.allocate(width * width * sizeof(unsigned char))); | ||
|
||
using device_launch = RAJA::cuda_launch_t<false>; | ||
using launch_policy = RAJA::LaunchPolicy<device_launch>; | ||
|
||
//Example 1. Global Indexing: | ||
//GPU programming models such as CUDA and HIP follow a thread/block(team) programming model | ||
//in which a predefined compute grid | ||
{ | ||
const int N_x = 10000; | ||
const int N_y = 20000; | ||
const int block_sz = 256; | ||
const int n_blocks_x = (N_x + block_sz) / block_sz + 1; | ||
const int n_blocks_y = (N_y + block_sz) / block_sz + 1; | ||
|
||
using loop_pol_x = RAJA::LoopPolicy<RAJA::cuda_global_x>; | ||
|
||
RAJA::launch<device_launch> | ||
(RAJA::LaunchParams(RAJA::Teams(n_blocks_x, n_blocks_y), RAJA::Threads(block_sz)), | ||
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx) { | ||
|
||
RAJA::loop<loop_pol_y>(ctx, RAJA::RangeSegment(0, N_y), [&] (int gy) { | ||
RAJA::loop<loop_pol_x>(ctx, RAJA::RangeSegment(0, N_x), [&] (int gx) { | ||
|
||
//populate | ||
|
||
|
||
}); | ||
}); | ||
|
||
|
||
}); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//Iteration Space: | ||
{ | ||
const int n_blocks = 50000; | ||
const int block_sz = 64; | ||
|
||
RAJA::launch<launch_policy> | ||
( RAJA::LaunchParams(RAJA::Teams(n_blocks), | ||
RAJA::Threads(block_sz)), | ||
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx) { | ||
|
||
|
||
RAJA::loop<col_loop>(ctx, RAJA::RangeSegment(0, width), [&] (int col) { | ||
|
||
}); | ||
|
||
}); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
return 0; | ||
} |
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,11 @@ | ||
############################################################################### | ||
# Copyright (c) 2016-23, Lawrence Livermore National Security, LLC | ||
# and RAJA project contributors. See the RAJA/LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: (BSD-3-Clause) | ||
############################################################################### | ||
|
||
blt_add_executable( | ||
NAME 01-GPU-Threads | ||
SOURCES 01-GPU-Threads.cpp | ||
DEPENDS_ON cuda umpire RAJA) |
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,10 @@ | ||
############################################################################### | ||
# Copyright (c) 2016-23, Lawrence Livermore National Security, LLC | ||
# and RAJA project contributors. See the RAJA/LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: (BSD-3-Clause) | ||
############################################################################### | ||
|
||
add_subdirectory(00-Kernel-Fusion) | ||
|
||
add_subdirectory(01-GPU-Threads) |
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