From 541acc0898b29a88e0981c2e3a404a9a0889699e Mon Sep 17 00:00:00 2001 From: Jim Rosinski Date: Tue, 13 May 2014 12:29:26 -0600 Subject: [PATCH] o Minor bugfixes in tests. o Added macros.make files specific to m1 --- Makefile | 2 +- ctests/profcxx.C | 2 + jrmacros/macros.make.m1 | 163 +++++++++++++++++++++++++++++++++ jrmacros/macros.make.m1xeonphi | 163 +++++++++++++++++++++++++++++++++ 4 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 jrmacros/macros.make.m1 create mode 100644 jrmacros/macros.make.m1xeonphi diff --git a/Makefile b/Makefile index c6bd030c..2e73c826 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ endif ifeq ($(FORTRAN),yes) all: lib$(LIBNAME).a $(MAKETESTS) printmpistatussize printmpistatussize: printmpistatussize.o - $(FC) -o $@ $? + $(FC) -o $@ $? $(FFLAGS) else all: lib$(LIBNAME).a $(MAKETESTS) endif diff --git a/ctests/profcxx.C b/ctests/profcxx.C index 3bd79a9e..5be40136 100644 --- a/ctests/profcxx.C +++ b/ctests/profcxx.C @@ -1,5 +1,7 @@ #include "../gptl.h" +#ifdef HAVE_PAPI #include +#endif #include "myclasses.h" int main () diff --git a/jrmacros/macros.make.m1 b/jrmacros/macros.make.m1 new file mode 100644 index 00000000..201b2c6b --- /dev/null +++ b/jrmacros/macros.make.m1 @@ -0,0 +1,163 @@ +# This file contains macro settings which are used by the Makefile. Some require +# "yes" or "no", where various subflags are required if the value is +# "yes". The intent is for the user to edit whichever parts of this file are +# necessary, save to a file named "macros.make", then run "make" to build the +# GPTL library. + +########################################################################## + +# Where to install GPTL library and include files. +# if "git" is not available, set REVNO by hand +REVNO = $(shell git describe) +INSTALLDIR = $(HOME)/gptl-$(REVNO)/m1 + +# Where to install man pages (if blank, defaults to $INSTALLDIR) +MANDIR = + +# C compiler. If HAVE_MPI=yes (see below), this should probably be set to the wrapper script. +CC = mpiicc + +# Whether to build debug lib or optimized lib, and associated flags +DEBUG = no +ifeq ($(DEBUG),yes) + CFLAGS = -g -O0 -Wall -fno-inline +else + CFLAGS = -g -O3 -finline-functions -Winline -Wall +endif + +# Set compiler flags for non-default ABIs (e.g. 64-bit addressing). +# Normally this can be blank. +ABIFLAGS = + +# Is the /proc filesystem available? On most Linux systems it is. If available, get_memusage() +# reads from it to find memory usage info. Otherwise get_memusage() will use get_rusage() +HAVE_SLASHPROC = yes + +# GPTL can enable threading either via OPENMP=yes, or PTHREADS=yes. Since +# most OpenMP implementations are built on top of pthreads, OpenMP +# applications linked with GPTL as built with PTHREADS=yes should work fine. +# Thus COMPFLAG should be set to the compiler flag that enables OpenMP directives +# if either OPENMP=yes, or PTHREADS=yes. If OPENMP=no and PTHREADS=no, GPTL +# will not be thread-safe. +OPENMP = yes +COMPFLAG = -openmp +# Set PTHREADS if available and OPENMP=no +ifeq ($(OPENMP),no) + PTHREADS = no +endif + +# For gcc, -Dinline=inline is a no-op. For other C compilers, things like +# -Dinline=__inline__ may be required. To find your compiler's definition, try +# running "./suggestions CC=". +INLINEFLAG = -Dinline=inline + +# To get some C compilers such as gcc to behave properly with -O0 and no inlining, +# need to effectively delete the "inline" keyword +ifeq ($(DEBUG),yes) + INLINEFLAG = -Dinline= +endif + +# To build the Fortran interface, set FORTRAN=yes and define the entries under +# ifeq ($(FORTRAN),yes). Otherwise, set FORTRAN=no and skip this section. +FORTRAN = yes +ifeq ($(FORTRAN),yes) +# Fortran name mangling: possibilities are: leave UNDERSCORING blank meaning none +# (e.g. xlf90), -DFORTRANDOUBLEUNDERSCORE (e.g. g77), and -DFORTRANUNDERSCORE +# (e.g. gfortran, pathf95) +# +# UNDERSCORING = +# UNDERSCORING = -DFORTRANDOUBLEUNDERSCORE + UNDERSCORING = -DFORTRANUNDERSCORE + +# Set Fortran compiler, flags, and OpenMP compiler flag. Note that Fortran +# OpenMP tests are possible with OPENMP=no as long as PTHREADS=yes +# These settings are only used by the Fortran test applications in ftests/. + FC = mpiifort + FFLAGS = -g -O2 + FOMPFLAG = -openmp +endif + +# Archiver: normally it's just ar +AR = ar + +# PAPI: If a recent version of PAPI is installed, set HAVE_PAPI=yes and set inc and lib +# info as appropriate. +HAVE_PAPI = no +ifeq ($(HAVE_PAPI),yes) + PAPI_INCFLAGS = -I/contrib/papi/5.0.1/include + PAPI_LIBFLAGS = -L/contrib/papi/5.0.1/lib -lpapi +endif + +# Whether to build GPTL with MPI support. Set inc and lib info if needed. +# If CC=mpicc or equivalent MPI driver, MPI_INCFLAGS and MPI_LIBFLAGS can be blank. +HAVE_MPI = yes +ifeq ($(HAVE_MPI),yes) +# Hopefully MPI_Comm_f2c() exists, but if not, set HAVE_COMM_F2C = no + HAVE_COMM_F2C = yes + MPI_INCFLAGS = + MPI_LIBFLAGS = +# Want 2 MPI tasks + MPICMD = mpiexec -n 2 +endif + +# clock_gettime() in librt.a is an option for gathering wallclock time stats +# on some machines. Setting HAVE_LIBRT=yes enables this, but will probably +# require linking applications with -lrt +HAVE_LIBRT = no + +# Only define HAVE_NANOTIME if this is a x86. It provides by far the finest grained, +# lowest overhead wallclock timer on that architecture. +# If HAVE_NANOTIME=yes, set BIT64=yes if this is an x86_64 +HAVE_NANOTIME = yes +ifeq ($(HAVE_NANOTIME),yes) + BIT64 = yes +endif + +# Some old compilers don't support vprintf. Set to "no" in this case +HAVE_VPRINTF = yes + +# Some old compilers don't support the C times() function. Set to "no" in this case +HAVE_TIMES = yes + +# gettimeofday() should be available everywhere. But if not, set to "no" +HAVE_GETTIMEOFDAY = yes + +# Whether to test auto-profiling (adds 2 tests to "make test"). If compiler is gcc or +# pathscale, set INSTRFLAG to -finstrument-functions. PGI 8.0.2 and later provide +# -Minstrument:functions. +TEST_AUTOPROFILE = yes +ifeq ($(TEST_AUTOPROFILE),yes) + INSTRFLAG = -finstrument-functions + CXX = mpiicpc +endif + +# Whether to enable PMPI wrappers. Turning this on will result in automatic +# start/stop entries for a number of MPI calls. +ifeq ($(HAVE_MPI),yes) + ENABLE_PMPI = no + ifeq ($(ENABLE_PMPI),yes) +# Some newer MPI releases change the prototype of some input arguments from "void *" +# to "const void *". The prototype for these functions inside GPTL must match the +# MPI library in use. For ENABLE_PMPI=yes, set MPI_CONST to yes or no appropriately. + MPI_CONST = no +# Yet another (Fortran-only) wart: the value of MPI_STATUS_SIZE varies among MPI distributions. +# Normal values are 5 or 10. AIX and very new MPICH versions it is 10. Set it here--if you get it +# wrong your instrumented code will tell you at run time the proper value. Or run ftests/pmpi + MPI_STATUS_SIZE_IN_INTS = 5 + endif +# If Fortran is enabled, the ability to automatically initialize GPTL from +# mpi_init can be enabled if iargc() and getarg() are available. + ifeq ($(FORTRAN),yes) + HAVE_IARGCGETARG = no + endif +endif + +# Whether system functions backtrace() and backtrace_symbols() exist. Setting HAVE_BACKTRACE=yes +# will enable auto-generation of function name when auto-profiling and GPTLdopr_memusage has been +# enabled at run-time. If HAVE_BACKTRACE=no, function address will be printed instead. +# GNU compilers: compile application code with -finstrument-functions -rdynamic +# Intel compilers: compile application code with -finstrument-functions -rdynamic -g +HAVE_BACKTRACE = yes +ifeq ($(HAVE_BACKTRACE),yes) + CFLAGS += -DHAVE_BACKTRACE +endif diff --git a/jrmacros/macros.make.m1xeonphi b/jrmacros/macros.make.m1xeonphi new file mode 100644 index 00000000..ba6f78c6 --- /dev/null +++ b/jrmacros/macros.make.m1xeonphi @@ -0,0 +1,163 @@ +# This file contains macro settings which are used by the Makefile. Some require +# "yes" or "no", where various subflags are required if the value is +# "yes". The intent is for the user to edit whichever parts of this file are +# necessary, save to a file named "macros.make", then run "make" to build the +# GPTL library. + +########################################################################## + +# Where to install GPTL library and include files. +# if "git" is not available, set REVNO by hand +REVNO = $(shell git describe) +INSTALLDIR = $(HOME)/gptl-$(REVNO)/m1xeonphi + +# Where to install man pages (if blank, defaults to $INSTALLDIR) +MANDIR = + +# C compiler. If HAVE_MPI=yes (see below), this should probably be set to the wrapper script. +CC = mpiicc + +# Whether to build debug lib or optimized lib, and associated flags +DEBUG = no +ifeq ($(DEBUG),yes) + CFLAGS = -g -mmic -O0 -Wall -fno-inline +else + CFLAGS = -g -mmic -O3 -finline-functions -Winline -Wall +endif + +# Set compiler flags for non-default ABIs (e.g. 64-bit addressing). +# Normally this can be blank. +ABIFLAGS = + +# Is the /proc filesystem available? On most Linux systems it is. If available, get_memusage() +# reads from it to find memory usage info. Otherwise get_memusage() will use get_rusage() +HAVE_SLASHPROC = yes + +# GPTL can enable threading either via OPENMP=yes, or PTHREADS=yes. Since +# most OpenMP implementations are built on top of pthreads, OpenMP +# applications linked with GPTL as built with PTHREADS=yes should work fine. +# Thus COMPFLAG should be set to the compiler flag that enables OpenMP directives +# if either OPENMP=yes, or PTHREADS=yes. If OPENMP=no and PTHREADS=no, GPTL +# will not be thread-safe. +OPENMP = yes +COMPFLAG = -openmp +# Set PTHREADS if available and OPENMP=no +ifeq ($(OPENMP),no) + PTHREADS = no +endif + +# For gcc, -Dinline=inline is a no-op. For other C compilers, things like +# -Dinline=__inline__ may be required. To find your compiler's definition, try +# running "./suggestions CC=". +INLINEFLAG = -Dinline=inline + +# To get some C compilers such as gcc to behave properly with -O0 and no inlining, +# need to effectively delete the "inline" keyword +ifeq ($(DEBUG),yes) + INLINEFLAG = -Dinline= +endif + +# To build the Fortran interface, set FORTRAN=yes and define the entries under +# ifeq ($(FORTRAN),yes). Otherwise, set FORTRAN=no and skip this section. +FORTRAN = yes +ifeq ($(FORTRAN),yes) +# Fortran name mangling: possibilities are: leave UNDERSCORING blank meaning none +# (e.g. xlf90), -DFORTRANDOUBLEUNDERSCORE (e.g. g77), and -DFORTRANUNDERSCORE +# (e.g. gfortran, pathf95) +# +# UNDERSCORING = +# UNDERSCORING = -DFORTRANDOUBLEUNDERSCORE + UNDERSCORING = -DFORTRANUNDERSCORE + +# Set Fortran compiler, flags, and OpenMP compiler flag. Note that Fortran +# OpenMP tests are possible with OPENMP=no as long as PTHREADS=yes +# These settings are only used by the Fortran test applications in ftests/. + FC = mpiifort + FFLAGS = -g -O2 -mmic + FOMPFLAG = -openmp +endif + +# Archiver: normally it's just ar +AR = ar + +# PAPI: If a recent version of PAPI is installed, set HAVE_PAPI=yes and set inc and lib +# info as appropriate. +HAVE_PAPI = no +ifeq ($(HAVE_PAPI),yes) + PAPI_INCFLAGS = -I/contrib/papi/5.0.1/include + PAPI_LIBFLAGS = -L/contrib/papi/5.0.1/lib -lpapi +endif + +# Whether to build GPTL with MPI support. Set inc and lib info if needed. +# If CC=mpicc or equivalent MPI driver, MPI_INCFLAGS and MPI_LIBFLAGS can be blank. +HAVE_MPI = yes +ifeq ($(HAVE_MPI),yes) +# Hopefully MPI_Comm_f2c() exists, but if not, set HAVE_COMM_F2C = no + HAVE_COMM_F2C = yes + MPI_INCFLAGS = + MPI_LIBFLAGS = +# Want 2 MPI tasks + MPICMD = mpiexec -n 2 +endif + +# clock_gettime() in librt.a is an option for gathering wallclock time stats +# on some machines. Setting HAVE_LIBRT=yes enables this, but will probably +# require linking applications with -lrt +HAVE_LIBRT = no + +# Only define HAVE_NANOTIME if this is a x86. It provides by far the finest grained, +# lowest overhead wallclock timer on that architecture. +# If HAVE_NANOTIME=yes, set BIT64=yes if this is an x86_64 +HAVE_NANOTIME = yes +ifeq ($(HAVE_NANOTIME),yes) + BIT64 = yes +endif + +# Some old compilers don't support vprintf. Set to "no" in this case +HAVE_VPRINTF = yes + +# Some old compilers don't support the C times() function. Set to "no" in this case +HAVE_TIMES = yes + +# gettimeofday() should be available everywhere. But if not, set to "no" +HAVE_GETTIMEOFDAY = yes + +# Whether to test auto-profiling (adds 2 tests to "make test"). If compiler is gcc or +# pathscale, set INSTRFLAG to -finstrument-functions. PGI 8.0.2 and later provide +# -Minstrument:functions. +TEST_AUTOPROFILE = yes +ifeq ($(TEST_AUTOPROFILE),yes) + INSTRFLAG = -finstrument-functions + CXX = mpiicpc +endif + +# Whether to enable PMPI wrappers. Turning this on will result in automatic +# start/stop entries for a number of MPI calls. +ifeq ($(HAVE_MPI),yes) + ENABLE_PMPI = no + ifeq ($(ENABLE_PMPI),yes) +# Some newer MPI releases change the prototype of some input arguments from "void *" +# to "const void *". The prototype for these functions inside GPTL must match the +# MPI library in use. For ENABLE_PMPI=yes, set MPI_CONST to yes or no appropriately. + MPI_CONST = no +# Yet another (Fortran-only) wart: the value of MPI_STATUS_SIZE varies among MPI distributions. +# Normal values are 5 or 10. AIX and very new MPICH versions it is 10. Set it here--if you get it +# wrong your instrumented code will tell you at run time the proper value. Or run ftests/pmpi + MPI_STATUS_SIZE_IN_INTS = 5 + endif +# If Fortran is enabled, the ability to automatically initialize GPTL from +# mpi_init can be enabled if iargc() and getarg() are available. + ifeq ($(FORTRAN),yes) + HAVE_IARGCGETARG = no + endif +endif + +# Whether system functions backtrace() and backtrace_symbols() exist. Setting HAVE_BACKTRACE=yes +# will enable auto-generation of function name when auto-profiling and GPTLdopr_memusage has been +# enabled at run-time. If HAVE_BACKTRACE=no, function address will be printed instead. +# GNU compilers: compile application code with -finstrument-functions -rdynamic +# Intel compilers: compile application code with -finstrument-functions -rdynamic -g +HAVE_BACKTRACE = yes +ifeq ($(HAVE_BACKTRACE),yes) + CFLAGS += -DHAVE_BACKTRACE +endif