diff --git a/docker/Dockerfile.finn b/docker/Dockerfile.finn index 71f41acbb618a8cde9bb8ab07cb2cf5a3be90544..f45031f71be575e531ee0c92794cdcd0766ac610 100644 --- a/docker/Dockerfile.finn +++ b/docker/Dockerfile.finn @@ -109,50 +109,24 @@ RUN pip install -e /workspace/finn-base RUN git clone https://github.com/fastmachinelearning/qonnx.git /workspace/qonnx RUN git -C /workspace/qonnx checkout $QONNX_COMMIT RUN pip install --no-dependencies -e /workspace/qonnx + +# extra dependencies from other FINN deps +# installed in Docker image to make entrypoint script go faster # finn-experimental -RUN git clone https://github.com/Xilinx/finn-experimental.git /workspace/finn-experimental -RUN git -C /workspace/finn-experimental checkout $FINN_EXP_COMMIT -RUN pip install -e /workspace/finn-experimental +RUN pip install deap==1.3.1 +RUN pip install mip==1.13.0 +RUN pip install networkx==2.8 # brevitas -RUN git clone https://github.com/Xilinx/brevitas.git /workspace/brevitas -RUN git -C /workspace/brevitas checkout $BREVITAS_COMMIT -RUN pip install -e /workspace/brevitas +RUN pip install future-annotations==1.0.0 +RUN pip install dependencies==2.0.1 +RUN pip install tokenize-rt==4.2.1 # pyverilator -RUN git clone https://github.com/maltanar/pyverilator.git /workspace/pyverilator -RUN git -C /workspace/pyverilator checkout $PYVERILATOR_COMMIT -RUN pip install -e /workspace/pyverilator -# other git-based dependencies (non-Python) -# cnpy -RUN git clone https://github.com/rogersce/cnpy.git /workspace/cnpy -RUN git -C /workspace/cnpy checkout $CNPY_COMMIT -# finn-hlslib -RUN git clone https://github.com/Xilinx/finn-hlslib.git /workspace/finn-hlslib -RUN git -C /workspace/finn-hlslib checkout $HLSLIB_COMMIT -# oh-my-xilinx -RUN git clone https://github.com/maltanar/oh-my-xilinx.git /workspace/oh-my-xilinx -RUN git -C /workspace/oh-my-xilinx checkout $OMX_COMMIT -# board files -RUN cd /tmp; \ - wget -q https://github.com/cathalmccabe/pynq-z1_board_files/raw/master/pynq-z1.zip; \ - wget -q https://dpoauwgwqsy2x.cloudfront.net/Download/pynq-z2.zip; \ - unzip -q pynq-z1.zip; \ - unzip -q pynq-z2.zip; \ - mkdir /workspace/board_files; \ - mv pynq-z1/ /workspace/board_files/; \ - mv pynq-z2/ /workspace/board_files/; \ - rm pynq-z1.zip; \ - rm pynq-z2.zip; \ - git clone https://github.com/Avnet/bdf.git /workspace/avnet-bdf; \ - git -C /workspace/avnet-bdf checkout $AVNET_BDF_COMMIT; \ - mv /workspace/avnet-bdf/* /workspace/board_files/; - +RUN pip install tclwrapper==0.0.1 # extra environment variables for FINN compiler ENV VIVADO_IP_CACHE "/tmp/vivado_ip_cache" -ENV PATH "${PATH}:/workspace/oh-my-xilinx" -ENV OHMYXILINX "/workspace/oh-my-xilinx" - -WORKDIR /workspace/finn +ENV PATH "${PATH}:${FINN_ROOT}/deps/oh-my-xilinx" +ENV OHMYXILINX "${FINN_ROOT}/deps/oh-my-xilinx" COPY docker/finn_entrypoint.sh /usr/local/bin/ COPY docker/quicktest.sh /usr/local/bin/ diff --git a/docker/finn_entrypoint.sh b/docker/finn_entrypoint.sh index 788e6bf51b4c0748883be371f4dd77941ef2c99d..4be8e9fd3c917e70a2b46fb8a9ca66d3d1928250 100644 --- a/docker/finn_entrypoint.sh +++ b/docker/finn_entrypoint.sh @@ -28,7 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -export FINN_ROOT=/workspace export HOME=/tmp/home_dir export SHELL=/bin/bash export LANG="en_US.UTF-8" @@ -54,12 +53,23 @@ recho () { echo -e "${RED}ERROR: $1${NC}" } -if [ -f "$FINN_ROOT/finn/setup.py" ];then +# finn-base +pip install --user -e ${FINN_ROOT}/deps/finn-base +# Install qonnx without dependencies, currently its only dependency is finn-base +pip install --user --no-dependencies -e ${FINN_ROOT}/deps/qonnx +# finn-experimental +pip install --user -e ${FINN_ROOT}/deps/finn-experimental +# brevitas +pip install --user -e ${FINN_ROOT}/deps/brevitas +# pyverilator +pip install --user -e ${FINN_ROOT}/deps/pyverilator + +if [ -f "${FINN_ROOT}/setup.py" ];then # run pip install for finn - pip install --user -e $FINN_ROOT/finn + pip install --user -e ${FINN_ROOT} else - recho "Unable to find FINN source code in $FINN_ROOT/finn" - recho "Ensure you have passed -v <path-to-finn-repo>:/workspace/finn to the docker run command" + recho "Unable to find FINN source code in ${FINN_ROOT}" + recho "Ensure you have passed -v <path-to-finn-repo>:<path-to-finn-repo> to the docker run command" exit -1 fi diff --git a/fetch-repos.sh b/fetch-repos.sh index 50ca89e459b3d93c835049fe9e9c1b45571b5a52..980a2776aef250ab0c4193c30e71570749077aa8 100755 --- a/fetch-repos.sh +++ b/fetch-repos.sh @@ -103,3 +103,16 @@ fetch_repo $OMX_URL $OMX_COMMIT $OMX_DIR fetch_repo $AVNET_BDF_URL $AVNET_BDF_COMMIT $AVNET_BDF_DIR # TODO download extra Pynq board files and extract if needed +# cd /tmp; \ +# wget -q https://github.com/cathalmccabe/pynq-z1_board_files/raw/master/pynq-z1.zip; \ +# wget -q https://dpoauwgwqsy2x.cloudfront.net/Download/pynq-z2.zip; \ +# unzip -q pynq-z1.zip; \ +# unzip -q pynq-z2.zip; \ +# mkdir ${FINN_ROOT}/deps/board_files; \ +# mv pynq-z1/ ${FINN_ROOT}/deps/board_files/; \ +# mv pynq-z2/ ${FINN_ROOT}/deps/board_files/; \ +# rm pynq-z1.zip; \ +# rm pynq-z2.zip; \ +# git clone https://github.com/Avnet/bdf.git ${FINN_ROOT}/deps/avnet-bdf; \ +# git -C ${FINN_ROOT}/deps/avnet-bdf checkout $AVNET_BDF_COMMIT; \ +# mv ${FINN_ROOT}/deps/avnet-bdf/* ${FINN_ROOT}/deps/board_files/; diff --git a/run-docker.sh b/run-docker.sh index c804b8aa7b03d87309ba71443610ec4844fb123e..14b3e1f5ef6d3fc1606a5cfacea582b91c8dac43 100755 --- a/run-docker.sh +++ b/run-docker.sh @@ -168,6 +168,8 @@ gecho "Using default PYNQ board $PYNQ_BOARD" # Build the FINN Docker image if [ "$FINN_DOCKER_PREBUILT" = "0" ]; then + # ensure git-based deps are checked out at correct commit + ./fetch-repos.sh # Need to ensure this is done within the finn/ root folder: OLD_PWD=$(pwd) cd $SCRIPTPATH @@ -180,10 +182,11 @@ fi DOCKER_EXEC="docker run -t --rm $DOCKER_INTERACTIVE --tty --init " DOCKER_EXEC+="--hostname $DOCKER_INST_NAME " DOCKER_EXEC+="-e SHELL=/bin/bash " -DOCKER_EXEC+="-v $SCRIPTPATH:/workspace/finn " +DOCKER_EXEC+="-w $SCRIPTPATH " +DOCKER_EXEC+="-v $SCRIPTPATH:$SCRIPTPATH " DOCKER_EXEC+="-v $FINN_HOST_BUILD_DIR:$FINN_HOST_BUILD_DIR " DOCKER_EXEC+="-e FINN_BUILD_DIR=$FINN_HOST_BUILD_DIR " -DOCKER_EXEC+="-e FINN_ROOT="/workspace" " +DOCKER_EXEC+="-e FINN_ROOT="$SCRIPTPATH" " DOCKER_EXEC+="-e LOCALHOST_URL=$LOCALHOST_URL " DOCKER_EXEC+="-e VIVADO_IP_CACHE=$VIVADO_IP_CACHE " DOCKER_EXEC+="-e PYNQ_BOARD=$PYNQ_BOARD "