Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

C++ parallel STL Vectorized algorithm not implemented p2408

I’m compiling the C++ code below with g++ 14.0.0:

g++ -I/path/to/c++/14.0.0 -L/path/to/c++/libstdc++ -ltbb -std=c++23 -o main main.cc 
#include <iostream>                                                                                                                                                                                         
#include <algorithm>                                                                                                                                                                                        
#include <execution>                                                                                                                                                                                        
#include <ranges>                                                                                                                                                                                           
#include <thread>                                                                                                                                                                                           
#include <syncstream>                                                                                                                                                                                       
                                                                                                                                                                                                            
int main()                                                                                                                                                                                                  
{                                                                                                                                                                                                           
  using namespace std::chrono_literals;                                                                                                                                                                     
  auto r = std::views::iota(0) | std::views::take(10);                                                                                                                                                      
  auto input_range = std::ranges::common_view(r);                                                                                                                                                           
  std::for_each(std::execution::par_unseq, std::ranges::begin(input_range), std::ranges::end(input_range),                                                                                                  
                [&](int i) {                                                                                                                                                                                
                  std::thread::id this_id = std::this_thread::get_id();                                                                                                                                     
                  std::this_thread::sleep_for(2000ms);                                                                                                                                                      
                  std::osyncstream(std::cout)  << this_id << std::endl ;                                                                                                                                    
                });                                                                                                                                                                                         
  return 0;                                                                                                                                                                                                 
}                                                                                                                                                                                                           

the code compiles but I get the warning

In function ‘_RandomAccessIterator __pstl::__internal::__brick_unique(_RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, std::true_type)’:
note: ‘#pragma message:  [Parallel STL message]: "Vectorized algorithm unimplemented, redirected to serial"’
 1219 |     _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");

I’m configuring gcc with

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

./configure --prefix=/path/to/install/dir --disable-multilib --with-system-zlib --enable-default-pie --enable-default-ssp --disable-fixincludes --with-mpfr=/path/to/mpfr --with-mpc=/path/to/mpc --with-gmp=/path/to/gmp --enable-languages=c,c++,fortran,go,lto,m2,objc,obj-c++ --no-create --no-recursion

and config.log has the variable PKG_CONFIG_PATH with the correct path to MKL TBB.

I thought that p2408 was implemented as per the this post.

Anyone knows what could I be doing wrong? TBB is installed

The code seems to have the same problem on godbolt.

>Solution :

Per the compiler support guide on cppreference only MSVC 19.34 supports p2408R5.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading