Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit ad2dc476 authored by vijaysm's avatar vijaysm

Merged in vijaysm/pgi-fixes (pull request #250)

Better support PGI compilers
parents a39e3908 c6d5bf42
......@@ -122,15 +122,13 @@ if test "xno" != "x$enablempi"; then
F77_LIST="mpixlf77 mpif77"
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-mpi=\"${WITH_MPI}\""
else
CC_LIST="$CC gcc icc clang"
CXX_LIST="$CXX g++ icpc clang++"
FC_LIST="$FC gfortran ifort g77 f77 nag xlf"
F77_LIST="$F77 $FC_LIST"
fi
CC_LIST="$CC $CC_LIST gcc icc clang"
CXX_LIST="$CXX $CXX_LIST g++ icpc clang++"
FC_LIST="$FC $FC_LIST gfortran ifort pgf90 nag xlf"
F77_LIST="$F77 $F77_LIST $FC gfortran ifort pgf77 nag xlf g77 f77"
COMPILERPATHS=""
if test "xno" != "x$enablempi"; then
COMPILERPATHS="${WITH_MPI}/bin"
......@@ -152,10 +150,10 @@ AC_PROG_CXXCPP
# Fortran support
if (test "x$CHECK_FC" != "xno"); then
FATHOM_SET_MPI_COMPILER([FC], [$FC_LIST],[$COMPILERPATHS])
FATHOM_SET_MPI_COMPILER([F77],[$F77_LIST],[$COMPILERPATHS])
AC_PROG_FC
AC_PROG_F77
FATHOM_SET_MPI_COMPILER([FC], [$FC_LIST],[$COMPILERPATHS])
AC_PROG_FC
fi
]) # FATHOM_CHECK_COMPILERS
......@@ -189,6 +187,7 @@ AC_ARG_ENABLE( optimize, AS_HELP_STRING([--enable-optimize],[Compile optimized (
[enable_optimize=""; enable_cxx_optimize="no"; enable_cc_optimize="no"; enable_fc_optimize="no"; ]
)
EXTRA_PGI_ONLY_FCFLAGS="-Mfree"
if (test "x$enable_debug" != "xno"); then # debug flags
# GNU
EXTRA_GNU_CXXFLAGS="-Wall -Wno-long-long -pipe -pedantic -Wshadow -Wunused-parameter -Wpointer-arith -Wformat -Wformat-security -Wextra -Wno-variadic-macros -Wno-unknown-pragmas"
......@@ -197,8 +196,8 @@ EXTRA_GNU_FCFLAGS="-pipe -pedantic -ffree-line-length-0"
EXTRA_INTEL_CXXFLAGS="-pipe -C"
EXTRA_INTEL_FCFLAGS="-C"
# PGI
EXTRA_PGI_CXXFLAGS="-traceback -Mfree -C"
EXTRA_PGI_FCFLAGS="-traceback -Mfree -C -freeform -extend-source"
EXTRA_PGI_CXXFLAGS="-traceback --diag_suppress 236 --diag_suppress=unrecognized_gcc_pragma -C"
EXTRA_PGI_FCFLAGS="-traceback -Mbounds -Ktrap=inv,divz,ovf"
# XLC
EXTRA_BG_CXXFLAGS="-qarch=qp -qpic=large -qdebug=except"
EXTRA_BG_FCFLAGS="-qarch=qp -qpic=large -qdebug=except"
......@@ -206,14 +205,14 @@ fi
if (test "x$enable_cxx_optimize" != "xno"); then # optimization flags
#GNU
EXTRA_GNU_CXXFLAGS="$EXTRA_GNU_CXXFLAGS -fprefetch-loop-arrays -finline-functions"
EXTRA_GNU_CXXFLAGS="$EXTRA_GNU_CXXFLAGS -finline-functions"
EXTRA_GNU_FCFLAGS="$EXTRA_GNU_FCFLAGS -ffree-line-length-0 -finline-functions"
# Intel
EXTRA_INTEL_CXXFLAGS="$EXTRA_INTEL_CXXFLAGS -xHost -ip -no-prec-div" # -fast
EXTRA_INTEL_FCFLAGS="$EXTRA_INTEL_FCFLAGS -xHost -ip -no-prec-div" # -fast
# PGI
EXTRA_PGI_CXXFLAGS="$EXTRA_PGI_CXXFLAGS -Munroll=5 -Mnoframe"
EXTRA_PGI_FCFLAGS="$EXTRA_PGI_FCFLAGS -Munroll=5 -Mnoframe -freeform -extend-source"
EXTRA_PGI_CXXFLAGS="$EXTRA_PGI_CXXFLAGS -fast"
EXTRA_PGI_FCFLAGS="$EXTRA_PGI_FCFLAGS -fast"
# XLC
EXTRA_BG_CXXFLAGS="$EXTRA_BG_CXXFLAGS -qarch=qp -qtune=auto -qpic=large -qenablevmx"
EXTRA_BG_FCFLAGS="$EXTRA_BG_FCFLAGS -qarch=qp -qtune=auto -qpic=large -qenablevmx"
......@@ -268,7 +267,7 @@ if test "xyes" = "x$enable_debug"; then
FFLAGS="$FFLAGS -g"
fi
# Add -fstack-protector-all option for g++ in debug mode
if (test "x$GXX" = "xyes"); then
if (test "x$cxx_compiler" = "xGNU"); then
CXXFLAGS="$CXXFLAGS -fstack-protector-all"
CFLAGS="$CFLAGS -fstack-protector-all"
LDFLAGS="$LDFLAGS -fstack-protector-all"
......@@ -298,13 +297,10 @@ if (test "x$ENABLE_FORTRAN" != "xno"); then
FFLAGS="$FFLAGS -O2"
fi
AC_FC_PP_DEFINE
AC_FC_PP_SRCEXT
# AC_F77_LIBRARY_LDFLAGS
# AC_FC_LIBRARY_LDFLAGS
fi
# Check for 32/64 bit.
# This requires FATHOM_CXX_FLAGS and FATHOM_CC_FLAGS to have been called first
# Check for 32/64 bit.
# This requires FATHOM_CXX_FLAGS and FATHOM_CC_FLAGS to have been called first
AC_ARG_ENABLE(32bit, AS_HELP_STRING([--enable-32bit],[Force 32-bit objects]),
[
if (test "xyes" != "x$enableval" && test "xno" != "x$enableval"); then
......@@ -381,7 +377,7 @@ if (test "x$ENABLE_FORTRAN" != "xno" && test "x$CHECK_FC" != "xno"); then
*mira*) LIBS="$LIBS /soft/compilers/ibmcmp-feb2015/vacpp/bg/12.1/bglib64/libibmc++.a"; fcxxlinkage=yes ;;
esac
if (test "$cc_compiler" == "Intel"); then
if (test "$cxx_compiler" == "Intel"); then
my_save_ldflags="$LDFLAGS"
LDFLAGS="$LDFLAGS -cxxlib"
AC_MSG_CHECKING([whether $FC supports -cxxlib])
......@@ -391,6 +387,26 @@ if (test "x$ENABLE_FORTRAN" != "xno" && test "x$CHECK_FC" != "xno"); then
[AC_MSG_RESULT([no])]
)
LDFLAGS="$my_save_ldflags"
elif (test "$cxx_compiler" == "PortlandGroup"); then
my_save_ldflags="$LDFLAGS"
LDFLAGS="$LDFLAGS -pgc++libs"
AC_MSG_CHECKING([whether $FC supports -pgc++libs])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[fcxxlinkage=yes; FLIBS="$FLIBS -pgc++libs"; FCLIBS="$FCLIBS -pgc++libs"],
[AC_MSG_RESULT([no])]
)
LDFLAGS="$my_save_ldflags"
if (test "$fcxxlinkage" != "yes"); then
LDFLAGS="$LDFLAGS -pgcpplibs -lstd -lC"
AC_MSG_CHECKING([whether $FC supports -pgcpplibs -lstd -lC])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[fcxxlinkage=yes; FLIBS="$FLIBS -pgcpplibs -lstd -lC"; FCLIBS="$FCLIBS -pgcpplibs -lstd -lC"],
[AC_MSG_RESULT([no])]
)
LDFLAGS="$my_save_ldflags"
fi
else
if (test "$fcxxlinkage" != "yes"); then
......@@ -411,7 +427,7 @@ if (test "x$ENABLE_FORTRAN" != "xno" && test "x$CHECK_FC" != "xno"); then
# GNU and other non-intel compilers will use the standard -lstdc++ linkage
# This case also includes the Ubuntu+Clang combination as mentioned before
if (test "$cc_compiler" != "Clang" || test "$fcxxlinkage" != "yes"); then
if (test "$cxx_compiler" != "Clang" || test "$fcxxlinkage" != "yes"); then
my_save_ldflags="$LDFLAGS"
LDFLAGS="$LDFLAGS -lstdc++"
AC_MSG_CHECKING([whether $FC supports -stdlib=libstdc++])
......@@ -426,6 +442,10 @@ if (test "x$ENABLE_FORTRAN" != "xno" && test "x$CHECK_FC" != "xno"); then
fi
if (test "$fcxxlinkage" != "yes"); then
AC_MSG_WARN([Unrecognized C++ linkage for C/Fortran programs])
fi
fi
AC_SUBST(FLIBS)
......@@ -625,6 +645,7 @@ if test x$GXX = xyes; then
# Intel and Clang claims to be GCC, check for it here
FATHOM_TRY_COMPILER_DEFINE([__INTEL_COMPILER],[cxx_compiler=Intel])
FATHOM_TRY_COMPILER_DEFINE([__clang__],[cxx_compiler=Clang])
FATHOM_TRY_COMPILER_DEFINE([__PGI],[cxx_compiler=PortlandGroup])
# Search for other compiler types
# For efficiency, limit checks to relevant OSs
else
......@@ -730,6 +751,9 @@ case "$cxx_compiler:$host_cpu" in
FATHOM_CXX_32BIT=-xarch=generic
FATHOM_CXX_64BIT=-xarch=generic64
;;
PortlandGroup:*)
FATHOM_CXX_SPECIAL="$EXTRA_PGI_CXXFLAGS"
;;
Clang:*)
FATHOM_CXX_SPECIAL="$EXTRA_GNU_CXXFLAGS"
FATHOM_CXX_32BIT=-m32
......@@ -773,6 +797,7 @@ if test x$GCC = xyes; then
# Intel claims to be GCC, check for it here
FATHOM_TRY_COMPILER_DEFINE([__INTEL_COMPILER],[cc_compiler=Intel])
FATHOM_TRY_COMPILER_DEFINE([__clang__],[cc_compiler=Clang])
FATHOM_TRY_COMPILER_DEFINE([__PGI],[cc_compiler=PortlandGroup])
# Search for other compiler types
# For efficiency, limit checks to relevant OSs
else
......@@ -828,34 +853,40 @@ case "$cc_compiler:$host_cpu" in
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_GNU_ONLY_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_ONLY_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
GNU:powerpc*)
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_GNU_ONLY_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_ONLY_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
GNU:i?86|GNU:x86_64)
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_GNU_ONLY_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_ONLY_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
GNU:mips*)
FATHOM_CC_32BIT="-mips32 -mabi=32"
FATHOM_CC_64BIT="-mips64 -mabi=64"
FATHOM_CC_SPECIAL="$EXTRA_GNU_ONLY_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_ONLY_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
GNU:*)
FATHOM_CC_SPECIAL="$EXTRA_GNU_ONLY_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_ONLY_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
Intel:*)
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_SPECIAL="$EXTRA_INTEL_CXXFLAGS -wd981 -wd279 -wd1418 -wd383 -wd1572"
FATHOM_FC_SPECIAL="$EXTRA_INTEL_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
VisualAge:*)
case "$target_vendor" in
......@@ -870,6 +901,7 @@ case "$cc_compiler:$host_cpu" in
FATHOM_CC_64BIT=-q64
FATHOM_CC_SPECIAL="$EXTRA_BG_CXXFLAGS -qmaxmem=-1 -qminimaltoc"
FATHOM_FC_SPECIAL="$EXTRA_BG_FCFLAGS -qnoescape -WF,-C! -qddim -qalias=intptr"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
AR="ar"
NM="nm -B"
;;
......@@ -878,6 +910,7 @@ case "$cc_compiler:$host_cpu" in
FATHOM_CC_64BIT=-q64
FATHOM_CC_SPECIAL="$EXTRA_BG_CXXFLAGS -qmaxmem=-1 -qminimaltoc"
FATHOM_FC_SPECIAL="$EXTRA_BG_FCFLAGS -qnoescape -WF,-C! -qddim -qalias=intptr"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
AR="ar"
NM="nm -B -X 32_64"
;;
......@@ -888,14 +921,22 @@ case "$cc_compiler:$host_cpu" in
FATHOM_CC_64BIT=-64
FATHOM_CC_SPECIAL=-LANG:std
FATHOM_FC_SPECIAL=-LANG:std
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
MIPSpro:*)
FATHOM_CC_SPECIAL=-LANG:std
FATHOM_FC_SPECIAL=-LANG:std
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
;;
PortlandGroup:*)
FATHOM_CC_SPECIAL="-traceback -C"
FATHOM_FC_SPECIAL="$EXTRA_PGI_FCFLAGS $EXTRA_PGI_ONLY_FCFLAGS"
FATHOM_F77_SPECIAL="$EXTRA_PGI_FCFLAGS"
;;
Clang:*)
FATHOM_CC_SPECIAL="$EXTRA_GNU_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
;;
......@@ -912,7 +953,6 @@ case "$cc_compiler:$host_cpu" in
esac
AC_MSG_RESULT([$cc_compiler:$host_cpu])
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
]) # end FATHOM_CC_FLAGS
......
......@@ -64,7 +64,7 @@ program DirectAccessNoHolesF90
character*120 opt
! initialize interface and get root set
call iMesh_newMesh("", %REF(imesh), ierr)
call iMesh_newMesh("", imesh, ierr)
CHECK(ierr)
call iMesh_getRootSet(%val(imesh), root_set, ierr)
CHECK(ierr)
......
......@@ -15,7 +15,7 @@
! NOTE: not integer*4 (see meaning of _LP64 in GNU docs)
# define IBASE_HANDLE_T integer
# endif
#elif defined(__INTEL_COMPILER)
#elif defined(__INTEL_COMPILER) || defined(__PGI)
# ifdef __x86_64
# define IBASE_HANDLE_T integer*8
# else
......
#undef DEBUG
#undef TIME_DEBUG
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <vector>
#include <set>
......@@ -16,6 +12,7 @@
#include <utility>
#include <iostream>
#include <sstream>
#include <string>
#include "moab/Interface.hpp"
#include "Internals.hpp"
......@@ -153,24 +150,6 @@ void VALGRIND_MAKE_VEC_UNDEFINED(std::vector<T>& v) {
#define END_SERIAL
#endif
#ifdef NDEBUG
#undef assert
#define assert
#else
#undef assert
#define assert(A) \
if (!(A)) \
do_assert(__FILE__, __LINE__, #A)
static void do_assert(const char* file, int line, const char* condstr)
{
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "[%d] Assert(%s) failed at %s:%d\n", rank, condstr, file, line);
fflush(stderr);
abort();
}
#endif
static int my_Gatherv(void* sendbuf,
int sendcount,
MPI_Datatype sendtype,
......
......@@ -17,11 +17,12 @@
integer ierr, num_procs, my_id
integer pid
character*10 appname
character*132 filename, tmpfile
character*200 filename
character*14 fname
character*150 readopts
integer ngv, nge, ndim, nparts
integer nghlay
integer nverts(3), nelem(3), nblocks(3), nsbc(3), ndbc(3);
integer nverts(3), nelem(3), nblocks(3), nsbc(3), ndbc(3)
C large enough work arrays
integer iwork(100000)
real*8 dwork(100000)
......@@ -53,6 +54,7 @@ C indices for surface BC element, reference surf BC, value
character*100 outfile, wopts
my_id = 0
fname = '/io/p8ex1.h5m' // char(0)
#ifdef MOAB_HAVE_MPI
call MPI_INIT ( ierr )
call errorout(ierr, 'fail to initialize MPI')
......@@ -84,12 +86,10 @@ c find out MY process ID, and how many processes were started.
#endif
call errorout(ierr, 'fail to register application')
C
tmpfile = MESHDIR2
filename = trim(tmpfile) // '/io/p8ex1.h5m' // CHAR(0)
filename = MESHDIR2//fname
ierr = iMOAB_ReadHeaderInfo ( filename, ngv, nge, ndim, nparts)
call errorout(ierr, 'fail to read header info')
if (0.eq.my_id) then
print *, filename, ' has ', nparts, ' parts in partition',
& ngv, ' vertices ', nge, ' elements of dimension ', ndim
......@@ -103,10 +103,12 @@ C
C number of ghost layers needed by application
nghlay = 1
C now let us load the mesh in parallel
ierr = iMOAB_LoadMesh(pid, filename, readopts, nghlay)
call errorout(ierr, 'fail to read file in parallel')
C number of
C number of vertices/elements/blocks/sidesets in the mesh
ierr = iMOAB_GetMeshInfo(pid, nverts, nelem, nblocks, nsbc, ndbc)
call errorout(ierr, 'fail to get mesh info')
......@@ -136,10 +138,10 @@ C double * coords = (double*) malloc(3*nverts[2]*sizeof(double));
C the 2 tags used in this example exist in the file, already
C first tag, INTFIELD is on vertices, integer
C second tag DFIELD is on elements, double
tagtype(1)=0 !dense, int
tagtype(2)=1 !dense, double
enttype(1)=0 ! on verts
enttype(2)=1 ! on elem
tagtype(1)=0 !dense, int
tagtype(2)=1 !dense, double
enttype(1)=0 ! on verts
enttype(2)=1 ! on elem
num_co = 1
tagname1 ='INTFIELD'//CHAR(0)
ierr = iMOAB_DefineTagStorage(pid, tagname1, tagtype(1), num_co,
......@@ -151,7 +153,6 @@ C second tag DFIELD is on elements, double
& tagindex(2) )
call errorout(ierr, 'failed to get tag DFIELD')
C synchronize one of the tags only, just to see what happens
C put in the sync array just first tag index (INTFIELD)
ntsync =1
......@@ -229,7 +230,6 @@ C printf some of the block info */
enddo
enddo
C query int tag values on vertices
iTAG= ifree
......@@ -252,7 +252,6 @@ C query double tag values on elements
write (*, 104) (DWORK(dTAG+k-1), k=1,nelem(3) )
104 FORMAT ( 10F7.2 )
C query surface BCs
isBC = ifree
irBC = isBC + nsbc(3)
......@@ -268,7 +267,6 @@ C query surface BCs
105 FORMAT (' elem localID: ', I3, ' side:', I1, ' val:', I4)
C query vertex BCs
iveBC = ifree
ivaBC = iveBC + ndbc(3)
......@@ -290,17 +288,17 @@ C query vertex BCs
enddo
outfile = 'fnew.h5m'//CHAR(0)
#ifdef MOAB_HAVE_MPI
wopts = 'PARALLEL=WRITE_PART'//CHAR(0)
#else
wopts=CHAR(0)
#endif
C write out the mesh file to disk
ierr = iMOAB_WriteMesh(pid, outfile, wopts)
call errorout(ierr, 'fail to write the mesh file')
C all done. de-register and finalize
ierr = iMOAB_DeregisterApplication(pid)
call errorout(ierr, 'fail to deregister application')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment