Skip to content

Commit

Permalink
Adding perfstubs and zerosum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
khuck committed Nov 1, 2024
1 parent bb545c4 commit 312b168
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 84 deletions.
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion Makefile.skel
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
156 changes: 107 additions & 49 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ for arg in "$@"; do
echo "-asmdex=<dir | download> ...... Specify a asmdex directory or download."
echo "-boost=<dir> ....................... 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=<dir> ................... Specify location of DynInst package."
echo "-dyninstinc=<dir> ............ Specify location of DynInst include dir."
Expand Down Expand Up @@ -1376,6 +1377,7 @@ sqlite3dir=
#caliper=no
#caliperdir=
apex=no
zerosum=no
dyninst=no
dyninstinc=no
dyninstlib=no
Expand Down Expand Up @@ -2274,6 +2276,11 @@ for arg in "$@"; do
shift
;;

-zerosum)
zerosum=yes
shift
;;

-boost=download)
boost=yes
echo "Downloading Boost..."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions perfstubs
Submodule perfstubs added at 267649
2 changes: 1 addition & 1 deletion src/Profile/Makefile.skel
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 2 additions & 31 deletions src/Profile/TauGenericAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tools/src/perfdmf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion utils/FixMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
;;
Expand Down
1 change: 1 addition & 0 deletions zerosum
Submodule zerosum added at b47988

0 comments on commit 312b168

Please sign in to comment.