Skip to content

Commit

Permalink
[Docker] Enable optional xrt installation from local deb
Browse files Browse the repository at this point in the history
  • Loading branch information
auphelia committed Jun 7, 2024
1 parent 507d72e commit 1c46131
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docker/Dockerfile.finn
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ LABEL maintainer="Jakoba Petri-Koenig <[email protected]>, Yaman Umuro

ARG XRT_DEB_VERSION="xrt_202220.2.14.354_22.04-amd64-xrt"
ARG SKIP_XRT
ARG LOCAL_XRT

WORKDIR /workspace

Expand Down Expand Up @@ -79,8 +80,12 @@ RUN cd verilator && \
make install

# install XRT
RUN if [ -z "$LOCAL_XRT" ];then \
wget -U 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17' "https://www.xilinx.com/bin/public/openDownload?filename=$XRT_DEB_VERSION.deb" -O /tmp/$XRT_DEB_VERSION.deb; fi

COPY $XRT_DEB_VERSION.deb /tmp/$XRT_DEB_VERSION.deb

RUN if [ -z "$SKIP_XRT" ];then \
wget -U 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17' "https://www.amd.com/bin/public/amdOpenDownload?filename=$XRT_DEB_VERSION.deb" -O /tmp/$XRT_DEB_VERSION.deb --debug && \
apt install -y /tmp/$XRT_DEB_VERSION.deb && \
rm /tmp/$XRT_DEB_VERSION.deb; fi

Expand Down
16 changes: 15 additions & 1 deletion run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ SCRIPTPATH=$(dirname "$SCRIPT")
: ${DOCKER_BUILDKIT="1"}
: ${FINN_SINGULARITY=""}
: ${FINN_SKIP_XRT_DOWNLOAD=""}
: ${FINN_XRT_PATH=""}

DOCKER_INTERACTIVE=""

Expand Down Expand Up @@ -182,14 +183,27 @@ if [ "$FINN_SKIP_DEP_REPOS" = "0" ]; then
./fetch-repos.sh
fi

# If xrt path given, copy .deb file to this repo
# Be aware that we assume a certain name of the xrt deb version
if [ -d "$FINN_XRT_PATH" ];then
cp $FINN_XRT_PATH/$XRT_DEB_VERSION.deb .
export LOCAL_XRT=1
fi

# Build the FINN Docker image
if [ "$FINN_DOCKER_PREBUILT" = "0" ] && [ -z "$FINN_SINGULARITY" ]; then
# Need to ensure this is done within the finn/ root folder:
OLD_PWD=$(pwd)
cd $SCRIPTPATH
docker build -f docker/Dockerfile.finn --build-arg XRT_DEB_VERSION=$XRT_DEB_VERSION --build-arg SKIP_XRT=$FINN_SKIP_XRT_DOWNLOAD --tag=$FINN_DOCKER_TAG $FINN_DOCKER_BUILD_EXTRA .
docker build -f docker/Dockerfile.finn --build-arg XRT_DEB_VERSION=$XRT_DEB_VERSION --build-arg SKIP_XRT=$FINN_SKIP_XRT_DOWNLOAD --build-arg LOCAL_XRT=$LOCAL_XRT --tag=$FINN_DOCKER_TAG $FINN_DOCKER_BUILD_EXTRA .
cd $OLD_PWD
fi

# Remove local xrt.deb file from repo
if [ ! -z "$LOCAL_XRT" ];then
rm $XRT_DEB_VERSION.deb
fi

# Launch container with current directory mounted
# important to pass the --init flag here for correct Vivado operation, see:
# https://stackoverflow.com/questions/55733058/vivado-synthesis-hangs-in-docker-container-spawned-by-jenkins
Expand Down

0 comments on commit 1c46131

Please sign in to comment.