Bug#684338: libopenblas-base: disable processor affinity

Steven G. Johnson stevenj at ab-initio.mit.edu
Wed Aug 8 21:07:31 UTC 2012


Package: libopenblas-base
Version: 0.1.1-5
Severity: normal

By default, OpenBLAS enables processor affinity on Linux-based systems, which
binds the threads to fixed CPUs.  This appropriate only for process
execution on dedicated machine, and is not appropriate for general usage.
For example, if two programs linked with OpenBLAS are both running, then
the processor affinity will cause them to "fight" over the same CPUs, even
if the system has enough CPUs to run both programs in parallel.

Suggestion: compile OpenBLAS with the NO_AFFINITY=1 flag, which disables
processor affinity.

In a situation where you *do* have a dedicated machine running the OpenBLAS
program, disabling affinity causes a slight performance degradation.  However,
in that case the user can always re-enable affinity by using the taskset
program.  The converse is not true -- there does not seem to be any way
to disable processor affinity in OpenBLAS if it is compiled in, and in 
any case disabling processor affinity is a more sensible default.

Regards,
Steven G. Johnson

PS. You probably also want to set the maximum number of threads in OpenBLAS
by compiling with the NUM_THREADS=xxx flag.  Otherwise, the maximum number
of threads is set by the number of cores of the build host, which is clearly
wrong for Debian.  Probably xxx=64 is a reasonable maximum these days -- this
number only sets an upper bound on the number of threads used at runtime,
since the actual number of cores is detected at runtime, and there seems only
to be a slight memory penalty in buffer space for setting the maximum to be
too large.  Also, it looks like the code may have a hard-coded upper bound of 64
threads anyway (see init.c).
-- System Information:
Debian Release: 6.0.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/16 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash



More information about the debian-science-maintainers mailing list