C++ call to LAPACKE run on a single thread while NumPy uses all threads

I wrote a C++ code whose bottleneck is the diagonalization of a possibly large symmetric matrix. The code uses OpenMP, CBLAS and LAPACKE C-interfaces.

However, the call on dsyev runs on a single thread both on my local machine and on a HPC cluster (as seen by htop or equivalent tools). It takes about 800 seconds to diagonalize a 12000x12000 matrix, while NumPy‘s function eigh takes about 250 seconds. Of course, in both cases $OMP_NUM_THREADS is set to the number of threads.

Here is an example of a C++ code that calls LAPACK that is basically what I do in my program. (I am reading the matrix that is in binary format).

#include <stdlib.h>
#include <cstring>
#include <iostream>
#include <fstream>
#include <sstream>
#include <array>
#include <chrono>
#include <omp.h>
#include <cblas.h>
extern "C"
{
    #include <lapacke.h>
}

using namespace std;

const char uplo = 'L';
const char jobz = 'V';


int eigen(double* M, double* W, const int& N)
{

    printf("Diagonalizing...n");

    int info;

    // Eigenvalues will be in W, Eigenvectors in T
    info = LAPACKE_dsyev(LAPACK_COL_MAJOR, jobz, uplo, N, M, N, W);

    if (info < 0)
    {
        printf("FATAL ERROR: Eigensolver (dsyev) failed: illegal argument %dn",-info);
    }
    else if (info > 0)
    {
        printf("FATAL ERROR: Eigensolver (dsyev) failed: failed to converge %dn",info);
    }

    return info;
}


int main(int argc, char* argv())
{

    #ifdef _OPENMP
    if (getenv("OMP_NUM_THREADS"))
    {
        omp_set_num_threads(atoi(getenv("OMP_NUM_THREADS")));
        string str = "Running on "+to_string(omp_get_max_threads()) + " threadsn";
        printf(str.c_str());
    }
    #endif

    const int N = 12000;
    double t1 = 0.;
    double t2 = 0.;
    double* M = new double(N*N){0.};
    double* W = new double(N){0.};
    int info = 0;


    printf("Reading matrix.dat ...n");
    ifstream file("matrix.dat");
    file.seekg(0, ios_base::end);
    size_t size = file.tellg();
    file.seekg(0, ios_base::beg);
    file.read((char*) &M(0), size);
    printf("Done.n");




    t1 = omp_get_wtime();

    info = eigen(M,W,N);
    printf("Exit code: %in",info);

    t2 = omp_get_wtime();
    printf("Done in (s): %-10.3fn",t2-t1);

    delete () M;
    delete () W;

    return 0;

}

Clearly, NumPy seems to be linked to a version of LAPACK that is multi-threaded while my program is not. I thought that any LAPACK implementation was multi-threaded in the sense that it calls BLAS, which is (supposedly) always multi-threaded.

How to fix this problem i.e. how to make sure that LAPACK uses all threads ?

Thread title got wrong spelling. What to/How to fix?

Hello @BMF
While creating a new thread on New PTC Sites: https://www.beermoneyforum.com/threads/aliclickers-club-reiews-scam-or-legit.139835/

In title I unknowingly mistaken allclickers.club for aliclickers.club . What can I do to fix this?
The thread has not been published.

Bug – Can’t open this thread… | Forum Promotion

Hi guys, I could have sworn that I had some kind of topic like this already, but I just searched everywhere for it and couldn’t find it. We need your assistance in getting the word out about our lovely community, so I’ve attached a few different advertising images that you guys are welcome to…

metacpan – Thread for requesting bounty on these questions

I don’t have enough rep. Please migrate this to Meta?

Many people have this same issue too! Google proves this question has significant public importance and interest. Can anyone spare 50 bounty please on it? Thanks!

I’m not looking for a debate. If you don’t want to help out, just disregard this.

percona cluster victim thread on duplicate key updates

Recently, I’ve been getting this in the log and its creating chaos when not addressed. I totally understand the error, but what are the typical sources of this showing up in the cluster. I’ve been running previous versions without any issues and this has started popping up after upgrade to 8.x. Has anyone dealt with that? My cluster is behind roundrobin loadlabancer and I’m thinking of changing that, but in my opinion the cluster should be able to take care of this. Can this be tweaked with some configs ?

(Note) (MY-000000) (WSREP) Victim thread:
THD: 152232, mode: local, state: exec, conflict: certifying, seqno: -1
SQL: INSERT INTO session (data, id, expire) VALUES (‘__flash|a:0:18;’, ‘dasd’, 1621267611) ON DUPLICATE KEY UPDATE data=VALUES(data), expire=VALUES(expire)

Joshua Farrell's Ask Me Thread

My last thread hit almost a thousand replies, so I decided that that was more than adequate, and time to start a fresh new thread.

Ask away!

[HASH=16919]#JoshuaFarrell[/HASH]

[cXF] Thread scroll enhancement | NulledTeam UnderGround

Add some features when scrolling a thread like sticky thread title in navigation or below it (useful if scrolling long threads) or maybe add some scroll progress bar in various positions. Check below for more information.

FEATURES

  • add thread title in navigation or below it when scrolling a thread
  • optionally add a close button to remove the thread title (more information on screens below)
  • optionally add “Currently reading” (or edit the text via phrase!) in front of a…

.(tagsToTranslate)xenforo nulled(t)nulled(t)whmcs nulled(t)vbulletin nulled(t)whmcs themes nulled(t)whmcs modules nulled(t)whmcs template nulled(t)nulled forum(t)best nulled scripts site(t)whmcs templates nulled(t)phpfox nulled(t)nulled script(t)xenforo 2 nulled(t)best nulled sites(t)xenforo nulled themes(t)whmcs nulled(t)nulled scripts(t)vbulletin 5 nulled(t)whmcs addons nulled(t)arrowchat nulled(t)cs-cart nulled(t)xfilesharing pro nulled(t)nulled script forum(t)cs cart nulled(t)nulled sites(t)blesta nulled

Thread Filter by AddonsLab

Admin submitted a new resource:

Thread Filter by AddonsLab – Performance-optimized thread filter and search based on custom fields

Add-On Overview

The add-on allows to filter and search threads based on Custom thread fields. The idea is to allow admins to utilize the power of custom thread…

Read more

.

vupload.com – discussion thread

Someone experiences with this Host?
Im thinking to work with them.

Bumping Thread Warning massage in not opening

Hello All,
I got one link / information under my account wanting tab with name "Bumping Thread" and if I click on this link I am getting below massage
"You do not have permission to view this page or perform this action."

Do you know how to fix this issue?