fastmachinelearning / hls4ml-tutorial

Tutorial notebooks for hls4ml
http://fastmachinelearning.org/hls4ml-tutorial/
304 stars 134 forks source link

Vivado installation in Dockerfile #19

Closed green-cabbage closed 3 years ago

green-cabbage commented 3 years ago

I would like to make my own Dockerfile, so I am looking for the specific line that installs Vivado. Does it exist in the dockerfile or do I have to manually install it?

Thanks

thesps commented 3 years ago

Hi, you need to first download the full installer of Vivado from the Xilinx website - the .tar.gz that is ~20-30 GB in size - to vivado.tar.gz. We use the 2019.2 version for the tutorial. You also need to provide a vivado_cfg.txt file to the installer to tell it exactly what to install. I've put the one we used for the tutorial here, but you might want to modify it if you need to target a particular FPGA device.

Then the installation in the Dockerfile should be something like this:

USER root
COPY vivado_cfg.txt /tmp/vivado_cfg.txt
COPY vivado.tar.gz /tmp/vivado.tar.gz
RUN tar -xzf /tmp/vivado.tar.gz && \
    cd Xilinx_Vivado_2019.2_1106_2127 && \
    ./xsetup --agree XilinxEULA,3rdPartyEULA,WebTalkTerms --batch Install --config /tmp/vivado_cfg.txt && \
    cd .. && \
    rm -r Xilinx_Vivado_2019.2_1106_2127 && \
    rm /tmp/vivado.tar.gz && \
    rm /tmp/vivado_cfg.txt

There is an alternative method if you already have Vivado installed on your host machine, and it's running Ubuntu, which is not to install Vivado directly in the Docker image, but to mount the directory into the container. That would be adding -v /local/vivado/path/:/opt/vivado/ to the docker run command.

green-cabbage commented 3 years ago

Thanks for the info. I have installed vivado 2019.2, but now it gives the error "application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory Project myproject_prj does not exist. Rerun "hls4ml build -p model_1/hls4ml_prj". " when I do this command "hls_model.build(csim=False)"

green-cabbage commented 3 years ago

Turns out it was an issue with Vivado in this case. It turned out that I didn't have the file called "libtinfo.so.5," but I had "libtinfo.so.6" and "libtinfo.so.6.2" (used "ldconfig | grep libtinfo")

I was inspired by the solution here https://forums.xilinx.com/t5/Design-Entry/libtinfo-so-6-instead-of-libtinfo-so-5/td-p/1000106

and while that solution didn't work for me, I just went to the directory that had "libtinfo.so.6" and "libtinfo.so.6.2" and copied them as "libtinfo.so.5" and "libtinfo.so.5.2"

thesps commented 3 years ago

After that, were you able to run through the tutorial?

green-cabbage commented 3 years ago

yep, works great. Thanks.

Also, I have other questions about the package (tf layer Dot only supporting rank 1 matrices). Do I post the issue here, or somewhere else?

Thanks in advance.

thesps commented 3 years ago

yep, works great. Thanks.

Great, then I'll close this issue.

I have other questions about the package (tf layer Dot only supporting rank 1 matrices)

I've moved your issue on that over to the hls4ml repo here, where there should be more people that can response.