x
This commit is contained in:
+12
-10
@@ -179,24 +179,26 @@ RUN set -ex && \
|
||||
for pkg in hipblaslt hiprtc; do \
|
||||
cfg_dir="/opt/rocm/lib/cmake/${pkg}"; \
|
||||
mkdir -p "${cfg_dir}" && \
|
||||
printf 'set(%s_FOUND TRUE)\nset(%s_VERSION "7.2.1")\nif(NOT TARGET hip::%s)\n add_library(hip::%s INTERFACE IMPORTED)\n set_target_properties(hip::%s PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "/opt/rocm/include")\nendif()\nif(NOT TARGET %s::%s)\n add_library(%s::%s ALIAS hip::%s)\nendif()\nif(NOT TARGET roc::%s)\n add_library(roc::%s ALIAS hip::%s)\nendif()\n' \
|
||||
printf 'set(%s_FOUND TRUE)\nset(%s_VERSION "7.2.1")\nif(NOT TARGET hip::%s)\n add_library(hip::%s INTERFACE IMPORTED)\n set_target_properties(hip::%s PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "/opt/rocm/include")\nendif()\nif(NOT TARGET %s::%s)\n add_library(%s::%s ALIAS hip::%s)\nendif()\n' \
|
||||
"${pkg}" "${pkg}" "${pkg}" "${pkg}" "${pkg}" \
|
||||
"${pkg}" "${pkg}" "${pkg}" "${pkg}" "${pkg}" \
|
||||
"${pkg}" "${pkg}" \
|
||||
> "${cfg_dir}/${pkg}-config.cmake" && \
|
||||
echo "${pkg}-config.cmake created (hip:: + ${pkg}:: + roc:: aliases)."; \
|
||||
echo "${pkg}-config.cmake created (hip:: + ${pkg}:: aliases)."; \
|
||||
done && \
|
||||
# roc::hiprand / roc::hipsolver / roc::hipsparse / roc::hipfft 别名(PyTorch Caffe2Targets 直接引用 roc:: 命名空间)
|
||||
for pair in "hiprand:rocrand" "hipsolver:rocsolver" "hipsparse:rocsparse" "hipfft:rocfft" "hipcub:rocprim"; do \
|
||||
# roc::* 别名(PyTorch Caffe2Targets 直接引用 roc:: 命名空间的 hip 包名)
|
||||
for pair in \
|
||||
"hipblas:rocblas" "hiprand:rocrand" "hipsolver:rocsolver" \
|
||||
"hipsparse:rocsparse" "hipfft:rocfft" "hipcub:rocprim" \
|
||||
"hipblaslt:hipblaslt" "hiprtc:hiprtc"; \
|
||||
do \
|
||||
hip_pkg="${pair%%:*}"; roc_pkg="${pair#*:}"; \
|
||||
roc_target="roc::${hip_pkg}"; hip_target="hip::${hip_pkg}"; src_target="roc::${roc_pkg}"; \
|
||||
cfg_dir="/opt/rocm/lib/cmake/${hip_pkg}"; \
|
||||
if [ -f "${cfg_dir}/${hip_pkg}-config.cmake" ]; then \
|
||||
if ! grep -q "${roc_target}" "${cfg_dir}/${hip_pkg}-config.cmake" 2>/dev/null; then \
|
||||
printf 'if(TARGET %s AND NOT TARGET %s)\n add_library(%s ALIAS %s)\nendif()\n' \
|
||||
"${src_target}" "${roc_target}" "${roc_target}" "${src_target}" \
|
||||
if ! grep -q "roc::${hip_pkg}" "${cfg_dir}/${hip_pkg}-config.cmake" 2>/dev/null; then \
|
||||
printf 'if(TARGET hip::%s AND NOT TARGET roc::%s)\n add_library(roc::%s ALIAS hip::%s)\nendif()\n' \
|
||||
"${hip_pkg}" "${hip_pkg}" "${hip_pkg}" "${hip_pkg}" \
|
||||
>> "${cfg_dir}/${hip_pkg}-config.cmake" && \
|
||||
echo "${roc_target} alias appended to ${hip_pkg}-config.cmake."; \
|
||||
echo "roc::${hip_pkg} alias → ${hip_pkg}-config.cmake."; \
|
||||
fi; \
|
||||
fi; \
|
||||
done && \
|
||||
|
||||
Reference in New Issue
Block a user