Skip to content

Parallel algorithms#120

Open
diehlpk wants to merge 18 commits intocplusplus:masterfrom
diehlpk:parallel_alg
Open

Parallel algorithms#120
diehlpk wants to merge 18 commits intocplusplus:masterfrom
diehlpk:parallel_alg

Conversation

@diehlpk
Copy link
Copy Markdown
Contributor

@diehlpk diehlpk commented May 13, 2025

Attempt for parallel algorithms by @diehlpk and @VictorEijkhout

@diehlpk
Copy link
Copy Markdown
Contributor Author

diehlpk commented May 14, 2025

Co-authored-by: Victor Eijkhout eijkhout@tacc.utexas.edu

@@ -0,0 +1,124 @@
## Module name: Asynchronous programming
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this PR is combining two topic introductions, could you please replace the asynch one here with a dummy so that your other PR can properly introduce that topic?

Comment thread sources/modules/concurrency-parallelism/async-programming.md Outdated
Comment thread sources/modules/concurrency-parallelism/async-programming.md Outdated
Comment thread sources/modules/concurrency-parallelism/async-programming.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated
#### Points to cover

* The header `<execution>` needs to be included
* The first argument of the algorithm is the execution policy
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execution policies them selves and their semantics should also be covered.

Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md
_These are important topics that are not expected to be covered but provide
guidance where one can continue to investigate this topic in more depth._

* If the implementation cannot parallelize or vectorize (e.g. due to lack of resources), all standard execution policies can fall back to sequential execution.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds more like a points to cover that should be added above as a student should be aware of that when using the policies.

guidance where one can continue to investigate this topic in more depth._

* If the implementation cannot parallelize or vectorize (e.g. due to lack of resources), all standard execution policies can fall back to sequential execution.
* None of the execution policies allow for reproducibilty. This is obvious for the parallel execution policies. But even `std::ececution::seq` can execute the iterations in any order.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be a caveat or points to cover in main.

Comment on lines +138 to +139
* Nvidia supports to run `std::execution::par` on Nvidia GPUs. However, that is not yet in the C++ standard and will only work with Nvidia's HPC compiler.
* Currently, parallel algorithms are implemented using Intel's TBB library in GCC. You can set the number of used cores using `tbb::global_control(tbb::global_control::max_allowed_parallelism, nthreads);` provided by the header `#include "tbb/tbb.h"`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to me more like additional information, compared to advanced features about the topic. I'm not sure where to best put this.

diehlpk and others added 4 commits April 30, 2026 09:15
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants