5

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.

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
user45893
  • 733
  • 5
  • 18

1 Answers1

3

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.

Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
  • Thanks Adrian! You are right - by adding DYNAMIC_ARCH=1 all CPU kernels are compiled (thereby adding to compilation time), which are then pulled depending on the CPU architecture on which OpenBlas is called. Neat! – user45893 Jan 14 '15 at 14:54
  • Ok, that is interesting! – Adrian Mouat Jan 14 '15 at 15:09
  • an update: Docker is no longer just Linux 64 bit, there are Windows 64 bit container native for Windows 10 PRO and Windows server 2016. as well efforts for Docker Linux 32 bit https://github.com/docker-32bit – Walid Nov 19 '16 at 12:44
  • @Walid True. I've removed that sentence. – Adrian Mouat Nov 19 '16 at 22:20
  • @AdrianMouat I like your book and the way you write. thank you for your community spirit. – Walid Nov 21 '16 at 14:42