Skip to content

Commit

Permalink
Fix IFS
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Applencourt committed Sep 11, 2023
1 parent 6a66402 commit ca01150
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions xprof/xprof.sh.erb.in
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ whichlib() {
# -> /usr/lib32/libstdc++.so.6

# In OpenSUSE ldconfig, is in '/sbin'.
echo $whichlib_cached |
echo "$whichlib_cached" |
awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \
match($1, "^lib") && match($1, p) { print header "/" $1}'
if [ $debug = true ]; then
Expand All @@ -210,18 +210,15 @@ whichlib() {
}

whichlib64_head() {
# This function return the first lib64 found
{
set +o pipefail
unset IFS
for lib in $(whichlib $1)
do
if objdump -a $lib | grep -q 64; then
if objdump -f $lib | grep architecture | cut -d',' -f1 | grep -q 64; then
echo $lib
break
fi
done
}
set -o pipefail
}

# > unset FOO ; thapi_export FOO 1 ; echo $FOO
Expand Down Expand Up @@ -391,31 +388,33 @@ preload_lib_tracers() {

IFS=","
if [[ "$traced_ranks" == "-1" ]] || [[ "$IFS$traced_ranks$IFS" =~ "$IFS$(mpi_rank_id)$IFS" ]]; then
unset IFS
<% if languages.include?("omp") %>
thapi_export LTTNG_UST_OMP_INTEL 1
thapi_export OMP_TOOL_LIBRARIES $libdir/libTracerOMPT.so
thapi_export LTTNG_UST_OMP_INTEL 1
thapi_export OMP_TOOL_LIBRARIES $libdir/libTracerOMPT.so
<% end %>
<% if languages.include?("cl") %>
<%= print_loader_logic("opencl","libOpenCL","libTracerOpenCL")%>
<% end %>
<% if languages.include?("ze") %>
if [ $profile = true ]; then
export LTTNG_UST_ZE_PROFILE=1
thapi_export LTTNG_UST_ZE_PARANOID_DRIFT 1
fi
if [ $profile = true ]; then
export LTTNG_UST_ZE_PROFILE=1
thapi_export LTTNG_UST_ZE_PARANOID_DRIFT 1
fi
<%= print_loader_logic("ze","libze_loader","libTracerZE")%>
<% end %>
<% if languages.include?("cuda") %>
if [ $profile = true ]; then
export LTTNG_UST_CUDA_PROFILE=1
fi
if [ $profile = true ]; then
export LTTNG_UST_CUDA_PROFILE=1
fi
<%= print_loader_logic("cuda","libcuda","libTracerCUDA")%>
<% end %>
<% if languages.include?("hip") %>
<%= print_loader_logic("hip","libamdhip64","libTracerHIP")%>
<% end %>
else
unset IFS
fi
unset IFS
}

local_master_epilogue() {
Expand Down

0 comments on commit ca01150

Please sign in to comment.