Docker images with architecture optimisation?

眉间皱痕 提交于 2019-12-07 09:20:07

问题


Some libraries such as BLAS/LAPACK or certain optimisation libraries get optimised for the local machine architecture upon compilation time. Lets take OpenBlas as an example. There exist two ways to create a Docker container with OpenBlas:

  1. Use a Dockerfile in which you specify a git clone of the OpenBlas library together with all necessary compilation flags and build commands.

  2. Pull and run someone else's image of Ubuntu + OpenBlas from the Docker Hub.

Option (1) guarantees that OpenBlas is build and optimised for your machine. What about option (2)? As a Docker novice, I see images as something fixed and static, so running this image would not be optimised to my machine (which might be AMD-based instead of the maintainer's Intel CPU). What left me confused is that the image ipython/scipyserver does clone the latest OpenBlas master from Github during build.

I seem to misunderstand the concept of Docker images and/or automated builds, and I would very much appreciate a clarification.


回答1:


No, I think you're pretty much right.

The image you link to is an automated build, so OpenBlas will be getting compiled using the kernel and architecture of the Docker build server. I did notice the build script sets the following flags when building OpenBlas:

DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=32

Which presumably makes the install portable at a performance cost. An alternative would be to have a separate image for various build configurations.



来源:https://stackoverflow.com/questions/27919866/docker-images-with-architecture-optimisation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!