I think it is confusing that there is no parallel version of std::accumulate in the C++ standard. It appears to me that it would be trivial to implement it in parallel, for instance, based on OpenMP or SIMD instructions. Does anybody have a good explanation for why the standard committee chose to introduce a parallel version of std::reduce but not std::accumulate? Is it because of the different iterator types?
Why is there no parallel `std::accumulate` in the C++ standard?
3.7k Views Asked by Anton Rydahl At
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in PARALLEL-PROCESSING
- How to calculate Matrix exponential with Tailor series PARALLEL using MPI c++
- Efficiently processing many small elements of a collection concurrently in Java
- Parallelize filling of Eigen Matrix in C++
- Memory efficient parallel repeated rarefaction with subsequent matrix addition of large data set
- How to publish messages to RabbitMQ by using Multi threading?
- Running a C++ Program with CMake, MPI and OpenCV
- Alternative approach to io.ReadAll to store memory consumption and send a PUT Request with valid data
- Parallelize nested loop with running sum in Fortran
- Can I use parfor within a parfeval in Matlab R2019b and if yes how?
- Parallel testing with cucumber, selenium and junit 5
- Parallel.ForEach vs ActionBlock
- Passing variable to foreach-object -parallel which is with in start-job
- dbatools SQL Functions Not Running In Parallel While SQL Server queries do in Powershell
- How do I run multiple instances of my Powershell function in parallel?
- Joblib.parallel vs concurrent.futures
Related Questions in C++17
- How to convert mathematical expression to lambda function in C++?
- How can I include a file using Eigen's plugin include?
- What was the problem with std::is_callable?
- Using lambda function in constexpr constructor with std::tie
- How to build new types by expand a parameter pack together with another list of types?
- Solved: Create standalone executable for MacOS with OpenCV and libmagic
- C++ File Input Skipping Lines
- C++: initialization of auto&& with the ternary operator leads to the copy constructor call on MSVC
- Correctly copying temporary string from a string_view (C++ 17)
- This is not a question, but an interesting thing I discovered yesterday in visual studio c++ 17 compiler
- How can std::unique_ptr apply EBO on closure?
- Is the ordering of std::recursive_directory_iterator specified?
- Initialize a logger once
- Listing all files in the directories and subdirectories recursively in c++
- Why does the C++17 standard not allow converting a string to a bool?
Related Questions in STD
- Can't read the file using std::wifstream C++
- C++ error: no matching member function for call to 'enqueue' futures.emplace_back(TP.enqueue(sum_plus_one, x, &M));
- How to get a variable and return multiple different datatype variable using auto in c++
- How to invert templates dependency?
- Why does the C++17 standard not allow converting a string to a bool?
- How to avoid default initialization of objects in std::vector?
- Integration of drake to OpenSUSE - error: cannot convert std::string_view
- Bug when sorting std::deque
- how to use std::pmr to reuse a buff
- How to merge/count adjacent 1's within an std:array using std?
- When should I care about possible offset overflow?
- How to get the closest signed type which covers all the range of current unsigned type?
- Is it possible to use [[no_unique_address]] with non-POD types?
- How to access template parameters?
- How to unify access to class member when their presense is optional?
Related Questions in ACCUMULATE
- SIMD method to get all consecutive sums of 4 or 8 DWORD integers (prefix-sum within each vector)
- Accumulated Balance in SAS
- Accumulate based on lagged values and values in different columns in R
- Sum Accumulated Power BI DAX
- KDB/q How to accumulate based on output accuracy
- accumulating rows in chronologic order in datafame b until reaching approximately the values in dataframe a in chronologic order
- How to only attach a new accumulative ID to my groups only if they are continuously present in the data set?
- understanding purrr::accumulate in R and the paste function
- DolphinDB: how to perform iterative operations based on previous results using SQL statements?
- Summing data from time points, sequentially in r
- kdb/q How to use the Do Accumulator using a function that takes in multiple outputs?
- python pandas create new string column cumulatively based on other column condition
- Is there a way to use previously value of .y in accumulate2 function in R?
- Cumulative loan data with dates for a given firm in SAS
- How to get the factorial of a number using std :: accumulate()?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
They introduced
reducebecauseaccumulatecannot be parallelized as it was written.The C++ standard defines the expected behavior of the various functions.
accumulateis defined as follows:Emphasis added. Those two words make the algorithm unparallelizable. And because those words are part of the standard, users of
accumulateare allowed to rely on the "in order" guarantee. They can makeoperator+orbinary_opnon-associative operations, ones that rely on the ordering of the operation. So the committee couldn't just take those words away without potentially breaking a bunch of code.And they didn't want to have a parallel version of
accumulatethat had fundamentally different behavior from the non-parallel version. Therefore,reducewas introduced without the "in order" guarantee (and with other language that helped make it parallelizable).