Skip to content

HIPStdPar: add -Wl,-rpath next to -L$(TBB_LIBDIR) in MixAndMatch std_cpu_gpu - #192

Open
dannybaths wants to merge 1 commit into
amd:mainfrom
dannybaths:hipstdpar-mixandmatch-tbb-rpath
Open

HIPStdPar: add -Wl,-rpath next to -L$(TBB_LIBDIR) in MixAndMatch std_cpu_gpu#192
dannybaths wants to merge 1 commit into
amd:mainfrom
dannybaths:hipstdpar-mixandmatch-tbb-rpath

Conversation

@dannybaths

@dannybaths dannybaths commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

What

HIPStdPar/CXX/MixAndMatch/std_cpu_gpu/Makefile passes the TBB directory to the
linker with -L only:

$(HIPCC) ... -o $@ -L$(TBB_LIBDIR) ${LIBS} -ltbb

-L is a link-time search path. It does not end up in the binary, so the dynamic
loader has no idea where TBB lives. This change adds the matching rpath:

$(HIPCC) ... -o $@ -L$(TBB_LIBDIR) -Wl,-rpath,$(TBB_LIBDIR) ${LIBS} -ltbb

Why

On a machine with no TBB in the default loader path, the test links without
complaint and then fails to start:

./final: error while loading shared libraries: libtbb.so.12: cannot open shared object file

The Makefile already detects TBB and already knows the directory, including the
copy ROCm ships under lib/rocprofiler-systems, which is not on the default
loader path. Nothing else is needed; the directory just has to be recorded in the
binary as well as used at link time.

Validation

MI300A / gfx942, ROCm with HIPStdPar. Focused run on upstream main (20e93223):

git clone https://github.com/amd/HPCTrainingExamples.git
cd HPCTrainingExamples/tests
export HSA_XNACK=1
export ROCM_GPU=gfx942
rm -rf build && cmake . -B build
ctest -V -R '^HIPStdPar_MixAndMatch_CpuGpu$' --test-dir build

Unpatched upstream: 1/1 FAIL. The binary records no RUNPATH; ldd reports
libtbb.so.12 => not found; CTest fails at launch with the loader error above.

With this change: 1/1 PASS. Example success marker:

RUNPATH  [<rocm>/lib/rocprofiler-systems]
StdParGpu Executor took 473 ms

AAC7 proof: current-main CTest on ROCm 10.0.0 — unpatched FAIL, patched PASS.

AAC6 no-regression: MI300A, Lmod rocm/7.14.0, Slurm job 19740 on
ppac-pl1-s24-16 — 1/1 PASS (StdParGpu Executor took 473 ms).

…cpu_gpu

Signed-off-by: Daniele Bagni <30289343+dannybaths@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant