Skip to content

Commit

Permalink
Reporting tcmalloc preload error when detected. We could probably aut…
Browse files Browse the repository at this point in the history
…omatically detect that tcmalloc is a dependency and preload it automatically...
  • Loading branch information
khuck committed Feb 7, 2024
1 parent 1f1950a commit 296e07e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/apex/CMakeLists_standalone.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ if(APEX_WITH_PERFETTO)
include_directories(${APEX_SOURCE_DIR}/src/perfetto_sdk)
endif()

if(APEX_WITH_TCMALLOC)
set(TCMALLOC_SOURCE tcmalloc_hooks.cpp)
endif(APEX_WITH_TCMALLOC)

# Try to keep this in alphabetical order
SET(all_SOURCE
apex_preload.cpp
Expand Down Expand Up @@ -92,7 +96,7 @@ random.cpp
${SENSOR_SOURCE}
simulated_annealing.cpp
task_identifier.cpp
tcmalloc_hooks.cpp
${TCMALLOC_SOURCE}
${tau_SOURCE}
thread_instance.cpp
threadpool.cpp
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/apex_exec
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ if [ $mpi = yes ]; then
testme=${BASEDIR}/${LIBDIR}/${APEX_LIBRARY_NAME}_mpi${SHLIBX}
if [ -f ${testme} ]; then
export MPI_LIB=:${testme}
export MPI_LIB2=${testme}
fi
fi
if [ $cuda = yes ] || [ $monitor_gpu = yes ]; then
Expand Down Expand Up @@ -702,6 +703,12 @@ else
unset DYLD_INSERT_LIBRARIES
rm -f ./.gdbcmds
if [ ${retval} != 0 ] ; then
echo "Error ${retval}!"
count=`ldd ${MPI_LIB2} | grep -c tcmalloc`
if [ ${count} -eq 1 ] ; then
preloadme=`ldd ${MPI_LIB2} | grep tcmalloc | awk '{ print $3 }'`
echo "If you got some kind of tcmalloc error, please preload the dependent tcmalloc shared object library with '--apex:preload ${preloadme}'"
fi
exit ${retval}
fi
fi
Expand Down

0 comments on commit 296e07e

Please sign in to comment.