From 312b168c827bf45e63ec829243cb406d339c065d Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Fri, 1 Nov 2024 11:06:25 -0700 Subject: [PATCH] Adding perfstubs and zerosum The perfstubs, zerosum, and apex submodules have all been added to TAU. PerfStubs will automatically update the git submodule if it hasn't been pulled/init/updated yet. Same for zerosum and apex, but only if -zerosum or -apex are requested. One last change needed to get support for the new python profiling from the perfstubs python support for python 3.12+. Former-commit-id: 9b5e832b75b7901960b84ec7a261711af6a00bb6 --- .gitmodules | 9 ++ Makefile.skel | 5 +- configure | 156 +++++++++++++++++++++++----------- perfstubs | 1 + src/Profile/Makefile.skel | 2 +- src/Profile/TauGenericAPI.cpp | 33 +------ tools/src/perfdmf/Makefile | 2 +- utils/FixMakefile | 5 +- zerosum | 1 + 9 files changed, 130 insertions(+), 84 deletions(-) create mode 160000 perfstubs create mode 160000 zerosum diff --git a/.gitmodules b/.gitmodules index 39ff69e5e..6060604b9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,12 @@ [submodule "apex"] path = apex url = https://github.com/UO-OACISS/apex.git + branch = master +[submodule "perfstubs"] + path = perfstubs + url = https://github.com/UO-OACISS/perfstubs.git + branch = master +[submodule "zerosum"] + path = zerosum + url = https://github.com/UO-OACISS/zerosum.git + branch = main diff --git a/Makefile.skel b/Makefile.skel index c53a98dd7..402900ee5 100644 --- a/Makefile.skel +++ b/Makefile.skel @@ -65,6 +65,9 @@ examples/cthreads examples/fortran examples/f90 $(MPIEXAMPLES) $(PDTEXAMPLE) # APEX Support #APEX#APEX=apex#ENDIF# +# ZeroSum Support +#ZeroSum#ZeroSum=zerosum#ENDIF# + # Trace Reader Library TRACEINPUT=src/TraceInput TRACE2PROFILE=utils/trace2profile @@ -151,7 +154,7 @@ SUBDIR = $(TRACEINPUT) $(BASIC) $(PCXX) $(HPCXX) $(ANSIC) $(VTFCONVERTER) \ $(PTHREAD_WRAPPER) \ $(MEMORYWRAPPER) $(TAUCUDA) $(TAU_CUPTI_AVAIL) $(TAU_ENV) $(TAUOPENCL) \ $(GPIWRAPPER) $(ARMCIWRAPPER) $(DMAPPWRAPPER) $(UGNIWRAPPER) $(CHAPELWRAPPER) $(UPCWRAPPER) \ - $(GOMP_WRAPPER) $(OTF2PROFILE) $(MPC_MPI_WRAPPER) $(APEX) \ + $(GOMP_WRAPPER) $(OTF2PROFILE) $(MPC_MPI_WRAPPER) $(APEX) $(ZeroSum) \ $(SHMEM_WRAPPER) $(PLUGINS) $(LLVM_PLUGIN) \ $(SYSCALL_WRAPPER) diff --git a/configure b/configure index 6708e9121..8a39feb10 100755 --- a/configure +++ b/configure @@ -901,6 +901,7 @@ for arg in "$@"; do echo "-asmdex= ...... Specify a asmdex directory or download." echo "-boost= ....................... Specify location of Boost package." echo "-apex ......................................... Build the APEX package." + echo "-zerosum ................................... Build the ZeroSum package." echo "-mochi ............................ Add MOCHI backend database support." echo "-dyninst= ................... Specify location of DynInst package." echo "-dyninstinc= ............ Specify location of DynInst include dir." @@ -1376,6 +1377,7 @@ sqlite3dir= #caliper=no #caliperdir= apex=no +zerosum=no dyninst=no dyninstinc=no dyninstlib=no @@ -2274,6 +2276,11 @@ for arg in "$@"; do shift ;; + -zerosum) + zerosum=yes + shift + ;; + -boost=download) boost=yes echo "Downloading Boost..." @@ -3444,6 +3451,13 @@ for arg in "$@"; do esac done +# make sure we have the perfstubs headers +if [ ! -d perfstubs ] ; then + if [ ! -f perfstubs/CMakeLists.txt ] ; then + git submodule update --init --recursive perfstubs + fi +fi + if [ "x$python_ver_specified" = "xno" -a "x$pythoninc" != "x" ]; then if [ -f $pythoninc/../bin/python ]; then pythonintv=$pythoninc/../bin/python @@ -11603,55 +11617,94 @@ EOF /bin/rm -f vttest.cpp vttest.o fi -build_apex() -{ - if [ $apex = yes ] ; then - cd ${START_DIR} - check_cmake 3 20 "APEX" - result=$? - if [ $result -eq 1 ]; then - echo 'ERROR: cmake version 3.20 or higher required to build APEX.' - exit 1; - fi - echo "NOTE: Building APEX" - if [ ! -d apex ] ; then - git submodule update --init --recursive - fi - apex_include_file=apex/apex.mk - rm -f ${apex_include_file} - touch ${apex_include_file} - echo "CC=${c_compiler}" >> ${apex_include_file} - echo "CXX=${cxx_compiler}" >> ${apex_include_file} - echo "PREFIX=${targetdir}" >> ${apex_include_file} - echo "TAUARCH=${architecture}" >> ${apex_include_file} - echo "TAUOPTIONS=${tauoptions}" >> ${apex_include_file} - if [ ! "x${bfddir}" = "x" ] ; then - echo "BFDOPT=-DAPEX_WITH_BFD=TRUE -DBFD_ROOT=${bfddir}" >> ${apex_include_file} - else - if [ ${bfd_worked} = "yes" ] ; then - echo 'BFDOPT=-DAPEX_WITH_BFD=TRUE' >> ${apex_include_file} - fi - fi - if [ ! "x${omptlib}" = "x" ] ; then - echo "TAUOMPT=-DAPEX_WITH_OMPT=TRUE" >> ${apex_include_file} - fi - if [ "${cuda}" = "yes" ] ; then - echo "TAUCUDA=-DAPEX_WITH_CUDA=TRUE -DCUDAToolkit_ROOT=${cudadir}" >> ${apex_include_file} - fi - if [ "${rocm}" = "yes" ] ; then - echo "TAUHIP=-DAPEX_WITH_HIP=TRUE" >> ${apex_include_file} - fi - if [ "${level_zero}" = "yes" ] ; then - echo "TAUSYCL=-DAPEX_WITH_LEVEL0=TRUE" >> ${apex_include_file} - fi - if [ "${mpi}" = "yes" ] ; then - echo "TAUMPI=-DAPEX_WITH_MPI=TRUE" >> ${apex_include_file} +build_apex() { + cd ${START_DIR} + check_cmake 3 20 "APEX" + result=$? + if [ $result -eq 1 ]; then + echo 'ERROR: cmake version 3.20 or higher required to build APEX.' + exit 1; + fi + echo "NOTE: Building APEX" + if [ ! -d apex ] ; then + git submodule update --init --recursive apex + fi + apex_include_file=apex/apex.mk + rm -f ${apex_include_file} + touch ${apex_include_file} + echo "CC=${c_compiler}" >> ${apex_include_file} + echo "CXX=${cxx_compiler}" >> ${apex_include_file} + echo "PREFIX=${targetdir}" >> ${apex_include_file} + echo "TAUARCH=${architecture}" >> ${apex_include_file} + echo "TAUOPTIONS=${tauoptions}" >> ${apex_include_file} + if [ ! "x${bfddir}" = "x" ] ; then + echo "BFDOPT=-DAPEX_WITH_BFD=TRUE -DBFD_ROOT=${bfddir}" >> ${apex_include_file} + else + if [ ${bfd_worked} = "yes" ] ; then + echo 'BFDOPT=-DAPEX_WITH_BFD=TRUE' >> ${apex_include_file} fi - echo "TAUOPENCL=-DAPEX_WITH_OPENCL=TRUE" >> ${apex_include_file} - cp etc/Makefile.apex apex/Makefile - fixmakeargs="$fixmakeargs APEX " - make -C apex clean -fi + fi + if [ ! "x${omptlib}" = "x" ] ; then + echo "TAUOMPT=-DAPEX_WITH_OMPT=TRUE" >> ${apex_include_file} + fi + if [ "${cuda}" = "yes" ] ; then + echo "TAUCUDA=-DAPEX_WITH_CUDA=TRUE -DCUDAToolkit_ROOT=${cudadir}" >> ${apex_include_file} + fi + if [ "${rocm}" = "yes" ] ; then + echo "TAUHIP=-DAPEX_WITH_HIP=TRUE" >> ${apex_include_file} + fi + if [ "${level_zero}" = "yes" ] ; then + echo "TAUSYCL=-DAPEX_WITH_LEVEL0=TRUE" >> ${apex_include_file} + fi + if [ "${mpi}" = "yes" ] ; then + echo "TAUMPI=-DAPEX_WITH_MPI=TRUE" >> ${apex_include_file} + fi + echo "TAUOPENCL=-DAPEX_WITH_OPENCL=TRUE" >> ${apex_include_file} + cp etc/Makefile.apex apex/Makefile + fixmakeargs="$fixmakeargs APEX " + make -C apex clean + make -C apex +} + +build_zerosum() { + cd ${START_DIR} + #check_cmake 3 20 "ZeroSum" + #result=$? + #if [ $result -eq 1 ]; then + # echo 'ERROR: cmake version 3.20 or higher required to build ZeroSum.' + # exit 1; + #fi + echo "NOTE: Building ZeroSum" + if [ ! -d zerosum ] ; then + git submodule update --init --recursive zerosum + fi + zerosum_include_file=zerosum/zerosum.mk + rm -f ${zerosum_include_file} + touch ${zerosum_include_file} + echo "CC=${c_compiler}" >> ${zerosum_include_file} + echo "CXX=${cxx_compiler}" >> ${zerosum_include_file} + echo "PREFIX=${targetdir}" >> ${zerosum_include_file} + echo "TAUARCH=${architecture}" >> ${zerosum_include_file} + echo "TAUOPTIONS=${tauoptions}" >> ${zerosum_include_file} + if [ ! "x${omptlib}" = "x" ] ; then + echo "TAUOMPT=-DZeroSum_WITH_OMPT=TRUE" >> ${zerosum_include_file} + fi + if [ "${cuda}" = "yes" ] ; then + echo "TAUCUDA=-DZeroSum_WITH_CUDA=TRUE -DCUDAToolkit_ROOT=${cudadir}" >> ${zerosum_include_file} + fi + if [ "${rocm}" = "yes" ] ; then + echo "TAUHIP=-DZeroSum_WITH_HIP=TRUE" >> ${zerosum_include_file} + fi + if [ "${level_zero}" = "yes" ] ; then + echo "TAUSYCL=-DZeroSum_WITH_SYCL=TRUE" >> ${zerosum_include_file} + fi + if [ "${mpi}" = "yes" ] ; then + echo "TAUMPI=-DZeroSum_WITH_MPI=TRUE" >> ${zerosum_include_file} + fi + cp etc/Makefile.zerosum zerosum/Makefile + fixmakeargs="$fixmakeargs ZeroSum " + make -C zerosum clean + make -C zerosum } if [ $java = yes ] ; then @@ -13500,7 +13553,12 @@ if [ $ompt = yes -a $install_ompt = yes -a -r ${libomp_ossdir_static}/lib${libom fi # doing this now, so that tauoptions is defined. -build_apex +if [ $apex = yes ] ; then + build_apex +fi +if [ $zerosum = yes ] ; then + build_zerosum +fi # Save the FixMakefile args # Clear any old data diff --git a/perfstubs b/perfstubs new file mode 160000 index 000000000..267649733 --- /dev/null +++ b/perfstubs @@ -0,0 +1 @@ +Subproject commit 2676497330a8681ab8de333e4b9c9f77ff888abe diff --git a/src/Profile/Makefile.skel b/src/Profile/Makefile.skel index a73976b8b..12f65b2c4 100644 --- a/src/Profile/Makefile.skel +++ b/src/Profile/Makefile.skel @@ -688,7 +688,7 @@ TauADIOS.o : TauADIOS.cpp $(HDRS) $(CXX) $(CXXFLAGS) $(TAU_MPI_INCLUDE) -c $(@:.o=.cpp) TauGenericAPI.o : TauGenericAPI.cpp $(HDRS) - $(CXX) $(CXXFLAGS) $(TAU_MPI_INCLUDE) -c $(@:.o=.cpp) + $(CXX) $(CXXFLAGS) $(TAU_MPI_INCLUDE) -I$(TAUROOT)/perfstubs -c $(@:.o=.cpp) TauCaliper.o : TauCaliper.cpp $(HDRS) $(CXX) $(CXXFLAGS) -c $(@:.o=.cpp) diff --git a/src/Profile/TauGenericAPI.cpp b/src/Profile/TauGenericAPI.cpp index 8a95f07b3..f8680b2a8 100644 --- a/src/Profile/TauGenericAPI.cpp +++ b/src/Profile/TauGenericAPI.cpp @@ -37,40 +37,11 @@ using namespace std; #include "Profile/UserEvent.h" #include "Profile/TauMetrics.h" #include "Profile/TauMetaData.h" +// from perfstubs/perfstubs_api +#include "perfstubs_api/tool.h" extern "C" { -/* Data Structures */ - - typedef struct ps_tool_timer_data - { - unsigned int num_timers; - unsigned int num_threads; - unsigned int num_metrics; - char **timer_names; - char **metric_names; - double *values; - } ps_tool_timer_data_t; - - typedef struct ps_tool_counter_data - { - unsigned int num_counters; - unsigned int num_threads; - char **counter_names; - double *num_samples; - double *value_total; - double *value_min; - double *value_max; - double *value_sumsqr; - } ps_tool_counter_data_t; - - typedef struct ps_tool_metadata - { - unsigned int num_values; - char **names; - char **values; - } ps_tool_metadata_t; - /* Function pointers */ void ps_tool_initialize(void) { diff --git a/tools/src/perfdmf/Makefile b/tools/src/perfdmf/Makefile index bd8673ae0..ebefe4701 100644 --- a/tools/src/perfdmf/Makefile +++ b/tools/src/perfdmf/Makefile @@ -40,7 +40,7 @@ all: $(TARGET) build: bin/perfdmf.jar override: build - JAVAC=javac -Xlint:unchecked -source 1.8 -target 1.8 + JAVAC=javac -source 1.8 -target 1.8 #JAVAC=javac #all: perfdmf.jar javadoc rebuilddb buildtest simple diff --git a/utils/FixMakefile b/utils/FixMakefile index 6ecaae371..f2640d360 100755 --- a/utils/FixMakefile +++ b/utils/FixMakefile @@ -1077,7 +1077,7 @@ case $1 in echo NOTE: Using the TAU Level Zero Profiling Interface echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout ;; - + LEVEL_ZERO_METRICS) echo NOTE: Using the TAU Level Zero Metrics Interface echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout @@ -2156,6 +2156,9 @@ case $1 in APEX) echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout ;; + ZeroSum) + echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout + ;; BOOST) echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout ;; diff --git a/zerosum b/zerosum new file mode 160000 index 000000000..b479885c0 --- /dev/null +++ b/zerosum @@ -0,0 +1 @@ +Subproject commit b479885c01bc216e8664aceace0396cc9c190d59