From 3625b72ea88c3ce16ec85b5a7c2df84e1d752c44 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 10:23:44 -0700 Subject: [PATCH 01/20] first clean up pass --- .../lessons/01_blt_cmake/{one.cpp => 01_blt_cmake} | 0 Intro_Tutorial/lessons/01_blt_cmake/CMakeLists.txt | 4 ++-- .../02_raja_umpire/{two.cpp => 02_raja_umpire} | 0 .../{three.cpp => 03_umpire_allocator} | 0 ..._solution.cpp => 03_umpire_allocator_solution.cpp} | 0 .../04_raja_forall/{four.cpp => 04_raja_forall.cpp} | 0 Intro_Tutorial/lessons/04_raja_forall/CMakeLists.txt | 4 ++-- ...{four_solution.cpp => 04_raja_forall_solution.cpp} | 0 .../05_raja_reduce/{five.cpp => 05_raja_reduce.cpp} | 0 Intro_Tutorial/lessons/05_raja_reduce/CMakeLists.txt | 4 ++-- ...{five_solution.cpp => 05_raja_reduce_solution.cpp} | 0 .../{six.cpp => 06_raja_umpire_uvm.cpp} | 0 .../lessons/06_raja_umpire_uvm/CMakeLists.txt | 4 ++-- ...x_solution.cpp => 06_raja_umpire_uvm_solution.cpp} | 0 .../lessons/08_raja_umpire_quick_pool/eight.cpp | 11 +++-------- 15 files changed, 11 insertions(+), 16 deletions(-) rename Intro_Tutorial/lessons/01_blt_cmake/{one.cpp => 01_blt_cmake} (100%) rename Intro_Tutorial/lessons/02_raja_umpire/{two.cpp => 02_raja_umpire} (100%) rename Intro_Tutorial/lessons/03_umpire_allocator/{three.cpp => 03_umpire_allocator} (100%) rename Intro_Tutorial/lessons/03_umpire_allocator/solution/{three_solution.cpp => 03_umpire_allocator_solution.cpp} (100%) rename Intro_Tutorial/lessons/04_raja_forall/{four.cpp => 04_raja_forall.cpp} (100%) rename Intro_Tutorial/lessons/04_raja_forall/solution/{four_solution.cpp => 04_raja_forall_solution.cpp} (100%) rename Intro_Tutorial/lessons/05_raja_reduce/{five.cpp => 05_raja_reduce.cpp} (100%) rename Intro_Tutorial/lessons/05_raja_reduce/solution/{five_solution.cpp => 05_raja_reduce_solution.cpp} (100%) rename Intro_Tutorial/lessons/06_raja_umpire_uvm/{six.cpp => 06_raja_umpire_uvm.cpp} (100%) rename Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/{six_solution.cpp => 06_raja_umpire_uvm_solution.cpp} (100%) diff --git a/Intro_Tutorial/lessons/01_blt_cmake/one.cpp b/Intro_Tutorial/lessons/01_blt_cmake/01_blt_cmake similarity index 100% rename from Intro_Tutorial/lessons/01_blt_cmake/one.cpp rename to Intro_Tutorial/lessons/01_blt_cmake/01_blt_cmake diff --git a/Intro_Tutorial/lessons/01_blt_cmake/CMakeLists.txt b/Intro_Tutorial/lessons/01_blt_cmake/CMakeLists.txt index 7a2b8eb..d69fb9a 100644 --- a/Intro_Tutorial/lessons/01_blt_cmake/CMakeLists.txt +++ b/Intro_Tutorial/lessons/01_blt_cmake/CMakeLists.txt @@ -1,3 +1,3 @@ blt_add_executable( - NAME one - SOURCES one.cpp) \ No newline at end of file + NAME 01_blt_cmake + SOURCES 01_blt_cmake.cpp) \ No newline at end of file diff --git a/Intro_Tutorial/lessons/02_raja_umpire/two.cpp b/Intro_Tutorial/lessons/02_raja_umpire/02_raja_umpire similarity index 100% rename from Intro_Tutorial/lessons/02_raja_umpire/two.cpp rename to Intro_Tutorial/lessons/02_raja_umpire/02_raja_umpire diff --git a/Intro_Tutorial/lessons/03_umpire_allocator/three.cpp b/Intro_Tutorial/lessons/03_umpire_allocator/03_umpire_allocator similarity index 100% rename from Intro_Tutorial/lessons/03_umpire_allocator/three.cpp rename to Intro_Tutorial/lessons/03_umpire_allocator/03_umpire_allocator diff --git a/Intro_Tutorial/lessons/03_umpire_allocator/solution/three_solution.cpp b/Intro_Tutorial/lessons/03_umpire_allocator/solution/03_umpire_allocator_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/03_umpire_allocator/solution/three_solution.cpp rename to Intro_Tutorial/lessons/03_umpire_allocator/solution/03_umpire_allocator_solution.cpp diff --git a/Intro_Tutorial/lessons/04_raja_forall/four.cpp b/Intro_Tutorial/lessons/04_raja_forall/04_raja_forall.cpp similarity index 100% rename from Intro_Tutorial/lessons/04_raja_forall/four.cpp rename to Intro_Tutorial/lessons/04_raja_forall/04_raja_forall.cpp diff --git a/Intro_Tutorial/lessons/04_raja_forall/CMakeLists.txt b/Intro_Tutorial/lessons/04_raja_forall/CMakeLists.txt index 8516df7..c5fbe91 100644 --- a/Intro_Tutorial/lessons/04_raja_forall/CMakeLists.txt +++ b/Intro_Tutorial/lessons/04_raja_forall/CMakeLists.txt @@ -1,4 +1,4 @@ blt_add_executable( - NAME four - SOURCES four.cpp + NAME 04_raja_forall + SOURCES 04_raja_forall.cpp DEPENDS_ON RAJA umpire cuda) diff --git a/Intro_Tutorial/lessons/04_raja_forall/solution/four_solution.cpp b/Intro_Tutorial/lessons/04_raja_forall/solution/04_raja_forall_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/04_raja_forall/solution/four_solution.cpp rename to Intro_Tutorial/lessons/04_raja_forall/solution/04_raja_forall_solution.cpp diff --git a/Intro_Tutorial/lessons/05_raja_reduce/five.cpp b/Intro_Tutorial/lessons/05_raja_reduce/05_raja_reduce.cpp similarity index 100% rename from Intro_Tutorial/lessons/05_raja_reduce/five.cpp rename to Intro_Tutorial/lessons/05_raja_reduce/05_raja_reduce.cpp diff --git a/Intro_Tutorial/lessons/05_raja_reduce/CMakeLists.txt b/Intro_Tutorial/lessons/05_raja_reduce/CMakeLists.txt index e6425ba..a6e6260 100644 --- a/Intro_Tutorial/lessons/05_raja_reduce/CMakeLists.txt +++ b/Intro_Tutorial/lessons/05_raja_reduce/CMakeLists.txt @@ -1,4 +1,4 @@ blt_add_executable( - NAME five - SOURCES five.cpp + NAME 05_raja_reduce + SOURCES 05_raja_reduce.cpp DEPENDS_ON RAJA umpire) diff --git a/Intro_Tutorial/lessons/05_raja_reduce/solution/five_solution.cpp b/Intro_Tutorial/lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/05_raja_reduce/solution/five_solution.cpp rename to Intro_Tutorial/lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp diff --git a/Intro_Tutorial/lessons/06_raja_umpire_uvm/six.cpp b/Intro_Tutorial/lessons/06_raja_umpire_uvm/06_raja_umpire_uvm.cpp similarity index 100% rename from Intro_Tutorial/lessons/06_raja_umpire_uvm/six.cpp rename to Intro_Tutorial/lessons/06_raja_umpire_uvm/06_raja_umpire_uvm.cpp diff --git a/Intro_Tutorial/lessons/06_raja_umpire_uvm/CMakeLists.txt b/Intro_Tutorial/lessons/06_raja_umpire_uvm/CMakeLists.txt index 3d5a782..a59a4a0 100644 --- a/Intro_Tutorial/lessons/06_raja_umpire_uvm/CMakeLists.txt +++ b/Intro_Tutorial/lessons/06_raja_umpire_uvm/CMakeLists.txt @@ -1,7 +1,7 @@ if (ENABLE_CUDA) blt_add_executable( - NAME six - SOURCES six.cpp + NAME 06_raja_umpire_uvm + SOURCES 06_raja_umpire_uvm.cpp DEPENDS_ON RAJA umpire cuda) endif() diff --git a/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/six_solution.cpp b/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/six_solution.cpp rename to Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp index 8e05c41..1f11a32 100644 --- a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp +++ b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp @@ -2,15 +2,11 @@ #include "RAJA/RAJA.hpp" #include "umpire/Umpire.hpp" - -//Uncomment to compile -//#define COMPILE +#include "umpire/strategy/QuickPool.hpp" int main() { -#if defined(COMPILE) - - constexpr int N{1000}; + constexpr int N{10000}; constexpr std::size_t CUDA_BLOCK_SIZE{256}; double* a{nullptr}; double* b{nullptr}; @@ -23,6 +19,7 @@ int main() auto host_allocator = rm.getAllocator("HOST"); // TODO: create an allocator called "pool" using the QuickPool strategy + auto pool = rm.makeAllocator("POOL", allocator); a = static_cast(pool.allocate(N*sizeof(double))); b = static_cast(pool.allocate(N*sizeof(double))); @@ -55,7 +52,5 @@ int main() host_allocator.deallocate(a_h); host_allocator.deallocate(b_h); -#endif - return 0; } From 89e878679dfba6c6e16672d98a95d0b536db8568 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 11:59:14 -0700 Subject: [PATCH 02/20] fix source file --- .../lessons/01_blt_cmake/{01_blt_cmake => 01_blt_cmake.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Intro_Tutorial/lessons/01_blt_cmake/{01_blt_cmake => 01_blt_cmake.cpp} (100%) diff --git a/Intro_Tutorial/lessons/01_blt_cmake/01_blt_cmake b/Intro_Tutorial/lessons/01_blt_cmake/01_blt_cmake.cpp similarity index 100% rename from Intro_Tutorial/lessons/01_blt_cmake/01_blt_cmake rename to Intro_Tutorial/lessons/01_blt_cmake/01_blt_cmake.cpp From d069d27a476d6c205b133feb3ca37cbb69b624d5 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 12:06:36 -0700 Subject: [PATCH 03/20] clean up pass --- Intro_Tutorial/lessons/01_blt_cmake/README.md | 8 ++++---- .../02_raja_umpire/{02_raja_umpire => 02_raja_umpire.cpp} | 0 Intro_Tutorial/lessons/02_raja_umpire/CMakeLists.txt | 4 ++-- Intro_Tutorial/lessons/02_raja_umpire/README.md | 8 ++++---- .../{03_umpire_allocator => 03_umpire_allocator.cpp} | 0 Intro_Tutorial/lessons/03_umpire_allocator/CMakeLists.txt | 4 ++-- Intro_Tutorial/lessons/03_umpire_allocator/README.md | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) rename Intro_Tutorial/lessons/02_raja_umpire/{02_raja_umpire => 02_raja_umpire.cpp} (100%) rename Intro_Tutorial/lessons/03_umpire_allocator/{03_umpire_allocator => 03_umpire_allocator.cpp} (100%) diff --git a/Intro_Tutorial/lessons/01_blt_cmake/README.md b/Intro_Tutorial/lessons/01_blt_cmake/README.md index 85541ca..2652b8e 100644 --- a/Intro_Tutorial/lessons/01_blt_cmake/README.md +++ b/Intro_Tutorial/lessons/01_blt_cmake/README.md @@ -27,8 +27,8 @@ all the source code files that make up your application: ``` blt_add_executable( - NAME one - SOURCES one.cpp) + NAME 01_blt_cmake + SOURCES 01_blt_cmake.cpp) ``` For now, we have filled these out for you, but in later lessons you will need to @@ -53,14 +53,14 @@ practice when using CMake. Once you are in the build directory, you can use the `make` command to compile the executable: ``` -$ make one +$ make 01_blt_cmake ``` You will see some output as the code is compiled. You can then run the executable: ``` -$ ./bin/one +$ ./bin/01_blt_cmake Hello, world! ``` diff --git a/Intro_Tutorial/lessons/02_raja_umpire/02_raja_umpire b/Intro_Tutorial/lessons/02_raja_umpire/02_raja_umpire.cpp similarity index 100% rename from Intro_Tutorial/lessons/02_raja_umpire/02_raja_umpire rename to Intro_Tutorial/lessons/02_raja_umpire/02_raja_umpire.cpp diff --git a/Intro_Tutorial/lessons/02_raja_umpire/CMakeLists.txt b/Intro_Tutorial/lessons/02_raja_umpire/CMakeLists.txt index 27b36a9..9f2ae8c 100644 --- a/Intro_Tutorial/lessons/02_raja_umpire/CMakeLists.txt +++ b/Intro_Tutorial/lessons/02_raja_umpire/CMakeLists.txt @@ -1,5 +1,5 @@ # TODO: Add the RAJA, umpire and cuda targets as DEPENDS_ON arguments blt_add_executable( - NAME two - SOURCES two.cpp + NAME 02_raja_umpire + SOURCES 02_raja_umpire.cpp DEPENDS_ON ) diff --git a/Intro_Tutorial/lessons/02_raja_umpire/README.md b/Intro_Tutorial/lessons/02_raja_umpire/README.md index 75420af..df17592 100644 --- a/Intro_Tutorial/lessons/02_raja_umpire/README.md +++ b/Intro_Tutorial/lessons/02_raja_umpire/README.md @@ -16,8 +16,8 @@ use to list dependencies. ``` blt_add_executable( - NAME one - SOURCES one.cpp + NAME 01_blt_cmake + SOURCES 01_blt_cmake.cpp DEPENDS_ON ) ``` @@ -33,8 +33,8 @@ $ cd build You can then compile and run the lesson: ``` -$ make two -$ ./bin/two +$ make 02_raja_umpire +$ ./bin/02_raja_umpire Hello, world (with RAJA and Umpire)! ``` diff --git a/Intro_Tutorial/lessons/03_umpire_allocator/03_umpire_allocator b/Intro_Tutorial/lessons/03_umpire_allocator/03_umpire_allocator.cpp similarity index 100% rename from Intro_Tutorial/lessons/03_umpire_allocator/03_umpire_allocator rename to Intro_Tutorial/lessons/03_umpire_allocator/03_umpire_allocator.cpp diff --git a/Intro_Tutorial/lessons/03_umpire_allocator/CMakeLists.txt b/Intro_Tutorial/lessons/03_umpire_allocator/CMakeLists.txt index 17f31c0..f4b317a 100644 --- a/Intro_Tutorial/lessons/03_umpire_allocator/CMakeLists.txt +++ b/Intro_Tutorial/lessons/03_umpire_allocator/CMakeLists.txt @@ -1,4 +1,4 @@ blt_add_executable( - NAME three - SOURCES three.cpp + NAME 03_umpire_allocator + SOURCES 03_umpire_allocator.cpp DEPENDS_ON RAJA umpire cuda) diff --git a/Intro_Tutorial/lessons/03_umpire_allocator/README.md b/Intro_Tutorial/lessons/03_umpire_allocator/README.md index 86c9961..f51616a 100644 --- a/Intro_Tutorial/lessons/03_umpire_allocator/README.md +++ b/Intro_Tutorial/lessons/03_umpire_allocator/README.md @@ -1,7 +1,7 @@ # Lesson 3 In this lesson, you will learn how to use Umpire to allocate memory. The file -`three.cpp` contains some `TODO:` comments where you can add code to allocate and +`03_umpire_allocator.cpp` contains some `TODO:` comments where you can add code to allocate and deallocate memory. The fundamental concept for accessing memory through Umpire is the @@ -38,7 +38,7 @@ https://umpire.readthedocs.io/en/develop/sphinx/tutorial/allocators.html Once you have made your changes, you can compile and run the lesson: ``` -$ make three -$ ./bin/three +$ make 03_umpire_allocator +$ ./bin/03_umpire_allocator Address of data: 0x????? ``` From 793a90908c34c42d53b3268bf3fafd400ba0c7c5 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 12:08:41 -0700 Subject: [PATCH 04/20] clean up 4 --- Intro_Tutorial/lessons/04_raja_forall/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Intro_Tutorial/lessons/04_raja_forall/README.md b/Intro_Tutorial/lessons/04_raja_forall/README.md index b8ecf9b..a2ea00d 100644 --- a/Intro_Tutorial/lessons/04_raja_forall/README.md +++ b/Intro_Tutorial/lessons/04_raja_forall/README.md @@ -32,17 +32,16 @@ this example, we will use the `RAJA::seq_exec` policy to execute this loop on the CPU. In later lessons, we will learn about other policies that allow us to run code on a GPU. -In the file four.cpp, you will see a `TODO` comment where you can add a -`RAJA::forall` loop to initialize the array you allocated in the previous +In the file 04_raja_forall.cpp, you will see a `TODO` comment where you can add a +`RAJA::forall` loop to initialize the array you allocated in the previous lesson. When you have made your changes, compile and run the code in the same way as the other lessons: ``` -$ make four -$ ./bin/four -Address of data: +$ make 04_raja_forall +$ ./bin/04_raja_forall +Address of data: data[50] = 50 ``` - From d82599945f13eb2f625041768418024596467109 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 12:09:51 -0700 Subject: [PATCH 05/20] clean up pass --- Intro_Tutorial/lessons/05_raja_reduce/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Intro_Tutorial/lessons/05_raja_reduce/README.md b/Intro_Tutorial/lessons/05_raja_reduce/README.md index 0fbdd31..03f247f 100644 --- a/Intro_Tutorial/lessons/05_raja_reduce/README.md +++ b/Intro_Tutorial/lessons/05_raja_reduce/README.md @@ -29,13 +29,13 @@ https://raja.readthedocs.io/en/develop/sphinx/user_guide/feature/policies.html#r The second parameter, the `TYPE` parameter, is just the data type of the variable, such as `int`. -In the file `five.cpp`, follow the instruction in the `TODO` comment to create +In the file `05_raja_reduce.cpp`, follow the instruction in the `TODO` comment to create a RAJA Reduction using `seq_exec`. Once you have filled in the correct reduction statement, compile and run: ``` -$ make five -$ ./bin/five +$ make 05_raja_reduce +$ ./bin/05_raja_reduce ``` From fa5f1dbe4561e52c5c9863ea278e5931901561b2 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 12:10:40 -0700 Subject: [PATCH 06/20] clean up pass --- Intro_Tutorial/lessons/06_raja_umpire_uvm/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Intro_Tutorial/lessons/06_raja_umpire_uvm/README.md b/Intro_Tutorial/lessons/06_raja_umpire_uvm/README.md index 53cbc9e..9ecd784 100644 --- a/Intro_Tutorial/lessons/06_raja_umpire_uvm/README.md +++ b/Intro_Tutorial/lessons/06_raja_umpire_uvm/README.md @@ -36,13 +36,13 @@ as a template parameter. Finally, as we are filling in the lambda portion of the `RAJA::forall`, we need to specify where it will reside in GPU memory. This can be done directly or by using the `RAJA_DEVICE` macro. -There are several `TODO` comments in the `six.cpp` exercise file where you +There are several `TODO` comments in the `06_raja_umpire_uvm.cpp` exercise file where you can modify the code to work on a GPU. When you are done, build and run the example: ``` -$ make six -$ ./bin/six +$ make 06_raja_umpire_uvm +$ ./bin/06_raja_umpire_uvm ``` For more information on Umpire's resources, see our documentation: From 3508dfc3771175be1b4f3fe8d6474fadaf7ecf6d Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 12:14:08 -0700 Subject: [PATCH 07/20] clean up 7 --- .../{seven.cpp => 07_raja_umpire_host_device.cpp} | 0 .../lessons/07_raja_umpire_host_device/CMakeLists.txt | 4 ++-- .../lessons/07_raja_umpire_host_device/README.md | 8 ++++---- ...lution.cpp => 07_raja_umpire_host_device_solution.cpp} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename Intro_Tutorial/lessons/07_raja_umpire_host_device/{seven.cpp => 07_raja_umpire_host_device.cpp} (100%) rename Intro_Tutorial/lessons/07_raja_umpire_host_device/solution/{seven_solution.cpp => 07_raja_umpire_host_device_solution.cpp} (100%) diff --git a/Intro_Tutorial/lessons/07_raja_umpire_host_device/seven.cpp b/Intro_Tutorial/lessons/07_raja_umpire_host_device/07_raja_umpire_host_device.cpp similarity index 100% rename from Intro_Tutorial/lessons/07_raja_umpire_host_device/seven.cpp rename to Intro_Tutorial/lessons/07_raja_umpire_host_device/07_raja_umpire_host_device.cpp diff --git a/Intro_Tutorial/lessons/07_raja_umpire_host_device/CMakeLists.txt b/Intro_Tutorial/lessons/07_raja_umpire_host_device/CMakeLists.txt index dcd859c..04021f0 100644 --- a/Intro_Tutorial/lessons/07_raja_umpire_host_device/CMakeLists.txt +++ b/Intro_Tutorial/lessons/07_raja_umpire_host_device/CMakeLists.txt @@ -1,6 +1,6 @@ if (ENABLE_CUDA) blt_add_executable( - NAME seven - SOURCES seven.cpp + NAME 07_raja_umpire_host_device + SOURCES 07_raja_umpire_host_device.cpp DEPENDS_ON RAJA umpire cuda) endif() diff --git a/Intro_Tutorial/lessons/07_raja_umpire_host_device/README.md b/Intro_Tutorial/lessons/07_raja_umpire_host_device/README.md index 87261e7..f773e68 100644 --- a/Intro_Tutorial/lessons/07_raja_umpire_host_device/README.md +++ b/Intro_Tutorial/lessons/07_raja_umpire_host_device/README.md @@ -3,7 +3,7 @@ In this lesson, you will learn how to use Umpire's operations to copy data between CPU and GPU memory in a portable way. -In `seven.cpp`, we create an allocator for the GPU with: +In `07_raja_umpire_host_device.cpp`, we create an allocator for the GPU with: ``` auto allocator = rm.getAllocator("DEVICE"); ``` @@ -30,12 +30,12 @@ void umpire::ResourceManager::copy (void* dst_ptr, void * src_ptr, std::size_t s *Note:* The destination is the first argument. -In the file `seven.cpp`, there is a `TODO` comment where you should insert two copy +In the file `07_raja_umpire_host_device.cpp`, there is a `TODO` comment where you should insert two copy calls to copy data from the CPU memory to the DEVICE memory. When you are done editing the file, compile and run it: ``` -$ make seven -$ ./bin/seven +$ make 07_raja_umpire_host_device +$ ./bin/07_raja_umpire_host_device ``` diff --git a/Intro_Tutorial/lessons/07_raja_umpire_host_device/solution/seven_solution.cpp b/Intro_Tutorial/lessons/07_raja_umpire_host_device/solution/07_raja_umpire_host_device_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/07_raja_umpire_host_device/solution/seven_solution.cpp rename to Intro_Tutorial/lessons/07_raja_umpire_host_device/solution/07_raja_umpire_host_device_solution.cpp From 8b31289fd80c5666593f3f9563510b97a686199f Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 12:16:28 -0700 Subject: [PATCH 08/20] clean up 8 --- .../{eight.cpp => 08_raja_umpire_quick_pool.cpp} | 0 .../lessons/08_raja_umpire_quick_pool/CMakeLists.txt | 4 ++-- Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md | 6 +++--- ..._solution.cpp => 08_raja_umpire_quick_pool_solution.cpp} | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename Intro_Tutorial/lessons/08_raja_umpire_quick_pool/{eight.cpp => 08_raja_umpire_quick_pool.cpp} (100%) rename Intro_Tutorial/lessons/08_raja_umpire_quick_pool/solution/{eight_solution.cpp => 08_raja_umpire_quick_pool_solution.cpp} (100%) diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/08_raja_umpire_quick_pool.cpp similarity index 100% rename from Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp rename to Intro_Tutorial/lessons/08_raja_umpire_quick_pool/08_raja_umpire_quick_pool.cpp diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/CMakeLists.txt b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/CMakeLists.txt index fef5044..83a0ca2 100644 --- a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/CMakeLists.txt +++ b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/CMakeLists.txt @@ -1,6 +1,6 @@ if (ENABLE_CUDA) blt_add_executable( - NAME eight - SOURCES eight.cpp + NAME 08_raja_umpire_quick_pool + SOURCES 08_raja_umpire_quick_pool.cpp DEPENDS_ON RAJA umpire cuda) endif() diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md index e0d45be..587bed7 100644 --- a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md +++ b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md @@ -21,13 +21,13 @@ To create a new memory pool allocator using the `QuickPool` strategy, we can use This newly created `pool` is an `umpire::Allocator` using the `QuickPool` strategy. As you can see above, we can use the `ResourceManager::makeAllocator` function to create the pool allocator. We just need to pass in: (1) the name we would like the pool to have, and (2) the allocator we previously created with the `ResourceManager` (see line 17 in the -file `eight.cpp`). Remember that you will also need to include the `umpire/strategy/QuickPool.hpp` header file. +file `08_raja_umpire_quick_pool.cpp`). Remember that you will also need to include the `umpire/strategy/QuickPool.hpp` header file. There are other arguments that could be passed to the pool constructor if needed. These additional option arguments are a bit advanced and are beyond the scope of this tutorial. However, you can visit the documentation page for more: https://umpire.readthedocs.io/en/develop/doxygen/html/index.html When you have created your QuickPool allocator, uncomment the COMPILE define on line 7; then compile and run the code: ``` -$ make eight -$ ./bin/eight +$ make 08_raja_umpire_quick_pool +$ ./bin/08_raja_umpire_quick_pool ``` diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/solution/eight_solution.cpp b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/solution/08_raja_umpire_quick_pool_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/08_raja_umpire_quick_pool/solution/eight_solution.cpp rename to Intro_Tutorial/lessons/08_raja_umpire_quick_pool/solution/08_raja_umpire_quick_pool_solution.cpp From 747b06629bf271c987a3412f6e002ae3008e74c8 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 13:43:32 -0700 Subject: [PATCH 09/20] clean up 09 --- .../lessons/09_raja_view/{nine.cpp => 09_raja_view.cpp} | 0 Intro_Tutorial/lessons/09_raja_view/CMakeLists.txt | 4 ++-- Intro_Tutorial/lessons/09_raja_view/README.md | 6 +++--- .../solution/{nine_solution.cpp => 09_raja_view.cpp} | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename Intro_Tutorial/lessons/09_raja_view/{nine.cpp => 09_raja_view.cpp} (100%) rename Intro_Tutorial/lessons/09_raja_view/solution/{nine_solution.cpp => 09_raja_view.cpp} (100%) diff --git a/Intro_Tutorial/lessons/09_raja_view/nine.cpp b/Intro_Tutorial/lessons/09_raja_view/09_raja_view.cpp similarity index 100% rename from Intro_Tutorial/lessons/09_raja_view/nine.cpp rename to Intro_Tutorial/lessons/09_raja_view/09_raja_view.cpp diff --git a/Intro_Tutorial/lessons/09_raja_view/CMakeLists.txt b/Intro_Tutorial/lessons/09_raja_view/CMakeLists.txt index 7d924d2..734f5dd 100644 --- a/Intro_Tutorial/lessons/09_raja_view/CMakeLists.txt +++ b/Intro_Tutorial/lessons/09_raja_view/CMakeLists.txt @@ -1,4 +1,4 @@ blt_add_executable( - NAME nine - SOURCES nine.cpp + NAME 09_raja_view + SOURCES 09_raja_view.cpp DEPENDS_ON cuda RAJA umpire) diff --git a/Intro_Tutorial/lessons/09_raja_view/README.md b/Intro_Tutorial/lessons/09_raja_view/README.md index 790256e..00a49f5 100644 --- a/Intro_Tutorial/lessons/09_raja_view/README.md +++ b/Intro_Tutorial/lessons/09_raja_view/README.md @@ -33,15 +33,15 @@ RAJA::View> view(data, N, N); where `data` is a `double*`, and `N` is the size of each dimension. The size of `data` should be at least `N*N`. -In the file `nine.cpp`, there is a `TODO` comment where you should create three +In the file `09_raja_view.cpp`, there is a `TODO` comment where you should create three views, A, B, and C. You will notice that we are doing the same dot product calculation, but this time for matrices. Thus, we are now doing a matrix multiplication. When you are ready, uncomment the COMPILE define on line 7; then you can compile and run the code: ``` -$ make nine -$ ./bin/nine +$ make 09_raja_view +$ ./bin/09_raja_view ``` For more information on Views and Layouts, see the RAJA diff --git a/Intro_Tutorial/lessons/09_raja_view/solution/nine_solution.cpp b/Intro_Tutorial/lessons/09_raja_view/solution/09_raja_view.cpp similarity index 100% rename from Intro_Tutorial/lessons/09_raja_view/solution/nine_solution.cpp rename to Intro_Tutorial/lessons/09_raja_view/solution/09_raja_view.cpp From 3d8692bb5ba4be1a3856a830f52711f77278b3ed Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 13:45:55 -0700 Subject: [PATCH 10/20] clean up 10 --- .../lessons/10_raja_kernel/{ten.cpp => 10_raja_kernel.cpp} | 0 Intro_Tutorial/lessons/10_raja_kernel/CMakeLists.txt | 4 ++-- .../solution/{ten_solution.cpp => 10_raja_kernel.cpp} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Intro_Tutorial/lessons/10_raja_kernel/{ten.cpp => 10_raja_kernel.cpp} (100%) rename Intro_Tutorial/lessons/10_raja_kernel/solution/{ten_solution.cpp => 10_raja_kernel.cpp} (100%) diff --git a/Intro_Tutorial/lessons/10_raja_kernel/ten.cpp b/Intro_Tutorial/lessons/10_raja_kernel/10_raja_kernel.cpp similarity index 100% rename from Intro_Tutorial/lessons/10_raja_kernel/ten.cpp rename to Intro_Tutorial/lessons/10_raja_kernel/10_raja_kernel.cpp diff --git a/Intro_Tutorial/lessons/10_raja_kernel/CMakeLists.txt b/Intro_Tutorial/lessons/10_raja_kernel/CMakeLists.txt index ebf7ea1..31184a7 100644 --- a/Intro_Tutorial/lessons/10_raja_kernel/CMakeLists.txt +++ b/Intro_Tutorial/lessons/10_raja_kernel/CMakeLists.txt @@ -1,4 +1,4 @@ blt_add_executable( - NAME ten - SOURCES ten.cpp + NAME 10_raja_kernel + SOURCES 10_raja_kernel.cpp DEPENDS_ON cuda RAJA umpire) diff --git a/Intro_Tutorial/lessons/10_raja_kernel/solution/ten_solution.cpp b/Intro_Tutorial/lessons/10_raja_kernel/solution/10_raja_kernel.cpp similarity index 100% rename from Intro_Tutorial/lessons/10_raja_kernel/solution/ten_solution.cpp rename to Intro_Tutorial/lessons/10_raja_kernel/solution/10_raja_kernel.cpp From 62b057d332f79e89d4f4ab7b3efa1434b2bd9a96 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 13:47:29 -0700 Subject: [PATCH 11/20] update 10 file --- Intro_Tutorial/lessons/10_raja_kernel/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Intro_Tutorial/lessons/10_raja_kernel/README.md b/Intro_Tutorial/lessons/10_raja_kernel/README.md index b91d79f..7cbc3b8 100644 --- a/Intro_Tutorial/lessons/10_raja_kernel/README.md +++ b/Intro_Tutorial/lessons/10_raja_kernel/README.md @@ -68,6 +68,6 @@ When you have finished making your changes, uncomment the COMPILE define on line then compile and run the code: ``` -$ make ten -$ ./bin/ten +$ make raja_kernel +$ ./bin/raja_kernel ``` From b4bd446e8fafc68431fa7f23ed655de807d25543 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 13:49:12 -0700 Subject: [PATCH 12/20] clean up 11 --- .../{eleven.cpp => 11_raja_device_kernel.cpp} | 0 Intro_Tutorial/lessons/11_raja_device_kernel/CMakeLists.txt | 4 ++-- ...eleven_solution.cpp => 11_raja_device_kernel_solution.cpp} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Intro_Tutorial/lessons/11_raja_device_kernel/{eleven.cpp => 11_raja_device_kernel.cpp} (100%) rename Intro_Tutorial/lessons/11_raja_device_kernel/solution/{eleven_solution.cpp => 11_raja_device_kernel_solution.cpp} (100%) diff --git a/Intro_Tutorial/lessons/11_raja_device_kernel/eleven.cpp b/Intro_Tutorial/lessons/11_raja_device_kernel/11_raja_device_kernel.cpp similarity index 100% rename from Intro_Tutorial/lessons/11_raja_device_kernel/eleven.cpp rename to Intro_Tutorial/lessons/11_raja_device_kernel/11_raja_device_kernel.cpp diff --git a/Intro_Tutorial/lessons/11_raja_device_kernel/CMakeLists.txt b/Intro_Tutorial/lessons/11_raja_device_kernel/CMakeLists.txt index ee68e49..05f7bb1 100644 --- a/Intro_Tutorial/lessons/11_raja_device_kernel/CMakeLists.txt +++ b/Intro_Tutorial/lessons/11_raja_device_kernel/CMakeLists.txt @@ -1,6 +1,6 @@ if (ENABLE_CUDA) blt_add_executable( - NAME eleven - SOURCES eleven.cpp + NAME 11_raja_device_kernel + SOURCES 11_raja_device_kernel.cpp DEPENDS_ON RAJA umpire cuda) endif() diff --git a/Intro_Tutorial/lessons/11_raja_device_kernel/solution/eleven_solution.cpp b/Intro_Tutorial/lessons/11_raja_device_kernel/solution/11_raja_device_kernel_solution.cpp similarity index 100% rename from Intro_Tutorial/lessons/11_raja_device_kernel/solution/eleven_solution.cpp rename to Intro_Tutorial/lessons/11_raja_device_kernel/solution/11_raja_device_kernel_solution.cpp From 74c3f2116c4a105a0d33377b30b0a260b4349d39 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 13:50:28 -0700 Subject: [PATCH 13/20] clean up pass --- Intro_Tutorial/lessons/11_raja_device_kernel/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Intro_Tutorial/lessons/11_raja_device_kernel/README.md b/Intro_Tutorial/lessons/11_raja_device_kernel/README.md index 7ed3ead..bc96e3b 100644 --- a/Intro_Tutorial/lessons/11_raja_device_kernel/README.md +++ b/Intro_Tutorial/lessons/11_raja_device_kernel/README.md @@ -17,8 +17,8 @@ before this will work! Once you are ready, uncomment the COMPILE define on line 7; then you can build and run the example: ``` -$ make eleven -$ ./bin/eleven +$ make 11_raja_device_kernel +$ ./bin/11_raja_device_kernel ``` For reference, lesson 12 contains the solution, so don't worry if you get stuck! From f3f5a7201d3deab3a98f3df9b823e203c4d45d86 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 14:05:06 -0700 Subject: [PATCH 14/20] fix twelve --- .../{twelve.cpp => 12_raja_device_kernel_complete.cpp} | 0 .../lessons/12_raja_device_kernel_complete/CMakeLists.txt | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename Intro_Tutorial/lessons/12_raja_device_kernel_complete/{twelve.cpp => 12_raja_device_kernel_complete.cpp} (100%) diff --git a/Intro_Tutorial/lessons/12_raja_device_kernel_complete/twelve.cpp b/Intro_Tutorial/lessons/12_raja_device_kernel_complete/12_raja_device_kernel_complete.cpp similarity index 100% rename from Intro_Tutorial/lessons/12_raja_device_kernel_complete/twelve.cpp rename to Intro_Tutorial/lessons/12_raja_device_kernel_complete/12_raja_device_kernel_complete.cpp diff --git a/Intro_Tutorial/lessons/12_raja_device_kernel_complete/CMakeLists.txt b/Intro_Tutorial/lessons/12_raja_device_kernel_complete/CMakeLists.txt index 1c25528..951a0c7 100644 --- a/Intro_Tutorial/lessons/12_raja_device_kernel_complete/CMakeLists.txt +++ b/Intro_Tutorial/lessons/12_raja_device_kernel_complete/CMakeLists.txt @@ -1,6 +1,6 @@ if (ENABLE_CUDA) blt_add_executable( - NAME twelve - SOURCES twelve.cpp + NAME 12_raja_device_kernel_complete + SOURCES 12_raja_device_kernel_complete.cpp DEPENDS_ON RAJA umpire cuda) endif() From 2ade4c5883af9f2385419559176e5e43011e3972 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 14:12:25 -0700 Subject: [PATCH 15/20] fix eight --- .../08_raja_umpire_quick_pool.cpp | 11 +++- .../08_raja_umpire_quick_pool/eight.cpp | 61 +++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/08_raja_umpire_quick_pool.cpp b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/08_raja_umpire_quick_pool.cpp index 1f11a32..8e05c41 100644 --- a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/08_raja_umpire_quick_pool.cpp +++ b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/08_raja_umpire_quick_pool.cpp @@ -2,11 +2,15 @@ #include "RAJA/RAJA.hpp" #include "umpire/Umpire.hpp" -#include "umpire/strategy/QuickPool.hpp" + +//Uncomment to compile +//#define COMPILE int main() { - constexpr int N{10000}; +#if defined(COMPILE) + + constexpr int N{1000}; constexpr std::size_t CUDA_BLOCK_SIZE{256}; double* a{nullptr}; double* b{nullptr}; @@ -19,7 +23,6 @@ int main() auto host_allocator = rm.getAllocator("HOST"); // TODO: create an allocator called "pool" using the QuickPool strategy - auto pool = rm.makeAllocator("POOL", allocator); a = static_cast(pool.allocate(N*sizeof(double))); b = static_cast(pool.allocate(N*sizeof(double))); @@ -52,5 +55,7 @@ int main() host_allocator.deallocate(a_h); host_allocator.deallocate(b_h); +#endif + return 0; } diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp new file mode 100644 index 0000000..8e05c41 --- /dev/null +++ b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp @@ -0,0 +1,61 @@ +#include + +#include "RAJA/RAJA.hpp" +#include "umpire/Umpire.hpp" + +//Uncomment to compile +//#define COMPILE + +int main() +{ +#if defined(COMPILE) + + constexpr int N{1000}; + constexpr std::size_t CUDA_BLOCK_SIZE{256}; + double* a{nullptr}; + double* b{nullptr}; + double* a_h{nullptr}; + double* b_h{nullptr}; + + auto& rm = umpire::ResourceManager::getInstance(); + + auto allocator = rm.getAllocator("DEVICE"); + auto host_allocator = rm.getAllocator("HOST"); + + // TODO: create an allocator called "pool" using the QuickPool strategy + + a = static_cast(pool.allocate(N*sizeof(double))); + b = static_cast(pool.allocate(N*sizeof(double))); + a_h = static_cast(host_allocator.allocate(N*sizeof(double))); + b_h = static_cast(host_allocator.allocate(N*sizeof(double))); + + RAJA::forall< RAJA::seq_exec >( + RAJA::TypedRangeSegment(0, N), [=] (int i) { + a_h[i] = 1.0; + b_h[i] = 1.0; + } + ); + + rm.copy(a, a_h); + rm.copy(b, b_h); + + double dot{0.0}; + RAJA::ReduceSum cudot(0.0); + + RAJA::forall>(RAJA::TypedRangeSegment(0, N), + [=] RAJA_DEVICE (int i) { + cudot += a[i] * b[i]; + }); + + dot = cudot.get(); + std::cout << "dot = " << dot << std::endl; + + pool.deallocate(a); + pool.deallocate(b); + host_allocator.deallocate(a_h); + host_allocator.deallocate(b_h); + +#endif + + return 0; +} From 521ce778e45bb0485bb7e8a883d728da2f2bed21 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 14:12:43 -0700 Subject: [PATCH 16/20] fixes for 08 --- .../08_raja_umpire_quick_pool/eight.cpp | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp diff --git a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp b/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp deleted file mode 100644 index 8e05c41..0000000 --- a/Intro_Tutorial/lessons/08_raja_umpire_quick_pool/eight.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -#include "RAJA/RAJA.hpp" -#include "umpire/Umpire.hpp" - -//Uncomment to compile -//#define COMPILE - -int main() -{ -#if defined(COMPILE) - - constexpr int N{1000}; - constexpr std::size_t CUDA_BLOCK_SIZE{256}; - double* a{nullptr}; - double* b{nullptr}; - double* a_h{nullptr}; - double* b_h{nullptr}; - - auto& rm = umpire::ResourceManager::getInstance(); - - auto allocator = rm.getAllocator("DEVICE"); - auto host_allocator = rm.getAllocator("HOST"); - - // TODO: create an allocator called "pool" using the QuickPool strategy - - a = static_cast(pool.allocate(N*sizeof(double))); - b = static_cast(pool.allocate(N*sizeof(double))); - a_h = static_cast(host_allocator.allocate(N*sizeof(double))); - b_h = static_cast(host_allocator.allocate(N*sizeof(double))); - - RAJA::forall< RAJA::seq_exec >( - RAJA::TypedRangeSegment(0, N), [=] (int i) { - a_h[i] = 1.0; - b_h[i] = 1.0; - } - ); - - rm.copy(a, a_h); - rm.copy(b, b_h); - - double dot{0.0}; - RAJA::ReduceSum cudot(0.0); - - RAJA::forall>(RAJA::TypedRangeSegment(0, N), - [=] RAJA_DEVICE (int i) { - cudot += a[i] * b[i]; - }); - - dot = cudot.get(); - std::cout << "dot = " << dot << std::endl; - - pool.deallocate(a); - pool.deallocate(b); - host_allocator.deallocate(a_h); - host_allocator.deallocate(b_h); - -#endif - - return 0; -} From 8d110b291d44726a58e82ab2d36fe685b4cb0911 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 14:13:36 -0700 Subject: [PATCH 17/20] clean up pass --- Intro_Tutorial/lessons/10_raja_kernel/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Intro_Tutorial/lessons/10_raja_kernel/README.md b/Intro_Tutorial/lessons/10_raja_kernel/README.md index 7cbc3b8..9b5895b 100644 --- a/Intro_Tutorial/lessons/10_raja_kernel/README.md +++ b/Intro_Tutorial/lessons/10_raja_kernel/README.md @@ -68,6 +68,6 @@ When you have finished making your changes, uncomment the COMPILE define on line then compile and run the code: ``` -$ make raja_kernel -$ ./bin/raja_kernel +$ make 10_raja_kernel +$ ./bin/10_raja_kernel ``` From b256083c32aded28ae35fac94f98ad3348005e66 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 14:20:58 -0700 Subject: [PATCH 18/20] clean up 5 and 6 --- .../lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp | 2 +- .../06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Intro_Tutorial/lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp b/Intro_Tutorial/lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp index ecb103c..4544c61 100644 --- a/Intro_Tutorial/lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp +++ b/Intro_Tutorial/lessons/05_raja_reduce/solution/05_raja_reduce_solution.cpp @@ -25,7 +25,7 @@ int main() } ); - std::cout << "dot product is "<< dot << std::endl; + std::cout << "dot product is "<< dot.get() << std::endl; allocator.deallocate(a); allocator.deallocate(b); diff --git a/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp b/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp index 549dc97..b7e0d7a 100644 --- a/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp +++ b/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp @@ -1,4 +1,4 @@ -#include +1;95;0c#include #include "RAJA/RAJA.hpp" #include "umpire/Umpire.hpp" From 5eae5ca7d234c48bf785eb50d7994a638ce9c068 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 15:26:05 -0700 Subject: [PATCH 19/20] Update 06_raja_umpire_uvm_solution.cpp --- .../06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp b/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp index b7e0d7a..549dc97 100644 --- a/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp +++ b/Intro_Tutorial/lessons/06_raja_umpire_uvm/solution/06_raja_umpire_uvm_solution.cpp @@ -1,4 +1,4 @@ -1;95;0c#include +#include #include "RAJA/RAJA.hpp" #include "umpire/Umpire.hpp" From 73586ba8f2adf7950c45dae76229969a401c4bd2 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Mon, 12 Aug 2024 16:09:31 -0700 Subject: [PATCH 20/20] use global thread policies in examples --- .../solution/11_raja_device_kernel_solution.cpp | 6 +++--- .../12_raja_device_kernel_complete.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Intro_Tutorial/lessons/11_raja_device_kernel/solution/11_raja_device_kernel_solution.cpp b/Intro_Tutorial/lessons/11_raja_device_kernel/solution/11_raja_device_kernel_solution.cpp index faf99c3..885480d 100644 --- a/Intro_Tutorial/lessons/11_raja_device_kernel/solution/11_raja_device_kernel_solution.cpp +++ b/Intro_Tutorial/lessons/11_raja_device_kernel/solution/11_raja_device_kernel_solution.cpp @@ -32,9 +32,9 @@ int main() // TODO: convert EXEC_POL to use CUDA using EXEC_POL = RAJA::KernelPolicy< - RAJA::statement::CudaKernel< - RAJA::statement::For<1, RAJA::cuda_block_x_loop, - RAJA::statement::For<0, RAJA::cuda_thread_x_loop, + RAJA::statement::CudaKernelFixed<256, + RAJA::statement::For<1, RAJA::cuda_global_size_y_direct<16>, + RAJA::statement::For<0, RAJA::cuda_global_size_x_direct<16>, RAJA::statement::Lambda<0> > > diff --git a/Intro_Tutorial/lessons/12_raja_device_kernel_complete/12_raja_device_kernel_complete.cpp b/Intro_Tutorial/lessons/12_raja_device_kernel_complete/12_raja_device_kernel_complete.cpp index decd10a..c8695b2 100644 --- a/Intro_Tutorial/lessons/12_raja_device_kernel_complete/12_raja_device_kernel_complete.cpp +++ b/Intro_Tutorial/lessons/12_raja_device_kernel_complete/12_raja_device_kernel_complete.cpp @@ -31,9 +31,9 @@ int main() using EXEC_POL = RAJA::KernelPolicy< - RAJA::statement::CudaKernel< - RAJA::statement::For<1, RAJA::cuda_block_x_loop, - RAJA::statement::For<0, RAJA::cuda_thread_x_loop, + RAJA::statement::CudaKernelFixed<256, + RAJA::statement::For<1, RAJA::cuda_global_size_y_direct<16>, + RAJA::statement::For<0, RAJA::cuda_global_size_x_direct<16>, RAJA::statement::Lambda<0> > >