本文介绍了具有架构优化功能的Docker映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些库(例如BLAS/LAPACK或某些优化库)会在编译时针对本地计算机体系结构进行优化.让我们以OpenBlas为例.有两种使用OpenBlas创建Docker容器的方法:

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. 使用Dockerfile,在其中您指定OpenBlas库的git克隆以及所有必要的编译标志和构建命令.

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

从Docker Hub中拉并运行其他人的Ubuntu + OpenBlas映像.

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

选项(1)确保为您的计算机构建并优化了OpenBlas.方案(2)呢?作为Docker的新手,我认为映像是固定的和静态的,因此运行该映像不会针对我的机器进行优化(可能基于AMD,而不是维护者的Intel CPU).让我感到困惑的是,图像 ipython/scipyserver 确实克隆了最新的OpenBlas在构建期间来自Github的大师.

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.

我似乎误解了Docker映像和/或自动构建的概念,对此我将不胜感激.

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

推荐答案

不,我认为您非常正确.

No, I think you're pretty much right.

您链接到的映像是一个自动构建,因此将使用Docker构建服务器的内核和体系结构来编译OpenBlas.我确实注意到构建脚本设置了以下标志在构建OpenBlas时:

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.

这篇关于具有架构优化功能的Docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 00:42