Skip to content

Parallel algorithms - #120

Open
diehlpk wants to merge 27 commits into
cplusplus:masterfrom
diehlpk:parallel_alg
Open

diehlpk wants to merge 27 commits into
cplusplus:masterfrom
diehlpk:parallel_alg

Conversation

@diehlpk

@diehlpk diehlpk commented May 13, 2025

Copy link
Copy Markdown
Contributor

Attempt for parallel algorithms by @diehlpk and @VictorEijkhout

@diehlpk

diehlpk commented May 14, 2025

Copy link
Copy Markdown
Contributor Author

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

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/async-programming.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We added a statement: Parallelism is depending on the hardware and runtime. Therefore, we make the following remarks. We agree that it is not a perfect fit, however, from my teaching experience it is important to state.

@diehlpk

diehlpk commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@vulder we worked on your comments in today's meeting. Please have a look.

@diehlpk

diehlpk commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

@vulder please add the North America label

Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated
Comment thread sources/modules/concurrency-parallelism/parallel-algorithms.md Outdated

Parallelism is depending on the hardware and runtime. Therefore, we make the following remarks:
* 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.
* 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not quite sure what you mean by "that is not yet in the C++ standard." Do you mean the fact that NVIDIA's implementation of the parallel Standard Algorithms can run on NVIDIA GPUs? I'm not sure how that's relevant to the Standard. It can also run in parallel on CPUs, depending on command-line options, but that's also not relevant to the Standard.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mhoemmen we wanted to say that the command-line option to run on GPUs or a something like std::execution:gpu is not defined in the standard.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@diehlpk I don't see where you wrote std::execution::gpu. Also, the NVIDIA implementation works fine with std::execution::par (or par_unseq), and std::execution::gpu doesn't exist.

If you mean to say "command-line options are not part of the Standard," then would you consider saying that generally as part of every implementation? There's no need to call out one implementation specifically. Also, nvc++ has default command-line options and doesn't generally require specifying them in order to make the Standard parallel algorithms work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I removed the comment and just mentioned that only NVIDIA HPC compilers support it.

diehlpk and others added 2 commits October 1, 2026 07:58
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
diehlpk and others added 4 commits October 1, 2026 07:59
Co-authored-by: Florian Sattler <vuld3r@gmail.com>
Co-authored-by: Mark Hoemmen <mhoemmen@users.noreply.github.com>
Co-authored-by: Mark Hoemmen <mhoemmen@users.noreply.github.com>
Parallelism is depending on the hardware and runtime. Therefore, we make the following remarks:
* 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.
* 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.
* NVIDIA supports to run `std::execution::par` on NVIDIA GPUs and will only work with NVIDIA's HPC compiler.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I mean, we also run par_unseq there.

It feels like the author knows how TBB works and wants to explain it to the reader, but the author has never tried out NVIDIA's HPC compiler and doesn't really want to. Why not? You can download it for free. It generates parallel code for CPUs too.

I suggest the following change to make the sentence more neutral.

"NVIDIA's HPC compiler supports running parallel algorithms on either NVIDIA GPUs or multicore CPUs."

@vulder vulder added the NA-Group label Oct 3, 2026
@vulder
vulder self-requested a review October 3, 2026 06:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants