Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GPTL library #65

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions share/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
### Fortran compiler flags
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
add_compile_definitions(
CPRGNU
NAMING=_ADD_UNDERSCORE)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
add_compile_definitions(
CPRINTEL
NAMING=_ADD_UNDERSCORE)
endif()

# The following files are generated with a script acting on templates
# We include pre-generated files that are committed to the repository
list(APPEND cesm_share_generated_files
Expand Down Expand Up @@ -43,10 +32,23 @@ list(APPEND cesm_share_src_files
CESM_share/src/water_isotopes/water_isotopes.F90
)

# The following files are mostly stubs.
# GPTL timing library srcs
list(APPEND timing_src_files
timing/f_wrappers.c
timing/gptl.c
timing/GPTLget_memusage.c
timing/gptl.h
timing/gptl.inc
timing/gptl_papi.c
timing/GPTLprint_memusage.c
timing/GPTLutil.c
timing/perf_mod.F90
timing/perf_utils.F90
)

# The following file is a stub.
list(APPEND stubs_src_files
src/perf_mod.F90
src/mct_mod.F90
stubs/mct_mod.F90
)

if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
Expand All @@ -56,12 +58,13 @@ endif()


# Collect source files for library
add_library(share STATIC ${stubs_src_files} ${cesm_share_generated_files} ${cesm_share_src_files})
add_library(share STATIC ${timing_src_files} ${stubs_src_files} ${cesm_share_generated_files} ${cesm_share_src_files})

add_compile_definitions(NUOPC_INTERFACE HAVE_MPI)
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
target_compile_definitions(share PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE)
target_compile_definitions(share PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
target_compile_definitions(share PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE)
target_compile_definitions(share PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE)
endif()

set_target_properties(share PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
Expand Down
67 changes: 0 additions & 67 deletions share/src/perf_mod.F90

This file was deleted.

File renamed without changes.
17 changes: 17 additions & 0 deletions share/timing/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software for any noncommercial purposes without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following
conditions: The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software. Any
commercial use (including sale) of the software, and derivative development
towards commercial use, requires written permission of the copyright
holder. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
238 changes: 238 additions & 0 deletions share/timing/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
timing_180912: Moved prefix support from perf_mod.F90 to gptl.c
and also added support for setting prefixes in
threaded regions.
[Patrick Worley]
timing_180911: Moved detail to end of timer name when specify
profile_add_detail (so that will not interfere with
planned move of the prefix logic into gptl.c)
[Patrick Worley]
timing_180910: Removed addition of double quotes to timer names in
perf_mod.F90 and added this as an output option in
gptl.c (so internally the names do not have the quotes)
[Patrick Worley]
timing_180822: Fixed perf_mod.F90 bug that prevents PAPI derived events
from being recognized.
[Patrick Worley]
timing_180731: Refactored implementation of append/write modes;
collected and output "on" events for global statistics
[Patrick Worley]
timing_180730: Added support for setting GPTLmaxthreads. Cleaned up white space.
Added SEQUENTIAL to fortran open, to avoid problems on some systems.
Added timing overhead measurement to perf_mod. Fixed errors in
f_wrappers.c in definition of gptlpr_query_append and
gptlpr_XXX_write.
[Patrick Worley (some from Jim Rosinksi)]
timing_180403: Added GPTLstartstop_val(f) to gptl.h, to provide explicit
typing and eliminate compile-time warning for some compilers.
Also do not define the CPP tokens HAVE_COMM_F2C and
HAVE_GETTIMEOFDAY in private.h if they have already been
defined, also eliminating compile-time warnings.
[Patrick Worley]
timing_171028: Backported GPTLstartstop_val from a more recent version
of GPTL, added a callcount parameter, and renamed it
GPTLstartstop_vals. Also added a version for non-null
terminated timing event names (GPTLstartstop_valsf).
Added t_startstop_valsf to perf_mod. Also replaced
all strncpy calls in f_wrapper.c, just to be safe.
[Patrick Worley (but primarily Jim Rosinksi)]
timing_171027: Mitigated against nonmonotonic timing calls by
setting negative deltas to zero in gptl.c .
[Patrick Worley]
timing_160816: Added quotes to timing event names in t_startf and t_stopf
before calling GPTL routines.
[Patrick Worley and Sean Patrick Santos]
timing_161207: Replaced strncpy and snprintf where applied to
non-null-terminated strings, to avoid memory issues
when strncpy and snprintf implementations use strnlen
to check validity of passed in string length parameter.
(Why this causes problems is still a mystery.)
[Patrick Worley and Gautam Bisht]
timing_160320: Added routines t_set_prefixf and t_unset_prefixf.
Setting the prefix adds this to the beginning of all subsequent
timer event names (defined in t_startf/t_stopf).
Also doubling default hash index tablesize to 2048.
[Patrick Worley]
timing_160124: Added option to prefix timer names with detail level. This is
controlled by a new namelist variable (profile_add_detail).
The default is to not enable this option. It is meant to be
used for inspecting the profile detail definitions and
associated logic.
[Patrick Worley]
timing_150903: Changed API to be compatible with NCAR CIME version of timing
library: (a) changed handle argument from integer8 to integer
in t_startf and t_stopf, and disabled use of handles in these
routines until gptl.c can be updated; (b) added MaxThreads
optional argument to t_initf, though it does not do anything
yet.
[Patrick Worley]
timing_150518: Disabled abort when calling GPTL routines before GPTLinitialize
(so can use with Chombo library, for example); changed top
level default from nanotimer to MPI_WTIME.
[Patrick Worley]
timing_150327: Added option to more accurately measure measurement overhead
(incurring additional overhead, so not on by default).
[Patrick Worley]
timing_150217: Added support for enabling/disabling start/stop timers from
perf_mod even when calling GPTL routines directly from C/C++
libraries; increased maximum timer name length.
[Patrick Worley]
timing_141119: Enabled cmake build of timing library.
[Jayesh Krishna]
timing_140805: Disabled GPTL autoinstrumentation, as this conflicts with the
VampirTrace tool. (We do not use the autoinstrumentation
capability.) [Patrick Worley, from B. Jamroz]
timing_140416: Changed Makefile so that .mods and the static library are copied to
LIBROOT
timing_140317: Modified Makefile to deal with shared mpi-serial builds
timing_131108: Added memory retrieval commands for BG/Q [S Mickelson]
timing_131023: Added explicit include path for gptl.h [J Edwards]
timing_130827: added routines supporting non-null terminated timer labels, for use with
with C++ std:string (and more efficient usage with Fortran); also CMake
logic fixes
[Patrick Worley]
timing_130506: Copy all modules to the include directory on install
timing_130417: Made nano time the default timer if available.
timing_130316: Changed declarations of functions used in qsort in gptl.c, to eliminate
error with Cray compiler (and warnings from other compilers)
[Patrick Worley]
timing_130214: NAG port: Put mpif.h include before "save", and don't use
"abort" and "flush" extensions for NAG. [Sean Patrick Santos]
timing_120921: Add code for cmake build, should not have any affect otherwise
timing_120731: Correction in Makefile for serial build [Jim Edwards]
timing_120728: Replace process subset optional parameter in t_prf with
outpe_thispe optional parameter. Change def_perf_outpe_num to 0.
[Patrick Worley]
timing_120717: Retain timestamp on cp in Makefile [Jim Edwards]
timing_120710: Correct issue in Makefile [Jim Edwards]
timing_120709: Change for BGP to measure on compute nodes rather than IO nodes only,
minor Change in Makefile so that gptl can build seperate from csm_share
in cesm [Jim Edwards]
timing_120512: Bug fix in global statistics logic for when a thread has no events
to contribute to the merge (mods to gptl.c)
[Patrick Worley]
timing_120419: Minor changes for mpi-serial compile (jedwards)
timing_120408: Make HAVE_COMM_F2C default to true. (jedwards)
timing_120110: Update to GPTL 4.1 source (mods to gptl.c and GPTLprint_memusage)
[Jim Rosinski (GPTL 4.1), Patrick Worley]
timing_120109: Bug fix (adding shr_kind_i8 to shr_kind_mod list)
timing_111205: Update to gptl 4.0 (introducing CESM customizations);
support for handles in t_startf/t_stopf;
support for restricting output to explicitly named process subsets
[Jim Rosinski (gptl 4.0), Patrick Worley]
timing_111101: Workaround for mpi_rsend issue on cray/gemini
timing_110928: Add a Makefile and build as a library usable by mct and pio
timing_101215: No changes from previous tag other than updating Changelog
timing_101210: Fix interface to cesm build system, add workaround for xlf bug
timing_101202: updated get_memusage and print_memusage from GPTL version 3.7; adds
improved support for MacOS and SLASHPROC
[Jim Rosinski, Chuck Bardeen (integrated by P. Worley)]
timing_091021: update to GPTL version 3.5; rewrite of GPTLpr_summary: much faster, merging
events from all processes and all threads (not just process 0/thread 0);
miscellaneous fixes
[Jim Rosinski (gptl 3.5), Joseph Singh, Patrick Worley]
timing_090929: added explicit support for the GPTL-native token HAVE_MPI (indicating
presence of MPI library)
[Patrick Worley]
timing_081221: restore default assumption that gettimeofday available
timing_081028: bug fix in include order in gptl_papi.c
timing_081026: change in output format to make postprocessing simpler
timing_081024: support for up to one million processes and writing timing files to
subdirectories
timing_081017: updated to gptl version 3_4_2. Changed some defaults.
[Jim Rosinski, Patrick Worley]
timing_080629: added optional parameters perf_outpe_num and perf_outpe_stride to t_prf.
These are used to override the user specified values for timing data
written out before the end of a simulation.
[Patrick Worley]
timing_071213: changed default to disable inline keyword; changed global statistics
logic to avoid problems at scale; moved shr and CAM routine equivalencies
to a new module (in perf_utils.F90); added t_getLogUnit/t_setLogUnit
routines to control Log output in same way as shr_file_get/setLogUnit;
modified GPTLpr logic to support output of timing data during a run
[Patrick Worley]
timing_071023: updated to gptl version 2.16, added support for output of global
statistics; removed dependencies on shr and CAM routines; renamed
gptlutil.c to GPTLutil.c
[Patrick Worley, Jim Rosinski]
timing_071019: modified namelist logic to abort if try to set unknown namelist parameters;
changed default number of reporting processes to 1;
reversed meaning and changed names of CPP tokens to NO_C99_INLINE and NO_VPRINTF
[Patrick Worley]
timing_071010: modified gptl.c to remove the 'inline' specification unless the
CPP token C99 is defined.
[Patrick Worley]
timing_070810: added ChangeLog
updated to latest version of GPTL (from Jim Rosinski)
modified perf_mod.F90:
- added perf_outpe_num and perf_outpe_stride to perf_inparm
namelist to control which processes output timing data
- added perf_papi_enable to perf_inparm namelist to enable
PAPI counters
- added papi_inparm namelist and papi_ctr1,2,3,4 namelist
parameters to specify PAPI counters
[Patrick Worley, Jim Rosinski]
timing_070525: bug fix in gptl.c
- unitialized pointer, testing for null pter
before traversing
[Patrick Worley]
timing_070328: modified perf_mod.F90
- deleted HIDE_MPI cpp token
[Erik Kluzek]
timing_070327: bug fixes in gptl.c
- testing for null pters before traversing
links; added missing type declaration to GPTLallocate for sum
bug fixes in perf_mod.F90
- fixed OMP-related logic, modified settings reporting,
modified to work when namelist input is
missing; moved timer depth logic back into gptl.c
[Patrick Worley]
timing_070308: added perf_mod.F90
- defines all t_xxx entry points - calling gptlxxx directly
and removing all external gptlxxx dependencies,
added detail option as an alternative way to disable
event timing, added runtime selection of timing_disable,
perf_timer, timer_depth_limit, timing_detail_limit,
timing_barrier, perf_single_file via namelist parameters
modified f_wrappers.c
- replaced all t_xxx entry points with gptlxxx entry points,
added new gptlxxx entry points, deleted _fcd support
modified gptl.c
- deleted DISABLE_TIMERS cpp token, modified GPTLpr call
and logic to move some of support for concatenating timing
output into a single file to perf_mod.F90
modified gptl.h
- exposed gptlxxx entry points and to add support for choice
of GPTL timer
modified gptl.inc
- removed t_xxx entry points and expose gptlxxx entry points
[Patrick Worley]
timing_061207: modified gptl.c
- improved event output ordering
[Jim Edwards]
timing_061124: modified gptl.c
- modified GPTLpr to add option to concatenate
all timing data in a single output file, added GPTL_enable
and GPTL_disable as runtime control of event timing,
process 0-only reporting of timing options - unless DEBUG
cpp token defined
modified gptl.h
- redefined GPTLpr parameters
modified f_wrappers.c
- added t_enablef and t_disablef to call GPTL_enable and
GPTL_disable, added t_pr_onef, added string.h include
bug fix in f_wrappers.c
- changed character string size declaration from int to size_t
bug fix in gptl_papi.c
- modified error message - from Jim Edwards
modified private.h
- increased maximum event name length
[Patrick Worley]
timing_061028: modified f_wrappers.c
- deleted dependency on cfort.h
[Patrick Worley]
timing_060524: modified f_wrappers.c
- added support for CRAY cpp token and fixed routine
type declarations
[Patrick Worley]
timing_051212: original subversion version
- see CAM ChangeLog for earlier history
Loading