Skip to content

Commit 898d94d

Browse files
authored
Merge pull request #63 from LLNL/kab163/tutorial-06-edits
updates to lesson 6 + readme build line
2 parents 82c1d11 + 239849e commit 898d94d

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

Intro_Tutorial/lessons/06_raja_umpire_host_device/06_raja_umpire_host_device.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ int main()
2929
a_h = static_cast<double*>(host_allocator.allocate(N*sizeof(double)));
3030
b_h = static_cast<double*>(host_allocator.allocate(N*sizeof(double)));
3131

32-
//TODO: fill in the forall statement with the CUDA execution policy.
33-
//TODO: and its block size argument. Then be sure to use RAJA_DEVICE
34-
RAJA::forall< ????? < ?????> >(
35-
RAJA::TypedRangeSegment<int>(0, N), [=] ????? (int i) {
36-
a[i] = 1.0;
37-
b[i] = 1.0;
32+
//TODO: fill in the forall statement with the sequential execution policy.
33+
RAJA::forall< ????? >(
34+
RAJA::TypedRangeSegment<int>(0, N), [=] (int i) {
35+
a_h[i] = 1.0;
36+
b_h[i] = 1.0;
3837
}
3938
);
4039

Intro_Tutorial/lessons/06_raja_umpire_host_device/06_raja_umpire_host_device_solution.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ int main()
2828
a_h = static_cast<double*>(host_allocator.allocate(N*sizeof(double)));
2929
b_h = static_cast<double*>(host_allocator.allocate(N*sizeof(double)));
3030

31-
//TODO: fill in the forall statement with the CUDA execution policy.
32-
//TODO: and its block size argument. Then be sure to use RAJA_DEVICE
33-
RAJA::forall< RAJA::cuda_exec<CUDA_BLOCK_SIZE>>(
34-
RAJA::TypedRangeSegment<int>(0, N), [=] RAJA_DEVICE (int i) {
31+
//TODO: fill in the forall statement with the sequential execution policy.
32+
RAJA::forall<RAJA::seq_exec>(
33+
RAJA::TypedRangeSegment<int>(0, N), [=] (int i) {
3534
a_h[i] = 1.0;
3635
b_h[i] = 1.0;
3736
}

Intro_Tutorial/lessons/06_raja_umpire_host_device/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ memory resources at the bottom of this README!
3737
Now, let's learn how to use Umpire's operations to copy data
3838
between CPU and GPU memory in a portable way, using Umpire's memory resources.
3939

40-
In `07_raja_umpire_host_device.cpp`, we create an allocator for the GPU with:
40+
In `06_raja_umpire_host_device.cpp`, we create an allocator for the GPU with:
4141
```
4242
auto allocator = rm.getAllocator("DEVICE");
4343
```
@@ -66,7 +66,7 @@ void umpire::ResourceManager::copy (void* dst_ptr, void * src_ptr, std::size_t s
6666

6767
*Note:* The destination is the first argument.
6868

69-
In the file `07_raja_umpire_host_device.cpp`, there is a `TODO` comment where you should insert two copy
69+
In the file `06_raja_umpire_host_device.cpp`, there is a `TODO` comment where you should insert two copy
7070
calls to copy data from the CPU memory to the DEVICE memory.
7171

7272
You will also find that we are adjusting the `RAJA::forall` to now work on the GPU.
@@ -88,8 +88,8 @@ be sure to check out the links at the bottom of this README.
8888
When you are done editing the file, compile and run it:
8989

9090
```
91-
$ make 07_raja_umpire_host_device
92-
$ ./bin/07_raja_umpire_host_device
91+
$ make 06_raja_umpire_host_device
92+
$ ./bin/06_raja_umpire_host_device
9393
```
9494
Want to learn more about Umpire memory resources? Check out the list below! You can also learn
9595
more by going to our online documentation on

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cmake -DCMAKE_CXX_COMPILER=g++ -DBLT_CXX_STD=c++17 -DENABLE_CUDA=Off -DENABLE_OP
5454
module load cmake/3.23.1
5555
module load gcc/8.3.1
5656
module load cuda/11.2.0
57-
cmake -DBLT_CXX_STD=c++14 -DENABLE_CUDA=On -DENABLE_OPENMP=On -DCMAKE_CUDA_ARCHITECTURES=70 -DCMAKE_CUDA_COMPILER=/usr/tce/packages/cuda/cuda-11.2.0/bin/nvcc -DCUDA_TOOLKIT_ROOT_DIR=/usr/tce/packages/cuda/cuda-11.2.0 -DCMAKE_CUDA_FLAGS=--extended-lambda -DRAJA_ENABLE_EXERCISES=Off -DCMAKE_BUILD_TYPE=Release ..
57+
cmake -DBLT_CXX_STD=c++17 -DENABLE_CUDA=On -DENABLE_OPENMP=On -DCMAKE_CUDA_ARCHITECTURES=70 -DCMAKE_CUDA_COMPILER=/usr/tce/packages/cuda/cuda-11.2.0/bin/nvcc -DCUDA_TOOLKIT_ROOT_DIR=/usr/tce/packages/cuda/cuda-11.2.0 -DCMAKE_CUDA_FLAGS=--extended-lambda -DRAJA_ENABLE_EXERCISES=Off -DCMAKE_BUILD_TYPE=Release ..
5858
```
5959

6060
License

0 commit comments

Comments
 (0)