Commit 580be9ee authored by Philip Carns's avatar Philip Carns
Browse files

updated to inspect symbol names when linking and decide whether to

enable darshan or not based on the presence of MPI and/or PMPI symbols;
mpicc only so far

git-svn-id: 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 32dbe422
......@@ -251,18 +251,47 @@ if [ "$linking" = yes ] ; then
# prepend the path for the shared libraries to the library list
mpilibs="$C_LINKPATH_SHL$libdir $mpilibs"
# check to see if the command line refers to any profilers that might
# use PMPI.
profiler_check=`echo "${allargs[@]}" | ${DARSHAN_BIN_PATH}/`
if [ "$profiler_check" = "" ] ; then
$Show $CC "${allargs[@]}" -L${DARSHAN_LIB_PATH} \
${CP_ZLIB_LINK_FLAGS} -ldarshan-mpi-io -lz -I$includedir $CFLAGS \
${CP_WRAPPERS} $LDFLAGS -L$libdir -L$opalibdir $mpilibs \
# it looks like the user wants to use another tool with PMPI; don't
# link in Darshan PMPI wrappers (disables Darshan)
$Show $CC "${allargs[@]}" -I$includedir $CFLAGS $LDFLAGS -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS
# Trial run to generate a symbol listing. We only enable Darshan if:
# a) MPI is used
# b) PMPI is _not_ used
# We want Darshan to get out of the way if the user is doing a runtime
# test in configure (in which case MPI objects break the executable) or
# if the user is using another PMPI based tool
stock_link_cmd="$CC ${allargs[@]} -I$includedir $CFLAGS $LDFLAGS -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS"
darshan_link_cmd="$CC ${allargs[@]} -L${DARSHAN_LIB_PATH} ${CP_ZLIB_LINK_FLAGS} -ldarshan-mpi-io -lz -I$includedir $CFLAGS ${CP_WRAPPERS} $LDFLAGS -L$libdir -L$opalibdir $mpilibs $MPI_OTHERLIBS -L${DARSHAN_LIB_PATH} -ldarshan-posix"
# create a temporary file
# generate a map of the symbol names
$stock_link_cmd -Wl,-Map,$tmpfile $LDFLAGS -o /dev/null >& /dev/null
# is MPI in there?
grep MPI $tmpfile >& /dev/null
# is PMPI in there (except for the mpich library itself)?
grep \(PMPI $tmpfile | grep -v mpich.cnk.a >& /dev/null
rm $tmpfile >& /dev/null
# disable darshan if the executable is not an MPI program (this feature
# mainly allows runtime configure tests to work
if [ $rc_mpi -eq 0 ] ; then
# disable darshan if something else is already using PMPI; we don't
# want to cause any symbol conflicts
if [ $rc_pmpi -ne 0 ] ; then
$Show $darshan_link_cmd
# otherwise use the normal command line
if [ "$used_darshan" = "0" ] ; then
$Show $stock_link_cmd
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment