add compatibility check as entry point for ROCm4.1 docker containers and newer

This commit is contained in:
sunway513
2021-03-22 19:42:43 +00:00
parent e82dd7c624
commit 4b49c600ba
3 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
#| This Dockerfile provides a compatibility check for ROCm docker container.
ARG base_image
FROM ${base_image}
MAINTAINER Peng Sun <peng.sun@amd.com>
COPY ../scripts/compatibility-check.sh /opt/rocm/bin/rocm-compatibility-test.sh
RUN chmod a+x /opt/rocm/bin/rocm-compatibility-test.sh
ENTRYPOINT ["/opt/rocm/bin/rocm-compatibility-test.sh"]
# Default to a login shell
CMD ["/bin/bash", "-l"]

View File

@@ -0,0 +1,12 @@
#| This Dockerfile provides a compatibility check for ROCm docker container.
ARG base_image
FROM ${base_image}
MAINTAINER Peng Sun <peng.sun@amd.com>
COPY ../scripts/compatibility-check.sh /opt/rocm/bin/rocm-compatibility-test.sh
RUN chmod a+x /opt/rocm/bin/rocm-compatibility-test.sh
ENTRYPOINT ["/opt/rocm/bin/rocm-compatibility-test.sh"]
# Default to a login shell
CMD ["/bin/bash", "-l"]

13
scripts/compatibility-check.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
/opt/rocm/bin/rocminfo 2>&1 | /bin/grep "HSA Error" > /dev/null
if [ $? -eq 0 ]
then
echo "Error: Incompatible ROCm environment."
echo "The Docker container requires the latest kernel driver to operate correctly."
echo "Upgrade the ROCm kernel to v4.1 or newer, or use a container tagged for v4.0.1 or older."
echo "For more information, see"
echo "https://rocmdocs.amd.com/en/latest/Current_Release_Notes/Current-Release-Notes.html#"
exit 1
fi
exec "$@"