From 1dd4d32997c9c7b6bd15dce4ff81297f01eb5dd3 Mon Sep 17 00:00:00 2001 From: jmrosinski Date: Sun, 2 Aug 2020 16:27:08 -0600 Subject: [PATCH] Modify behavior of gptl_avail for readability to be more like papi_avail Change version number, and maintainer email Use AC_FC_MODULE_EXTENSION (normally "mod") Print warning when MPI not found --- configure.ac | 7 +++- fortran/src/Makefile.am | 3 +- fortran/tests/Makefile.am | 2 +- include/gptl.h | 2 +- src/gptl_papi.c | 5 ++- tests/gptl_avail.c | 80 +++++++++++++++++++-------------------- 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/configure.ac b/configure.ac index 951c481b..3e0eb737 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_PREREQ([2.59]) # Initialize autoconf. -AC_INIT([GPTL], [8.0.2], [rosinski@ucar.edu]) +AC_INIT([GPTL], [8.0.3], [jmrosinski@gmail.com]) # Find out about the host we're building on. AC_CANONICAL_HOST @@ -337,6 +337,8 @@ if test "x$have_libmpi" = xyes; then AC_DEFINE([MPI_STATUS_SIZE_IN_INTS], [5], [size of status in MPI]) AC_MSG_WARN([Could not determine MPI_STATUS_SIZE_IN_INTS -- GUESSING 5]) fi +else + AC_MSG_WARN([MPI_Init not found. GPTL MPI capabilities pr_summary and PMPI will NOT be enabled]) fi AM_CONDITIONAL([HAVE_LIBMPI], [test "x$have_libmpi" = xyes]) @@ -388,6 +390,9 @@ if test "x$fortran_support" = xyes; then # Make sure this file is copied to build directories for tests to work. AC_CONFIG_LINKS([fortran/tests/gptlnl:fortran/tests/gptlnl]) +# Discover the extension used for Fortran modules (will be stored in $FC_MODEXT) + AC_FC_MODULE_EXTENSION() + # Test OMP for Fortran and set flags accordingly, only if OMP support was enabled above for C # AC_OPENMP sets OPENMP_FCFLAGS have_fort_omp=no diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 8ed7eb1b..a10d78c2 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -30,4 +30,5 @@ gptl.mod: gptlf.$(OBJEXT) # Install these in the include directory. include_HEADERS = gptl.mod -CLEANFILES = *.mod +# Remove module files +CLEANFILES = *.$(FC_MODEXT) diff --git a/fortran/tests/Makefile.am b/fortran/tests/Makefile.am index 61e8d607..8910e8aa 100644 --- a/fortran/tests/Makefile.am +++ b/fortran/tests/Makefile.am @@ -93,7 +93,7 @@ endif # Test output to be deleted: include ALL possible executables ALLEXES = overhead handle utrtest testbasics errtest nlreader outoforder legacy omptest \ threadohd testbacktrace testinit testpapi summary print_mpistatus_size pmpi -CLEANFILES = timing.?????? timing.summary* *_ohd *.mod *.trs *.log *.o $(ALLEXES) +CLEANFILES = *.$(FC_MODEXT) timing.?????? timing.summary* *_ohd *.mod *.trs *.log *.o $(ALLEXES) # This file is required for the nlreader test. EXTRA_DIST = gptlnl diff --git a/include/gptl.h b/include/gptl.h index 6a07d9dd..ab46c563 100644 --- a/include/gptl.h +++ b/include/gptl.h @@ -31,7 +31,7 @@ typedef enum { GPTLdopr_multparent = 14, // Print multiple parent info (true) GPTLdopr_collision = 15, // Print hastable collision info (true) GPTLdopr_memusage = 27, // Print memory usage stats when growth exceeds some threshhold % - GPTLprint_method = 16, // Tree print method: first parent, last parent + GPTLprint_method = 16, // Tree print method: first parent, last parent, // most frequent, or full tree (most frequent) GPTLtablesize = 50, // per-thread size of hash table GPTLmaxthreads = 51, // maximum number of threads diff --git a/src/gptl_papi.c b/src/gptl_papi.c index 979bcff2..2d553f1d 100644 --- a/src/gptl_papi.c +++ b/src/gptl_papi.c @@ -1,3 +1,4 @@ + /* ** gptl_papi.c ** @@ -292,7 +293,7 @@ int GPTL_PAPIsetoption (const int counter, const int val) */ int canenable (int counter) { - char eventname[PAPI_MAX_STR_LEN]; /* returned from PAPI_event_code_to_name */ + char eventname[PAPI_MAX_STR_LEN]; // returned from PAPI_event_code_to_name if (npapievents+1 > MAX_AUX) return false; @@ -317,7 +318,7 @@ int canenable (int counter) */ int canenable2 (int counter1, int counter2) { - char eventname[PAPI_MAX_STR_LEN]; /* returned from PAPI_event_code_to_name */ + char eventname[PAPI_MAX_STR_LEN]; // returned from PAPI_event_code_to_name if (npapievents+2 > MAX_AUX) return false; diff --git a/tests/gptl_avail.c b/tests/gptl_avail.c index dfa17f74..6609b1c8 100644 --- a/tests/gptl_avail.c +++ b/tests/gptl_avail.c @@ -11,6 +11,9 @@ int main () { int ret; + const char *yes = "Yes"; + const char *no = "No "; + char *av; // Whether derived event is available if ((ret = GPTL_PAPIlibraryinit ()) != 0) { printf ("Failure from GPTL_PAPIlibraryinit():\n" @@ -18,54 +21,47 @@ int main () return -1; } - printf ("Purpose: print derived events available on this architecture\n"); - printf ("Note: 'available' may require enabling multiplexing in some cases\n"); - printf ("For PAPI-specific events, run papi_avail and papi_native_avail" - " from the PAPI distribution\n\n"); - printf ("Available derived events:\n"); - printf ("Name Code Description\n"); - printf ("-------------------------------------------\n"); + fclose (stderr); // Disable error messages from GPTL--they can confuse the output here + + printf ("Purpose: print availability of PAPI-based derived events on this architecture\n"); + printf ("NOTE: papi_avail from installed PAPI distribution lists available PAPI events\n"); + printf (" papi_native_avail lists available native events (for advanced users)\n\n"); - if (GPTLsetoption (GPTL_IPC, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_IPC", GPTL_IPC, "Instructions per cycle"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } + printf ("Name Code Available? Description\n"); + printf ("-----------------------------------------------------------------------\n"); - if (GPTLsetoption (GPTL_LSTPI, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_LSTPI", GPTL_LSTPI, "Load-store instruction fraction"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } + av = (GPTLsetoption (GPTL_IPC, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_IPC", GPTL_IPC, av, "Instructions per cycle"); - if (GPTLsetoption (GPTL_DCMRT, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_DCMRT", GPTL_DCMRT, "L1 Miss rate (fraction)"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } + ret = GPTLinitialize (); + ret = GPTLfinalize (); + av = (GPTLsetoption (GPTL_LSTPI, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_LSTPI", GPTL_LSTPI, av, "Load-store instruction fraction"); - if (GPTLsetoption (GPTL_LSTPDCM, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_LSTPDCM", GPTL_LSTPDCM, "Load-store instructions per L1 miss"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } + ret = GPTLinitialize (); + ret = GPTLfinalize (); + av = (GPTLsetoption (GPTL_DCMRT, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_DCMRT", GPTL_DCMRT, av, "L1 Miss rate (fraction)"); - if (GPTLsetoption (GPTL_L2MRT, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_L2MRT", GPTL_L2MRT, "L2 Miss rate (fraction)"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } + ret = GPTLinitialize (); + ret = GPTLfinalize (); + av = (GPTLsetoption (GPTL_LSTPDCM, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_LSTPDCM", GPTL_LSTPDCM, av, "Load-store instructions per L1 miss"); - if (GPTLsetoption (GPTL_LSTPL2M, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_LSTPL2M", GPTL_LSTPL2M, "Load-store instructions per L2 miss"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } - if (GPTLsetoption (GPTL_L3MRT, 1) == 0) { - printf("%-20s %-10d %s\n", "GPTL_L3MRT", GPTL_L3MRT, "L3 Miss rate (fraction)"); - ret = GPTLinitialize (); - ret = GPTLfinalize (); - } + ret = GPTLinitialize (); + ret = GPTLfinalize (); + av = (GPTLsetoption (GPTL_L2MRT, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_L2MRT", GPTL_L2MRT, av, "L2 Miss rate (fraction)"); + + ret = GPTLinitialize (); + ret = GPTLfinalize (); + av = (GPTLsetoption (GPTL_LSTPL2M, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_LSTPL2M", GPTL_LSTPL2M, av, "Load-store instructions per L2 miss"); + + ret = GPTLinitialize (); + ret = GPTLfinalize (); + av = (GPTLsetoption (GPTL_L3MRT, 1) == 0) ? yes : no; + printf("%-21s %2d %-10s %s\n", "GPTL_L3MRT", GPTL_L3MRT, av, "L3 Miss rate (fraction)"); return 0; }