Skip to content

Commit

Permalink
Modify behavior of gptl_avail for readability to be more like papi_avail
Browse files Browse the repository at this point in the history
Change version number, and maintainer email
Use AC_FC_MODULE_EXTENSION (normally "mod")
Print warning when MPI not found
  • Loading branch information
jmrosinski committed Aug 2, 2020
1 parent 107fc58 commit 1dd4d32
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 48 deletions.
7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
AC_PREREQ([2.59])

# Initialize autoconf.
AC_INIT([GPTL], [8.0.2], [[email protected]])
AC_INIT([GPTL], [8.0.3], [[email protected]])

# Find out about the host we're building on.
AC_CANONICAL_HOST
Expand Down Expand Up @@ -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])

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion fortran/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion fortran/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion include/gptl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/gptl_papi.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
** gptl_papi.c
**
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
80 changes: 38 additions & 42 deletions tests/gptl_avail.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,57 @@
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"
"Perhaps linking to wrong PAPI version?\n");
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;
}

0 comments on commit 1dd4d32

Please sign in to comment.