﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
638	Linux OpenBLAS library threading problems	Tristan Croll	Conrad Huang	"This came up a while back, and I have the below workaround defined in my chimerax_start directory. It seems that libopenblas (used by Numpy for various linear algebra tasks) has a bug in its multi-threaded implementation. By default it sets the number of threads to the number of available CPUs, but for me (on multiple machines in Fedora or CentOS), any number of threads more than one leads to 200% CPU usage when I do something as simple as:


{{{
import numpy
def invert(*_):
    numpy.linalg.invert(numpy.identity(3))
session.triggers.add_handler('new frame', invert)

}}}

Applying the following drops CPU usage back to 4-5% on my machines:


{{{
import ctypes
openblas_lib = ctypes.cdll.LoadLibrary('/home/tic20/apps/chimerax/lib/python3.6/site-packages/numpy/.libs/libopenblasp-r0-39a31c03.2.18.so')
openblas_lib.openblas_set_num_threads(1)
}}}

Until OpenBLAS is fixed, I'd suggest doing this by default in Linux builds.

"	defect	closed	major		Platform		fixed						all	ChimeraX
