-
Notifications
You must be signed in to change notification settings - Fork 2
Proofread pass #59
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
Merged
Merged
Proofread pass #59
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1424fd3
Edit pass through top-level README
rhornung67 4a99afd
Edit pass through README and fix compiler warning
rhornung67 6f994e7
Add links to RAJA docs
rhornung67 92a43d5
Edit pass through README and add TODO comment to code for consistency
rhornung67 dbb0f95
Edit pass through README to provide more footing for participants
rhornung67 15c6216
Add titles to readmes and make numbering consistent
rhornung67 1f43ca4
Added compile macro stuff for easier diffing with solution file.
rhornung67 354ea5f
Fix links and proof lesson one docs
rhornung67 561c25e
Proof and add links to README
rhornung67 a74e612
Update Intro_Tutorial/lessons/07_raja_algs/README.md
rhornung67 e7c53ea
Fix typo and clarify comment
rhornung67 d5690ab
Merge branch 'task/rhornung67/fix-readme-links' of github.com:LLNL/ra…
rhornung67 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| # RAJA Portability Suite Intro Tutorial | ||
|
|
||
| Welcome to the RAJA Portability Suite Intro tutorial. In this tutorial you will learn | ||
| how to write an simple application that can target different hardware | ||
| architectures using the RAJA and Umpire libraries. | ||
| Welcome to the RAJA Portability Suite Intro tutorial. In this tutorial, you | ||
| will learn how to use RAJA and Umpire to write simple platform portable code | ||
| that can be compiled to target different hardware architectures. | ||
|
|
||
| ## Lessons | ||
|
|
||
| You can find lessons in the lessons subdirectory. Each lesson has a README file | ||
| which will introduce new concepts and provide instructions to move forward. | ||
|
|
||
| Each lesson builds upon the previous one, so if you get stuck, you can look at | ||
| the next lesson to see the complete code. Additionally, some tutorials have | ||
| solutions folder with a provided solution. | ||
| Lessons are in the `lessons` subdirectory. Each lesson has a README file | ||
| that introduces new concepts and provides instructions to complete the lesson. | ||
| Each lesson builds on the previous ones to allow you to practice using RAJA | ||
| and Umpire capabilities and to reinforce the content. | ||
|
|
||
| Lessons contain source files with missing code and instructions for you to fill | ||
| in the missing parts along with solution files that contain the completed | ||
| lesson code. If you get stuck, you can diff the lesson and solution files to see | ||
| the code that the lesson is asking you to fill in. |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
45 changes: 29 additions & 16 deletions
45
Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md
This file contains hidden or 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 |
|---|---|---|
| @@ -1,33 +1,46 @@ | ||
| # Lesson 8 | ||
| # Lesson 8: Umpire Memory Pools | ||
|
|
||
| In this lesson, you will learn to create a memory pool using Umpire. | ||
| In this lesson, you will learn to create and use an Umpire memory pool. | ||
|
|
||
| Frequently allocating and deallocating memory can be quite costly, especially when you are making large allocations or allocating on different memory resources. | ||
| Memory pools are a more efficient way to allocate large amounts of memory, especially when dealing with HPC environments. | ||
| Frequently allocating and deallocating memory can be quite costly, especially | ||
| when you are making large allocations or allocating on different memory | ||
| resources. Memory pools are a more efficient way to allocate large amounts of | ||
| memory, especially in HPC environments. | ||
|
|
||
| Additionally, Umpire provides allocation strategies that can be used to customize how data is obtained from the system. | ||
| In this lesson, we will learn about one such strategy called `QuickPool`. | ||
| Umpire provides **allocation strategies** that can be used to customize how | ||
| data is obtained from the system. In this lesson, we will learn about one such | ||
| strategy called `QuickPool`. | ||
|
|
||
| The `QuickPool` strategy describes a certain type of pooling algorithm provided in the Umpire API. | ||
| As its name suggests, `QuickPool` has been shown to be performant for many use cases. | ||
| The `QuickPool` strategy describes a certain type of pooling algorithm provided | ||
| by Umpire. As its name suggests, `QuickPool` is performant for many use cases. | ||
|
|
||
| Umpire also provides other types of pooling strategies such as `DynamicPoolList` and `FixedPool`. | ||
| You can visit the documentation to learn more: https://umpire.readthedocs.io/en/develop/index.html | ||
| Umpire also provides other types of pooling strategies such as `DynamicPoolList` | ||
| and `FixedPool`. More information about Umpire memory pools and other features | ||
| is available in the [Umpire User Guide](https://umpire.readthedocs.io/en/develop/index.html). | ||
|
|
||
| To create a new memory pool allocator using the `QuickPool` strategy, we can use the `ResourceManager`: | ||
| To create a new memory pool allocator using the `QuickPool` strategy, we use | ||
| the `ResourceManager`: | ||
| ``` | ||
| umpire::Allocator pool = rm.makeAllocator<umpire::strategy::QuickPool>("pool_name", my_allocator); | ||
| ``` | ||
|
|
||
| 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 `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 | ||
| This newly created `pool` is an `umpire::Allocator` that uses the `QuickPool` | ||
| allocation strategy. In the code example above, we call the | ||
| `ResourceManager::makeAllocator` function to create the pool allocator. We | ||
| pass in: (1) the name we choose for the the pool, and (2) an allocator we | ||
| previously created with the `ResourceManager`. Note that you will need to | ||
| include the Umpire header file for the pool type you wish to use, in this case | ||
| ``` | ||
| #include "umpire/strategy/QuickPool.hpp" | ||
| ``` | ||
|
|
||
| When you have created your QuickPool allocator, uncomment the COMPILE define on line 7; | ||
| then compile and run the code: | ||
| ``` | ||
| $ make 08_raja_umpire_quick_pool | ||
| $ ./bin/08_raja_umpire_quick_pool | ||
| ``` | ||
|
|
||
| Other arguments can be passed to the pool constructor if needed. However, they | ||
| are beyond the scope of this tutorial. Please visit the [Umpire User Guide](https://umpire.readthedocs.io/en/develop/index.html) to learn more. | ||
|
|
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| # Lesson 9 | ||||||
| # Lesson 9: RAJA Views and Layouts | ||||||
|
|
||||||
| In this lesson, you will learn how to use `RAJA::View` to simplify | ||||||
| multidimensional indexing in a matrix-matrix multiplication kernel. | ||||||
|
|
@@ -7,48 +7,60 @@ As is commonly done for efficiency in C and C++, we have allocated the data for | |||||
| the matrices as one-dimensional arrays. Thus, we need to manually compute the | ||||||
| data pointer offsets for the row and column indices in the kernel. | ||||||
|
|
||||||
| The `View` has two template parameters `RAJA::View< TYPE, LAYOUT>`. The `TYPE` | ||||||
| is the data type of the underlying data, and `LAYOUT` is a `RAJA::Layout` type that describes how the data is arranged. | ||||||
|
|
||||||
| The `Layout` takes two template parameters: `RAJA::Layout<DIM, TYPE>`. Here, | ||||||
| `DIM` is the dimension of the layout, and `TYPE` is the type used to index into | ||||||
| the underlying data. For example, a 2D layout could be described as: | ||||||
| A `RAJA::View<TYPE, LAYOUT>` type takes two template parameters. The `TYPE` | ||||||
| parameter is the data type of the underlying data. The `LAYOUT` parameter | ||||||
| is a `RAJA::Layout` type that describes how the View indices are ordered | ||||||
| with respect to data access. A two-dimensional RAJA View constructor takes | ||||||
| three arguments; for example, | ||||||
| ``` | ||||||
| RAJA::View<TYPE, LAYOUT> my_view(data_ptr, extent0, extent1); | ||||||
| ``` | ||||||
| The `data_ptr` is a pointer to the data array that the View will be used to | ||||||
| index into. The extent arguments specify the ranges of the indices in each | ||||||
| dimension. A three-dimensional RAJA View constructor takes four arguments, | ||||||
| a data pointer and three extents, one for each View dimension. And so on for | ||||||
| higher dimensions. | ||||||
|
|
||||||
| The `RAJA::Layout<DIM, TYPE>` takes two template parameters. The `DIM` parameter | ||||||
| is the number of indexing dimension, and the `TYPE` parameter is the data type | ||||||
| of the indices used to index into the underlying data. For example, a | ||||||
| two-dimensional layout for a view that takes `int` values to index into the | ||||||
| data is defined as: | ||||||
| ``` | ||||||
| RAJA::Layout<2, int> | ||||||
| ``` | ||||||
|
|
||||||
| The default data layout ordering in RAJA is row-major, which is the convention | ||||||
| for multi-dimensional array indexing in C and C++. This means that the rightmost | ||||||
| index will be stride-1, the index to the left of the rightmost index will have | ||||||
| stride equal to the extent of the rightmost dimension, and so on. | ||||||
| It is essential to note that the default data layout ordering in RAJA is | ||||||
| row-major, which is the convention for multi-dimensional array indexing in C | ||||||
| and C++. This means that the rightmost index will be stride-1, the index to | ||||||
| the left of the rightmost index will have stride equal to the extent of the | ||||||
| rightmost dimension, and so on. | ||||||
|
|
||||||
| When constructing a `View`, the first argument is the data pointer, and the | ||||||
| remaining arguments are those required by the `Layout` constructor. For example: | ||||||
| Tying everything together, we construct a two-dimensional MxN View that uses | ||||||
| integer indices to access entries in an array of doubles as follows: | ||||||
|
|
||||||
| ``` | ||||||
| RAJA::View<double, RAJA::Layout<2, int>> view(data, N, N); | ||||||
| double* data = ...; | ||||||
| RAJA::View<double, RAJA::Layout<2, int>> view(data, M, N); | ||||||
| ``` | ||||||
| Note that the size of the data array must be at least MxN to avoid issues. | ||||||
|
|
||||||
| 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 `09_raja_view.cpp`, there are two `TODO` comments where you should create two | ||||||
| views, A, and R. R will be created via a permuted view with the same right-oriented layout | ||||||
| as A. Knowledge of `RAJA::make_permuted_view` is not required to complete this task, but | ||||||
| more information can be found here: | ||||||
| https://raja.readthedocs.io/en/develop/sphinx/user_guide/feature/view.html#make-permuted-view. | ||||||
| There are two `TODO` comments where you should complete the loop bounds, and fill | ||||||
| in A and R with their respective index values. | ||||||
| When you are ready, uncomment the COMPILE define on line 8; then you can compile and run the code: | ||||||
| In the file `09_raja_view.cpp`, there are `TODO` comments asking you to create | ||||||
| two views, `A` and `R`. `A` will be a standard RAJA view and `R` will be | ||||||
| created using the `RAJA::make_permuted_view` helper method that takes a | ||||||
| right-oriented layout, which is the same as `A`. Knowledge of | ||||||
| `RAJA::make_permuted_view` is not required to complete this task. If you | ||||||
| wish to learn more details, please see [RAJA Make Permuted View](https://raja.readthedocs.io/en/develop/sphinx/user_guide/feature/view.html#make-permuted-view). | ||||||
|
|
||||||
| There are additional `TODO` comments asking you to insert bounds of nested | ||||||
| for-loops, and fill in `A` and `R` with their respective index values. | ||||||
| When you are ready, compiler and run the code: | ||||||
|
||||||
| When you are ready, compiler and run the code: | |
| When you are ready, uncomment the COMPILE define on line 8; then compile and run the code: |
Member
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.