cpp-cv-project-template icon indicating copy to clipboard operation
cpp-cv-project-template copied to clipboard

Update Dockerfile to avoid the additional clone

Open roumenguha opened this issue 1 year ago • 1 comments

Description

I just tried to build this docker image and had some issues. This is with install_apt_packages(cfg) and install_libraries_from_source(cfg) commented out (i.e. a pure Python development environment). I'm using an AMD machine running Fedora 41. The issues are mostly due to numpy compilation failing for the following reasons, and their resolutions:

  1. missing Fortran compilers -> added gfortran to Dockerfile
  2. missing BLAS libraries (intel-mkl, atlas, lapack, openblas) -> added intel-mkl, libatlas-base-dev, liblapack-dev, and libblas-dev to Dockerfile
  3. numpy==1.20.2 contained some compilation issues, and was duplicated twice in the requirements.txt -> removed entirely from requirements.txt and install before other packages within create_venv.sh. The version is no longer specified.

Additionally

  • the EVO package required the tool unzip -> added unzip to Dockerfile
  • because I was changing the Dockerfile and the current implementation of it clones a new copy of the repo on develop, none of my changes were taking effect -> I added the ability to run the local copy, allowing me to build with changes that haven't been pushed to origin yet. This requires the Dockerfile to be moved to the root directory of the repo, due to how docker build works.

Here is proof of a successful build with install_apt_packages(cfg) and install_libraries_from_source(cfg) commented out: image

And with them uncommented (the full build in 3106.5s): image

Notes:

  • I haven't tried out the environment yet to make sure everything works. I will update this PR when I do.
  • I added ENV MKL_DEBUG_CPU_TYPE=5 to the Dockerfile. Apparently intel-mkl leaves some performance left on the table when using an AMD CPU. This env flag ameliorates that but may not be necessary. It may be possible to make this conditional on the CPU of the current machine.

I understand if you do not want to merge these changes. However, if you do want these changes with some modifications, please let me know and I'll be happy to make them. Thanks for your work!

roumenguha avatar Feb 11 '25 07:02 roumenguha

Thanks a lot!

I worked on this projects years back and left it as is since. Many things in this project are probably super outdated, and I was not much a good of a programmer at the time too. I think there's tons of stuffs that can be improved.

I'd like to merge your PR, but you mentioned you'll try it out and update the PR once you do. I'll merge it after your update! 👍

changh95 avatar Feb 16 '25 08:02 changh95