diff --git a/Makefile.skel b/Makefile.skel index 402900ee5..3e32c39b1 100644 --- a/Makefile.skel +++ b/Makefile.skel @@ -68,6 +68,9 @@ examples/cthreads examples/fortran examples/f90 $(MPIEXAMPLES) $(PDTEXAMPLE) # ZeroSum Support #ZeroSum#ZeroSum=zerosum#ENDIF# +# PerfStubs Support +#PerfStubs#PerfStubs=perfstubs#ENDIF# + # Trace Reader Library TRACEINPUT=src/TraceInput TRACE2PROFILE=utils/trace2profile @@ -154,7 +157,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) $(ZeroSum) \ + $(GOMP_WRAPPER) $(OTF2PROFILE) $(MPC_MPI_WRAPPER) $(APEX) $(ZeroSum) $(PerfStubs) \ $(SHMEM_WRAPPER) $(PLUGINS) $(LLVM_PLUGIN) \ $(SYSCALL_WRAPPER) diff --git a/configure b/configure index 8a39feb10..263c4e5c4 100755 --- a/configure +++ b/configure @@ -11668,12 +11668,12 @@ build_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 + 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 @@ -11707,6 +11707,35 @@ build_zerosum() { make -C zerosum } +build_perfstubs() { + 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 PerfStubs with Python3.12+ support" + if [ ! -d perfstubs ] ; then + git submodule update --init --recursive perfstubs + fi + perfstubs_include_file=perfstubs/perfstubs.mk + Python3_BIN_DIR=`dirname ${pythonintv}` + Python3_ROOT_DIR=`dirname ${Python3_BIN_DIR}` + rm -f ${perfstubs_include_file} + touch ${perfstubs_include_file} + echo "CC=${c_compiler}" >> ${perfstubs_include_file} + echo "CXX=${cxx_compiler}" >> ${perfstubs_include_file} + echo "PREFIX=${targetdir}" >> ${perfstubs_include_file} + echo "TAUARCH=${architecture}" >> ${perfstubs_include_file} + echo "TAUOPTIONS=${tauoptions}" >> ${perfstubs_include_file} + echo "TAUPYTHON=-DPERFSTUBS_WITH_PYTHON=TRUE -DPython3_ROOT_DIR=${Python3_ROOT_DIR} -DPython3_VERSION_MINOR=${Python3_VERSION_MINOR}" >> ${perfstubs_include_file} + cp etc/Makefile.perfstubs perfstubs/Makefile + fixmakeargs="$fixmakeargs PerfStubs " + make -C perfstubs clean + make -C perfstubs +} + if [ $java = yes ] ; then fixmakeargs="$fixmakeargs JAVA jdkdir=$jdkdir" fi @@ -13559,6 +13588,16 @@ fi if [ $zerosum = yes ] ; then build_zerosum fi +if [ $python3 = yes ] ; then + python_version=`${pythonintv} --version | awk '{print $NF}'` + version_array=( ${python_version//./ } ) + if [ "${version_array[0]}" == 3 ] ; then + if [ "${version_array[1]}" -gt 11 ] ; then + Python3_VERSION_MINOR=${version_array[1]} + build_perfstubs + fi + fi +fi # Save the FixMakefile args # Clear any old data diff --git a/etc/Makefile.perfstubs b/etc/Makefile.perfstubs new file mode 100644 index 000000000..2746d3dc9 --- /dev/null +++ b/etc/Makefile.perfstubs @@ -0,0 +1,14 @@ +include perfstubs.mk + +build/CMakeCache.txt: + cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_INSTALL_PREFIX=$(PREFIX)/$(TAUARCH) $(TAUPYTHON) $(TAUCFLAGS) $(TAUCXXFLAGS) + +all : build/CMakeCache.txt + $(MAKE) -C build all + +install: all + $(MAKE) -C build install + +clean: + rm -rf build + diff --git a/etc/Makefile.zerosum b/etc/Makefile.zerosum new file mode 100644 index 000000000..2c8b186ce --- /dev/null +++ b/etc/Makefile.zerosum @@ -0,0 +1,14 @@ +include zerosum.mk + +build/CMakeCache.txt: + cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DZeroSum_BUILD_TESTS=FALSE -DCMAKE_INSTALL_PREFIX=$(PREFIX)/$(TAUARCH) $(TAUOMPT) $(TAUCFLAGS) $(TAUCXXFLAGS) $(TAUCUDA) $(TAUHIP) $(TAUSYCL) + +all : build/CMakeCache.txt + $(MAKE) -C build all + +install: all + $(MAKE) -C build install + +clean: + rm -rf build + diff --git a/examples/python/python_event_filter.json b/examples/python/python_event_filter.json new file mode 100644 index 000000000..45905de6a --- /dev/null +++ b/examples/python/python_event_filter.json @@ -0,0 +1,17 @@ +{ + "exclude_timers comment": + "Use this entry as an array of regular expression strings for timers to exclude (all others will be included). Remove the '_disabled' part of the name to enable it.", + "exclude_timers_disabled": ["_find_and_load.*"], + + "exclude_files comment": + "Use this entry as an array of regular expression strings for files/paths to exclude (all others will be included). Remove the '_disabled' part of the name to enable it.", + "exclude_files": ["/dev/null ; then python_interpreter=python3 fi +python_module_name=tau_python_wrapper +python_version=`${python_interpreter} --version | awk '{print $NF}'` +version_array=( ${python_version//./ } ) +if [ "${version_array[0]}" == 3 ] ; then + if [ "${version_array[1]}" -gt 11 ] ; then + python_module_name=pstubs + fi +fi if [ "$scriptname" == "tau_python" ] ; then python_wrapper=true @@ -106,6 +114,8 @@ usage() if [ $python_wrapper = "true" ] ; then echo " -tau-python-args=<\"arguments\"> Arguments to the python interpreter" echo " -tau-python-interpreter=<\"python\"> name of python interpreter (e.g, python, python3.6)" + echo " -tau-python-filter=<\"filename\"> name of selective measurement JSON file" +fi echo " -adios2 Write output to ADIOS2 archive" echo " -adios2_trace Write trace output to ADIOS2 archive" echo " -monitoring Periodically read available OS/HW monitoring counters" @@ -115,7 +125,6 @@ if [ $python_wrapper = "true" ] ; then echo " -disable-kokkos Disable Kokkos profiling (removes fences that hurt performance)" echo " -ugni Track Cray UGNI network library functions." echo " -chapel Track Cray Chapel network atomics library functions." -fi echo "" echo "Notes:" echo " Defaults if unspecified: -T $default_tags" @@ -695,6 +704,18 @@ for arg in "$@" ; do exit 1 fi ;; + -tau-python-filter=*) + if [ $python_wrapper = "true" ] ; then + myarg=`echo $arg | sed 's/-tau-python-filter=//'` + python_filter="$myarg" + export PERFSTUBS_PYTHON_FILTER_FILENAME=$python_filter + save_arg $arg + shift + else + echo "Unknown option: $arg" >&2 + exit 1 + fi + ;; -ugni) track_ugni=true save_arg $arg @@ -837,7 +858,7 @@ else fi python_bindings=`echo $theBinding | sed -e 's/shared/bindings/'` -export PYTHONPATH=$BASEDIR/lib/$python_bindings:$PYTHONPATH +export PYTHONPATH=${BASEDIR}/lib:$BASEDIR/lib/$python_bindings:$PYTHONPATH if [ "x$LD_LIBRARY_PATH" = "x" ] ; then TAUEX_LD_LIBRARY_PATH=$BASEDIR/lib/$theBinding:$BASEDIR/lib @@ -1416,9 +1437,9 @@ else $dryrun $python_interpreter $py_interp_args -m tau_pyspark_wrapper "$@" elif $python_wrapper ; then if [ $python_launch_module = "true" ] ; then - $dryrun $python_interpreter $py_interp_args -m tau_python_wrapper -m $python_m_arg "$@" + $dryrun $python_interpreter $py_interp_args -m ${python_module_name} -m $python_m_arg "$@" else - $dryrun $python_interpreter $py_interp_args -m tau_python_wrapper "$@" + $dryrun $python_interpreter $py_interp_args -m ${python_module_name} "$@" fi retval=$? elif $use_ptts ; then diff --git a/utils/FixMakefile b/utils/FixMakefile index f2640d360..48d0a5ba4 100755 --- a/utils/FixMakefile +++ b/utils/FixMakefile @@ -2159,6 +2159,9 @@ case $1 in ZeroSum) echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout ;; + PerfStubs) + echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout + ;; BOOST) echo "s/#$1#\(.*\)/$bs\1#$1#/g" >> $sedout ;;