Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

OpenMP Array Reduction Syntax Rejected Under ICPC 18.0.3 (Linux)

$
0
0

Hello, the following OpenMP 4.5 syntax is rejected under Linux with Intel C++ Compiler for Linux v18.0.3

template <typename T, unsigned int N = 256>
class histogram_t
{
public:
.
.
.
template <typename T, unsigned int N>
void histogram_t<T, N>::Initialize(const T *image, unsigned int num_values, T min, T max)
   {
   .
   .
   .
   T raw_min = std::numeric_limits<T>::max();
   T raw_max = std::numeric_limits<T>::min();
   double sum = 0.f;
   double sum_sqr = 0.f;
   unsigned int *p_hist = &m_hist[0]; // m_hist is std::array<unsigned int, N>
#pragma omp parallel for reduction(min:raw_min) reduction(max:raw_max) reduction(+:p_hist[:N], sum, sum_sqr)
   for (unsigned int i = 0; i < num_values; i++)
     {
     .
     .
     .
     }
.
.
.
};

Yields:

error: syntax error in omp clause
  #pragma omp parallel for reduction(min:raw_min) reduction(max:raw_max) reduction(+:p_hist[:N], sum, sum_sqr)
                                                                                                                                        ^
          detected during:
            instantiation of "void histogram_t<T, N>::Initialize(const T *, unsigned int, unsigned int, T, T) [with T=float, N=256U]"

 

 

This code compiles and runs just fine under the same version of the compiler in Windows / VIsual Studio 2017 15.7.3.

Cheers,

J


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>