Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_B_
Beginner
194 Views

OpenMP Array Reduction Syntax Rejected Under ICPC 18.0.3 (Linux)

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

0 Kudos
6 Replies
Viet_H_Intel
Moderator
194 Views

 

Hi Jason,

Can you please provide us with a compile-able test case and your command line options? I am having problem to compile your provided test case.

Also, did the code compile with g++?

 

Regards,

Viet

Jason_B_
Beginner
194 Views

Hello Viet,

Thanks for the reply. Please find a sample program attached.

This code compiles under ICPC 16 and 17, Clang 6, GCC 8.1, and ICC 18 for Windows (MSVC 2013 and 2017). It fails to compile under ICPC 18:

user@dev-build:~/dev/histtest> icpc -qopenmp -lstdc++ -std=c++14 histtest.cpp -o histtest
histtest.cpp(24): error: syntax error in omp clause
  #pragma omp parallel for reduction(+:p_hist[:N])
                                             ^

compilation aborted for histtest.cpp (code 2)

Best,

J

Viet_H_Intel
Moderator
194 Views

Hi,

I am still having problem compiling your test case. I got the following errors with 17.0 version.

 

vahoang@orcsle147:/tmp$ icpc -qopenmp -lstdc++ -std=c++14 t.cpp -c -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.5.239 Build 20170817

t.cpp(14): error: namespace "std" has no member "numeric_limits"
     void Calculate(const T *values, unsigned int num_values, T v_min = std::numeric_limits<T>::min(), T v_max = std::numeric_limits<T>::max())
                                                                             ^

t.cpp(14): error: type name is not allowed
     void Calculate(const T *values, unsigned int num_values, T v_min = std::numeric_limits<T>::min(), T v_max = std::numeric_limits<T>::max())
                                                                                            ^

t.cpp(14): error: the global scope has no "min"
     void Calculate(const T *values, unsigned int num_values, T v_min = std::numeric_limits<T>::min(), T v_max = std::numeric_limits<T>::max())
                                                                                                ^

t.cpp(14): error: namespace "std" has no member "numeric_limits"
     void Calculate(const T *values, unsigned int num_values, T v_min = std::numeric_limits<T>::min(), T v_max = std::numeric_limits<T>::max())
                                                                                                                      ^

t.cpp(14): error: type name is not allowed
     void Calculate(const T *values, unsigned int num_values, T v_min = std::numeric_limits<T>::min(), T v_max = std::numeric_limits<T>::max())
                                                                                                                                     ^

t.cpp(14): error: the global scope has no "max"
     void Calculate(const T *values, unsigned int num_values, T v_min = std::numeric_limits<T>::min(), T v_max = std::numeric_limits<T>::max())
                                                                                                                                         ^

t.cpp(11): error: identifier "memset" is undefined
        memset(&m_hist[0], 0, sizeof(unsigned int) * N);
        ^
          detected during instantiation of "histogram_t<T, N>::histogram_t() [with T=unsigned short, N=6U]" at line 53

 

t.cpp(21): error: syntax error in omp clause
  #pragma omp parallel for reduction(+:p_hist[:N])
                                             ^

compilation aborted for t.cpp (code 2)
vahoang@orcsle147:/tmp$

What OS  you run on? 

Thanks,

Viet

 

Jason_B_
Beginner
194 Views

Viet Hoang (Intel) wrote:

Hi,

I am still having problem compiling your test case. I got the following errors with 17.0 version.

My apologies. I uploaded my original Windows source. Try this version instead.

J

PS. Linux OS is OpenSUSE Leap 42.3

Viet_H_Intel
Moderator
194 Views

Hi Jason,

This seems to be a known issue but hasn't been fixed yet. The internal bug number is: CMPLRS-50807

Thanks,

Viet

 

Jason_B_
Beginner
194 Views

Thank you, however, that was a bit of effort just to advise me that the issue is already known. In the future, may I suggest you check first to see if the issue is reported before requesting code samples from the customer which reproduce the problem?

Thanks,

J

Reply