|
13 | 13 |
|
14 | 14 | set -euo pipefail |
15 | 15 |
|
16 | | -# ROCm >= 7.14 distributes the full ROCm stack (including rocJPEG and mesa) |
17 | | -# as pip wheels (_rocm_sdk_core / _rocm_sdk_devel site-packages). In that case |
18 | | -# librocjpeg.so, rocjpeg.h, and the AMD VA-API backend driver (mesa) are all |
19 | | -# bundled inside _rocm_sdk_core — no separate dnf install needed. |
20 | | - |
21 | | -# Check if librocjpeg is already available via the ROCm >= 7.14 pip-wheel layout |
22 | | -# (_rocm_sdk_core / _rocm_sdk_devel under site-packages). In that layout AMD |
23 | | -# bundles mesa (the VA-API DRI driver) inside _rocm_sdk_core, so no separate |
24 | | -# dnf install of mesa-amdgpu-va-drivers is needed — only the base libva soname. |
25 | | -# |
26 | | -# NOTE: we intentionally do NOT match /opt/rocm/lib/librocjpeg.so* here. If |
27 | | -# librocjpeg was installed via the ROCm <= 7.2 system RPM path it may be |
28 | | -# present at /opt/rocm but mesa-amdgpu-va-drivers may not be — they are |
29 | | -# separate packages and must be installed together. Let the else branch handle |
30 | | -# that case so it always installs the full VA-API stack. |
| 16 | +# Skip if rocjpeg is already installed (e.g. via the ROCm pip-wheel distribution). |
31 | 17 | if python3 -c " |
32 | 18 | import glob, sys |
33 | | -# Only the pip-wheel layout bundles mesa alongside librocjpeg. |
34 | | -hits = glob.glob('/opt/conda/**/librocjpeg.so*', recursive=True) |
35 | | -sys.exit(0 if hits else 1) |
| 19 | +found = (glob.glob('/opt/rocm/include/rocjpeg/rocjpeg.h') or |
| 20 | + glob.glob('/opt/conda/**/rocjpeg.h', recursive=True)) |
| 21 | +sys.exit(0 if found else 1) |
36 | 22 | " 2>/dev/null; then |
37 | | - echo "librocjpeg already present via ROCm pip-wheel install; skipping dnf install." |
38 | | - # libva is bundled inside _rocm_sdk_core/lib/rocm_sysdeps/lib/ and |
39 | | - # librocjpeg's own RPATH resolves it from there — no system install needed. |
40 | | -else |
41 | | - # ROCm <=7.2 system RPM path. |
42 | | - # rocjpeg-devel's RPM dependencies pull in libva and mesa VA drivers automatically. |
43 | | - dnf install -y rocjpeg-devel |
| 23 | + echo "rocjpeg already installed; skipping dnf install." |
| 24 | + exit 0 |
| 25 | +fi |
| 26 | + |
| 27 | +# Install from the ROCm dnf repo. |
| 28 | +# mesa-amdgpu-va-drivers is declared as an RPM dependency of rocjpeg but may |
| 29 | +# not be available as a standalone dnf package (it is installed via |
| 30 | +# amdgpu-install as part of the GPU driver stack). Fall back to rpm --nodeps |
| 31 | +# if the regular dnf install fails for that reason. |
| 32 | +if ! dnf install -y rocjpeg rocjpeg-devel; then |
| 33 | + # Ensure the 'dnf download' subcommand is available. |
| 34 | + dnf install -y "dnf-command(download)" 2>/dev/null || dnf install -y dnf-plugins-core |
| 35 | + tmpdir=$(mktemp -d) |
| 36 | + dnf download --destdir "$tmpdir" rocjpeg rocjpeg-devel |
| 37 | + rpm -Uvh --nodeps "$tmpdir"/*.rpm |
| 38 | + rm -rf "$tmpdir" |
44 | 39 | fi |
0 commit comments