PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Preprocessed C++ OpenMP code broken with v13.10 compiler

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Christian Rössel



Joined: 11 Nov 2012
Posts: 3

PostPosted: Wed Jan 29, 2014 1:40 am    Post subject: Preprocessed C++ OpenMP code broken with v13.10 compiler Reply with quote

Background: to add instrumentation to OpenMP codes, we first preprocess the compilation unit and then add instrumentation to the preprocessed file using the source-to-source translator OPARI2 . We then compile the file as usual. This worked fine for C, C++, and Fortran codes.

Now, with v13.10, the workflow fails for C++ OpenMP codes. This is because pgCC adds '--preinclude omp.h' to the call of pgcpp1 during the preprocessing and again during compilation. This leads to lots of 'invalid redeclaration' errors.

To reproduce:

Code:
pgCC -V

pgCC 13.10-0 64-bit target on x86-64 Linux -tp x64
The Portland Group - PGI Compilers and Tools
Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.


Code:
# foo.cpp
int main()
{
    return 0;
}


Code:
$ pgCC -E foo.cpp -mp -o foo.i
$ pgCC -o foo -mp foo.i
"/opt/pgi/linux86-64/13.10/include/omp.h", line 21: error: invalid
          redeclaration of type name "omp_nest_lock" (declared at line 21)
  struct omp_nest_lock {
         ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 26: error: invalid
          redeclaration of type name "omp_nest_lock_t" (declared at line 26)
  typedef struct omp_nest_lock omp_nest_lock_t;
                               ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 28: error: invalid
          redeclaration of type name "omp_sched_t" (declared at line 34)
  typedef enum omp_sched_t
               ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 30: error: "omp_sched_static"
          has already been declared in the current scope
     omp_sched_static = 1,
     ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 31: error: "omp_sched_dynamic"
          has already been declared in the current scope
     omp_sched_dynamic = 2,
     ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 32: error: "omp_sched_guided"
          has already been declared in the current scope
     omp_sched_guided = 3,
     ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 33: error: "omp_sched_auto"
          has already been declared in the current scope
     omp_sched_auto = 4
     ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 56: error: more than one
          instance of overloaded function "omp_init_nest_lock" has "C" linkage
  extern void omp_init_nest_lock(omp_nest_lock_t *s);
              ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 57: error: more than one
          instance of overloaded function "omp_destroy_nest_lock" has "C"
          linkage
  extern void omp_destroy_nest_lock(omp_nest_lock_t *s);
              ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 58: error: more than one
          instance of overloaded function "omp_set_nest_lock" has "C" linkage
  extern void omp_set_nest_lock(omp_nest_lock_t *s);
              ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 59: error: more than one
          instance of overloaded function "omp_unset_nest_lock" has "C" linkage
  extern void omp_unset_nest_lock(omp_nest_lock_t *s);
              ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 60: error: more than one
          instance of overloaded function "omp_test_nest_lock" has "C" linkage
  extern int omp_test_nest_lock(omp_nest_lock_t *s);
             ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 72: error: more than one
          instance of overloaded function "omp_set_schedule" has "C" linkage
  extern void omp_set_schedule(omp_sched_t,int);
              ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 73: error: more than one
          instance of overloaded function "omp_get_schedule" has "C" linkage
  extern void omp_get_schedule(omp_sched_t *,int *);
              ^

"/opt/pgi/linux86-64/13.10/include/omp.h", line 82: error: invalid
          redeclaration of type name "__cplus_omp_init_lock_t" (declared at
          line 82)
    class __cplus_omp_init_lock_t {
          ^

15 errors detected in the compilation of "foo.i".


Unfortunately, this new feature breaks all tools relying on preprocessing. We and the users of our performance analysis tools would appreciate to switch back to the previous behavior. The affected systems are recent Cray installations.

Thanks,
Christian
Back to top
View user's profile
Deb Caruso



Joined: 15 Jan 2014
Posts: 6

PostPosted: Wed Jan 29, 2014 9:55 am    Post subject: Reply with quote

Sorry for the in convenience. In release 14.1 , we have the new flag --no_preinclude
You can use that when you recompile openmp preprocessed files.
Back to top
View user's profile
Christian Rössel



Joined: 11 Nov 2012
Posts: 3

PostPosted: Thu Jan 30, 2014 8:41 am    Post subject: Reply with quote

Thanks, that would help!

Christian
Back to top
View user's profile
Daniel Lorenz



Joined: 14 Feb 2014
Posts: 1

PostPosted: Fri Feb 14, 2014 6:51 am    Post subject: Reply with quote

I encounter the same problem with a PGI 14.1 compiler. However, my pgCC compiler says that --no_preinclude is an unknown switch. Also the man pages do not mention this option or a similar one. (I also tried similar forms with varying configurations of dashes and underscores) Is this option only available on specific systems or do I need to consider something special during installation?

My compiler version:
Code:
$ pgCC --version

pgCC 14.1-0 64-bit target on x86-64 Linux -tp x64
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.


Its output:
Code:
$ pgCC --no_preinclude
pgCC-Error-Unknown switch: --no_preinclude
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6208
Location: The Portland Group Inc.

PostPosted: Fri Feb 14, 2014 10:33 am    Post subject: Reply with quote

Apologies Daniel. It looks like Deb forgot an "s". The flag is "--no_preincludes"

Code:
% pgCC --no_preincludes -help
Reading rcfile /proj/pgi/linux86-64/14.1/bin/.pgcpprc
--no_preincludes    Ignore all preincluded files: used for compiling preprocessed files


- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group