Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icc16: openmp declare reduction : internal error: 20000_0

Patrick_S_
New Contributor I
730 Views

Hey all,

I tried to use the OpenMP declare reduction pragma for an implementation of an array reduction. The code compiles fine using g++ 4.9 and produces correct results. However, using icpc-16.0.038 gives an internal error 20000_0. I attached a small code example.

#include <iostream>
#include <vector>
#include <complex>


template <const int n>
struct complex_array {

    complex_array() : element( n, std::complex<float>(0.0f,0.0f) ) {

    }

    std::vector< std::complex<float> > element;
};

template <const int n>
static inline void add_complex_struct( complex_array<n> &x, complex_array<n> const &y ) {

    for ( int i = 0; i < n; ++i ) {

        x.element += y.element;
    }
}


#pragma omp declare reduction( complex_array_reduction : complex_array<10> : add_complex_struct<10>(omp_out, omp_in) )


int main() {

    complex_array<10> a_array, b_array;


    for ( int i = 0; i < 10; ++i ) {

        std::complex<float> cf( 1.0f+i, 1.5f+i );

        a_array.element =  cf;
    }


    #pragma omp parallel for schedule(static) reduction( complex_array_reduction:b_array )
    for ( int i = 0; i < 100; ++i ) {

        add_complex_struct<10>( b_array, a_array );
    }

    
    for ( int i = 0; i < 10; ++i ) {

        std::cout << b_array.element << std::endl;
    }
}

I used g++ -fopenmp and icpc -qopenmp to compile the code.

Thanks,

Patrick

0 Kudos
6 Replies
Kittur_G_Intel
Employee
730 Views

Hi Patrick,
Thanks for filing this issue which I could reproduce as well. I've escalated the issue with the developers and will touch base with you as soon as I've an update for you. Appreciate your patience till then
Thanks,
Kittur 

0 Kudos
Patrick_S_
New Contributor I
730 Views

Kittur,

do you have any updates?

regards,

Patrick

0 Kudos
Kittur_G_Intel
Employee
730 Views

Hi Patrick,
This is a bug and has been escalated and I'll let you know as soon as the release with a fix for this issue is out. Appreciate your patience through this. 
_Kittur 

0 Kudos
Patrick_S_
New Contributor I
730 Views

Kittur,

I tried the recently released Intel Compiler 16 (icpc (ICC) 16.0.0 20150815) which still is not able to compile the code. 

regards,

Patrick

0 Kudos
Kittur_G_Intel
Employee
730 Views

Hi Patrick, yes the 16.0 release that's out (initial release) doesn't contain the fix yet. The upcoming update release will do so and I'll keep you updated. As always, appreciate your patience through this.

_Kittur

0 Kudos
Kittur_G_Intel
Employee
730 Views

Hi Patrick,
Just letting you know that the 16.0 Update 1 version of the product released contains the fix for this issue which you can download and test it out, thanks.
_Kittur

0 Kudos
Reply