29319

scipy.sparse package is multithreads/multiprocess or not

Question:

I am using scipy.sparse.linalg.spilu and scipy.sparse.linalg.bicgstab to solve Ax=b. I observed my CPU usage sometimes is around 50%. My CPU is Intel(R) Xeon(R) CPU E3-1245 V2@3.40GHZ which has 4 cores and 8 logical processors. I would like to know whether those two functions I use is multithread/multiprocessor, since if it is single thread/core, the CPU usage should be around 12.5%, right? Thanks!

Edit:

My code is below:

import scipy.sparse.linalg as spla import scipy import scipy.io as io import numpy as np import time from scipy.sparse import csr_matrix f="memplus.mtx" A=io.mmread(f) x=np.ones(A.shape[1])*0.99 b = np.dot( A.todense(), np.ones(A.shape[1]) ) lu=spla.spilu(A=A) M_x = lambda x: lu.solve(x) ndim = x.shape[0] M = scipy.sparse.linalg.LinearOperator((ndim, ndim), M_x) a, info=spla.bicgstab(A, b.T, x0=x, tol=1e-12, maxiter=10000, M=M)

Answer1:

These routines are not themselves parallelized. However, if you are using a multithreaded BLAS library such as ATLAS or Openblas, which is likely, several linear algebra operations in the routines are parallelized. Therefore, they benefit from multiple cores.

Answer2:

@p.v is correct. You must link scipy/numpy to a multithreaded blas library to take advantage of your multiple cores.

On a side note, I'm assuming that you are using Linux. Within Linux, when watching CPU utilization, the percentage you see is per core. 50% would mean that half of one core is being used. If you have 8 cores, then you should see CPU usage around 800% if all 8 are being used fully.

Recommend

  • Understanding Streaming Multiprocessors (SM) and Streaming Processors (SP)
  • HowTo for newbie: Managing currency in iPhone app
  • IndexAxisValueFormatter not working as expected
  • Node.js- “npm install express” error:0906D06C :PEM routines : PEM_read_bio npm
  • Inline image affecting line-height
  • thread-safe vs async-signal safe
  • how to properly use autoreleasepool for an nsoperationqueue
  • Should I use static function in c# where many calls the same func?
  • concatenating select menus into a single form input
  • Initializing a class using malloc
  • Slowly changing dimension - What is Pure type 6 implementation
  • How to run a set of SQL queries from a file, in PHP?
  • Set the default timezone in symfony
  • Is WITH the replacement for a #TEMP table?
  • Can I use Jquery to automatically find and set the width and height of a variety of images?
  • Can a Collections.shuffle be considered equivalent to a series of Randoms?
  • custom string delimiters stringtemplate-4
  • Set focus to first invalid form element in AngularJS
  • Find group of records that match multiple values
  • Angular2 component view does not update on value change via method
  • CakePHP ACL tutorial initDB function warnings
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Fetching methods from BroadcastReceiver to update UI
  • Spray.io: When (not) to use non-blocking route handling?
  • Symfony2: How to get request parameter
  • Redux, normalised entities and lodash merge
  • Do create extension work in single-user mode in postgres?
  • Why winpcap requires both .lib and .dll to run?
  • Return words with double consecutive letters
  • GridView Sorting works once only
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • SetUp method failed while running tests from teamcity
  • Python: how to group similar lists together in a list of lists?
  • WPF Applying a trigger on binding failure
  • Acquiring multiple attributes from .xml file in c#
  • Understanding cpu registers
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Busy indicator not showing up in wpf window [duplicate]
  • java string with new operator and a literal