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

update 3 breaks BUILD_DATE use in omp simd reduction max

TimP
Honored Contributor III
374 Views

I was using

#if  __INTEL_COMPILER_BUILD_DATE >= 20140318
#pragma omp simd reduction(max: x)
#endif

and

#if  __INTEL_COMPILER_BUILD_DATE >= 20140318
#pragma omp simd lastprivate(index) reduction(max: x)
#endif

to enable building with various versions of ICL.  gcc seems not to benefit from these pragmas, although they are accepted.  14.0 update 3 evidently breaks this scheme with its more recent build date but lack of full omp simd support.   The erroneous use of #pragma omp simd without the required lastprivate and reduction (rejected by 14.0) clauses worked on some targets for 13.1 and 14.0.2 but not others.  According to my understanding, "correct" usage for 14.0 is to avoid simd pragmas entirely in cases where there is a max or min reduction, but it seems there should be a way short of disabling the pragma for all intel compilers.

I haven't been able to see a method with the predefined macros to select the different variations of #pragma omp according to whether Intel 14.0 or some other compiler is in use.

It's difficult enough that  Intel and gcc chose different interpretations of #pragma omp simd and that Intel has made several changes.

 

Another annoyance with 14.0.3 is the tendency to install the new front end hooked up to the previously active back end. The repair option doesn't fix this; it's necessary to uninstall and repeat install from the downloaded files until it gets done right.  On-line install appears totally unsatisfactory due to its tendency to quit in the middle with an undefined state.

0 Kudos
3 Replies
pbkenned1
Employee
374 Views

I can't get  __INTEL_COMPILER or __INTEL_COMPILER_BUILD_DATE to work as expected with icc-15.0 or icc-14..3 when they are guarding #pragma omp <something>.  I have to define my own macro to get the expected behavior, but at least reduction(max: var) seems to be working with icc-15.0

#ifdef ICC15
//  if( __INTEL_COMPILER == 1500)
//  {
//    if (__INTEL_COMPILER_BUILD_DATE >= 20140318)
//    {
       cout << "\n compiled with reduction(+:s) reduction(max: max_x)";
       #pragma omp simd aligned(a : 32) reduction(+:s) reduction(max: max_x)
//    }
//  }
#else
       cout << "\n compiled with just reduction(+:s)";
       #pragma omp simd aligned(a : 32) reduction(+:s)
#endif
 

=======================icc-14.0.3===================

$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.3.174 Build 20140422
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

$ icc -openmp gcc_omp_simd-4.cpp && ./a.out

 __INTEL_COMPILER = 1400
 __INTEL_COMPILER_BUILD_DATE = 20140422
 compiled with just reduction(+:s)
 max_x = 38
 sum = 19456
 PASSED
$

 

========================icc-15.0=====================

$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.024 Beta Build 20140318
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

icc: NOTE: The Beta evaluation period for this product ends on 28-aug-2014 UTC.
$ icc -openmp gcc_omp_simd-4.cpp -DICC15 && ./a.out

 __INTEL_COMPILER = 1500
 __INTEL_COMPILER_BUILD_DATE = 20140318
 compiled with reduction(+:s) reduction(max: max_x)
 max_x = 38
 sum = 19456
 PASSED
$

 

Patrick

0 Kudos
pbkenned1
Employee
374 Views

icc-150 and g++ 4.8 both accept:

#pragma omp simd aligned(a : 32) reduction(+:s) reduction(max: max_x)

icc-14.0.3 won't accept the max reduction.

#if __INTEL_COMPILER == 1500
   #if __INTEL_COMPILER_BUILD_DATE >= 20140318
       cout << "\n compiled with reduction(+:s) reduction(max: max_x)";
       #pragma omp simd aligned(a : 32) reduction(+:s) reduction(max: max_x)
   #endif

#elif __INTEL_COMPILER == 1400
   cout << "\n compiled with just reduction(+:s)";
   #pragma omp simd aligned(a : 32) reduction(+:s)

#elif (__GNUG__  >= 4) && (__GNUC_MINOR__ >= 7)
   cout << "\n compiled with reduction(+:s) reduction(max: max_x)";
   #pragma omp simd aligned(a : 32) reduction(+:s) reduction(max: max_x)
#endif

 

$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.024 Beta Build 20140318
$  icc -openmp gcc_omp_simd-4.cpp
$ ./a.out

 __INTEL_COMPILER = 1500
 __INTEL_COMPILER_BUILD_DATE = 20140318
 compiled with reduction(+:s) reduction(max: max_x)
 max_x = 38
 sum = 19456
 PASSED


$ g++ --version
g++ (GCC) 4.8.1
 

$ g++ -fopenmp gcc_omp_simd-4.cpp
$ ./a.out

 __GNUG__.__GNUC_MINOR__   = 4.8
 compiled with reduction(+:s) reduction(max: max_x)
 max_x = 38
 sum = 19456
 PASSED
$

 

Patrick

0 Kudos
TimP
Honored Contributor III
374 Views

OK, I'll try that.  Reading the doc gave me the impression numeric values of __INTEL_COMPILER were no longer supported.

The __GNUG__ macro should be __GNUC__ when using gcc as opposed to g++.  I'd been using stuff like that.  

I noticed there is now a command line option which should stop icc from defining __GNUC__.

0 Kudos
Reply