I found the bug in otfprofile.

When ompi/contrib/vt/vt/extlib/otf/tools/otfprofile/otfprofile.cpp is compiled with the PGI C++ compiler, two "expected an identifier" errors occur:

"/opt/pgi/linux86-64/10.3/include/omp.h", line 41: error: expected an
         identifier
 extern int omp_get_thread_num(void);
            ^

"/opt/pgi/linux86-64/10.3/include/omp.h", line 43: error: expected an
         identifier
 extern int omp_get_num_threads(void);

I saved the preprocessor output for otfprofile.cpp.  The code in /opt/pgi/linux86-64/10.3/include/omp.h:

#ifdef __cplusplus
extern "C" {
#endif

extern void omp_set_num_threads(int n);
extern int omp_get_thread_num(void);
extern int omp_get_num_procs(void);
extern int omp_get_num_threads(void);
extern int omp_get_max_threads(void);

expands to:


extern "C" {


extern void omp_set_num_threads(int n);
extern int 0;
extern int omp_get_num_procs(void);
extern int 1;
extern int omp_get_max_threads(void);

It is easy to see why the compiler issued the error.  The root of the problem is the definition of the OpenMP function proxys when the PGI compiler is used:

/* Disable OpenMP if the PGI compiler is used to work around the following errors:

compiler version  compiler error
< 9.0-3           PGCC-S-0000-Internal compiler error. calc_dw_tag:no tag
(see Technical Problem Report 4337 at http://www.pgroup.com/support/release_tprs_90.htm)

10.1 - 10.6       this kind of pragma may not be used here
                  #pargma omp barrier
*/
#if defined(_OPENMP) && defined(__PGI)
#       undef _OPENMP
#endif


#ifdef _OPENMP
#       include <omp.h>
#else
#       define omp_get_thread_num() 0
#       define omp_get_num_threads() 1
#endif

Later in otfprofile.cpp, the #include "Summary.h" eventually causes /opt/pgi/linux86-64/10.3/include/omp.h to be included, which leads to the syntax error.

This is not the way to enable/disable OpenMP.  _OPENMP is informational only.  In fact, the PGI C++ compiler does not use _OPENMP internally to control whether <omp.h> is included, which is why #undef _OPENMP is ineffective.  The proper way to deal with this is using configure/libtool.  I changed the code to ignore the __PGI macro:

/* Disable OpenMP if the PGI compiler is used to work around the following errors:

compiler version  compiler error
< 9.0-3           PGCC-S-0000-Internal compiler error. calc_dw_tag:no tag
(see Technical Problem Report 4337 at http://www.pgroup.com/support/release_tprs_90.htm)

*/

#ifdef _OPENMP
#       include <omp.h>
#endif

The code compiles fine for PGI C++ 10.3.  I believe the comment about 10.1-10.6 not working is possibly due to the (previously reported) mistaken identification of the 10.x compilers by configure/libtool, which I fixed.

Larry Baker
US Geological Survey
650-329-5608

Begin forwarded message:

From: Larry Baker <baker@usgs.gov>
Date: August 31, 2010 5:21:13 PM PDT
To: Open MPI Developers <devel@open-mpi.org>
Subject: [OMPI devel] Fwd:  1.5rc5 has been posted
Reply-To: Open MPI Developers <devel@open-mpi.org>

My head hurts from working on this!  I just realized <omp.h> is for OpenMP, not OpenMPI.  So, of course the PGI <omp.h> is used.  I still don't know why otfprofile is failing, but at least that explains why OpenMPI-1.5rc5 has no <mpi.h>.

Sorry for the noise.

Larry Baker
US Geological Survey
650-329-5608

Begin forwarded message:

From: Larry Baker <baker@usgs.gov>
Date: August 31, 2010 10:04:35 AM PDT
To: Open MPI Developers <devel@open-mpi.org>
Subject: Re: [OMPI devel] 1.5rc5 has been posted
Reply-To: Open MPI Developers <devel@open-mpi.org>

The make of OpenMPI 1.5rc5 fails for PGI 10.3 in otfprofile:

Making all in otfprofile
make[9]: Entering directory `/usr/local/src/openmpi-1.5rc5/ompi/contrib/vt/vt/extlib/otf/tools/otfprofile'
 CXX    otfprofile-otfprofile.o
"/opt/pgi/linux86-64/10.3/include/omp.h", line 41: error: expected an
         identifier
 extern int omp_get_thread_num(void);
            ^

"/opt/pgi/linux86-64/10.3/include/omp.h", line 43: error: expected an
         identifier
 extern int omp_get_num_threads(void);
            ^

2 errors detected in the compilation of "otfprofile.cpp".

The errors are coming from an <omp.h> file that comes with the PGI compiler.  I would think OpenMPI would use its own.  The problem is, there isn't one (yet?):

[root@hydra otfprofile]# find /usr/local/src/openmpi-1.5rc5 -name omp.h

The C++ file that is using the PGI <omp.h> file is  ompi/contrib/vt/vt/extlib/otf/tools/otfprofile/otfprofile.cpp:

[root@hydra otfprofile]# cd ompi/contrib/vt/vt/extlib/otf/tools/otfprofile
[root@hydra otfprofile]# grep omp.h *.cpp
otfprofile.cpp:# include <omp.h>

I ran the compile from make -n to verify that:

[root@hydra otfprofile]# pgcpp -m64 -DHAVE_CONFIG_H -I. -I../.. -I../../otflib -I../../otflib  -DINSIDE_OPENMPI  -D_REENTRANT -mp -g -O3 -tp amd64 -DNO_PGI_OFFSET -c -o otfprofile-otfprofile.o `test -f 'otfprofile.cpp' || echo './'`otfprofile.cpp
"/opt/pgi/linux86-64/10.3/include/omp.h", line 41: error: expected an
         identifier
 extern int omp_get_thread_num(void);
            ^

"/opt/pgi/linux86-64/10.3/include/omp.h", line 43: error: expected an
         identifier
 extern int omp_get_num_threads(void);
            ^

2 errors detected in the compilation of "otfprofile.cpp".

I don't know how to fix this.  Where is otfprofile.cpp expecting to get <omp.h>?  Why isn't it there?  I'm beginning to think this contrib/vt stuff should not be enabled by default.  I don't know that it is needed in general.

Larry Baker
US Geological Survey
650-329-5608
baker@usgs.gov

On Aug 17, 2010, at 2:18 PM, Jeff Squyres wrote:

We still have one known possible regression:

   https://svn.open-mpi.org/trac/ompi/ticket/2530

But we posted rc5 anyway (there's a bunch of stuff that has been pending for a while that is now in).  Please test!

   http://www.open-mpi.org/software/ompi/v1.5/

--
Jeff Squyres
jsquyres@cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


_______________________________________________
devel mailing list
devel@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel

_______________________________________________
devel mailing list
devel@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel

_______________________________________________
devel mailing list
devel@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel