Questions tagged [blas]

Basic Linear Algebra Subprograms - A standard API library with vector-vector, matrix-vector, and matrix-matrix operations.

Filter by
Sorted by
Tagged with
0 votes
0 answers
57 views

Intel MKL results differ depending on the underlying hardware architecture [closed]

I think this is a well known problem that when using MKL_CBWR=AUTO, the results may differ across different hardware architecture due to the floating point ...
roulette01's user avatar
0 votes
1 answer
67 views

Weird runtime behavior of `scipy.linalg.solve_triangular` and `trtrs`

I want to understand the time complexity of scipy.linalg.solve_triangular, which calls trtrs from LAPACK under the hood, so I ...
nalzok's user avatar
  • 181
1 vote
1 answer
174 views

How do BLAS libraries implement support for transposed matrices?

I'm trying to understand how BLAS libraries implement fast GEMM with support for transposed matrices. Say, I'm only operating on square matrixes (with dimensions n ...
ilya's user avatar
  • 111
2 votes
1 answer
128 views

What is the correct way of computing $LL^T$ in packed format with blas/lapack

I have a triangular matrix stored in packed format (ie $L$). I need to compute $LL^T$ (not the decomposition, just the multiplication). What would be the preferred way of computing this with blas/...
atwood's user avatar
  • 23
10 votes
1 answer
330 views

Is it possible to express an arbitrary tensor contraction in terms of BLAS routines?

I noticed that libraries like numpy and pytorch are able to perform arbitrary tensor contractions at speeds similar to comparably sized matrix multiplications. This leads me to believe that underneath ...
ilya's user avatar
  • 111
2 votes
1 answer
170 views

Fast weighted vector inner product x*A*y with BLAS/LAPACK

Is there a way to compute the weighted vector inner product xAy with vectors x and y and Matrix A using BLAS/LAPACK while avoiding additional allocations or overwriting the inputs? I'm happy with ...
Bananach's user avatar
  • 799
1 vote
0 answers
160 views

Using Sundials CVODE in MATLAB

I'm currently using ode15s to solve a set of stiff differential equations. I am trying to use the MATLAB profiler to understand the section of the ode solver code which calls BLAS routines. Since the ...
Natasha's user avatar
  • 421
1 vote
1 answer
94 views

Automatic differentiation (AD) of a loss function which maps unitary matrix onto number

Is it possible to estimate whether automatic differentiation (AD) techniques could enable a more efficient way to repeatedly compute the derivative $\delta L / \delta u^*_{ij}$ of a specific loss ...
thyme's user avatar
  • 111
2 votes
1 answer
217 views

Parallelize pseudo inverse of a matrix using Lapacke

I am currently using the protocol described in https://stackoverflow.com/questions/55599950/computation-of-pseidoinverse-with-svd-in-c-using-blas-and-lapacke to compute the pseudo inverse of a matrix. ...
Filippo Caleca's user avatar
3 votes
0 answers
125 views

Compute orthogonal complement using BLAS / LAPACK

Is there a fast method to compute an orthogonal complement of an arbitrary matrix $U\in\mathbb{R}^{m \times n}$ in BLAS / LAPACK? Specifically, I want any matrix $V\in \mathbb{R}^{m \times (m - \text{...
Bananach's user avatar
  • 799
0 votes
1 answer
184 views

How to efficiently transpose distributed matrix in Scalapack?

I have a distributed matrix in block cyclic layout. Is there an efficient way to out/in place transpose a distributed matrix with scalapack? Context: I am trying to diagonalize the transpose of a ...
Aditya Kurrodu's user avatar
1 vote
0 answers
125 views

Does cblas_dgemm mutate my input matrices?

I have written a matrix class Matrix<T> for which I have implemented a wrapper function for cblas_dgemm. ...
Urwald's user avatar
  • 111
-1 votes
1 answer
265 views

Armadillo BLAS Matrix Multiplication with it transpose. Blas is too slow?

Does someone knows another trick or solution how can I perform matrix multiplication by its transpose? The current code for 1000 iterations takes too much time for me. ...
Furch Radeon's user avatar
4 votes
2 answers
518 views

Getting to know about various BLAS implementations

I keep coming across phrases like "highly optimized BLAS kernels" with "architecture-specific optimizations", but have never been able to find what exactly these optimizations are, ...
loonatick's user avatar
  • 151
1 vote
2 answers
1k views

How to set up the differential equation system to speed up computation?

I've set up a system of differential equations, obtained after discretizing pde, in the following way ...
Natasha's user avatar
  • 421
2 votes
1 answer
188 views

Efficient change of basis real positive definite symmetric matrix

I need to optimize a code where the most performance critical part is doing a 'change of basis', in other words it is an unitary similarity transformation on a big real positive definite symmetric ...
Vittore Scolari's user avatar
1 vote
1 answer
230 views

Functions from Scipy, Blas, or Lapack that compute only upper triangular matrix

My goal is to transform a matrix into upper triangular form in Python. I know the function scipy.linalg.lu will do LU decomposition and get both upper and lower ...
Akira's user avatar
  • 207
4 votes
0 answers
751 views

What algorithm do BLAS and ATLAS use for matrix multiplication?

I have searched and what I understood was that they use the naive one with several memory and cache optimizations. However, I wanted to know whether they are using the Strassen or the Coppersmith-...
bedo dan's user avatar
1 vote
1 answer
145 views

Using LAPACK to compute $B^{-1}AB^{-T}$ for thin $B$

How can I use BLAS/LAPACK to compute $$ B^{-1}AB^{-T} $$ where $A\in\mathbb{R}^{n,n}$, $B\in\mathbb{R}^{m,n}$ is full rank matrix with $m>n$, and $B^{-1}y:=\arg \min_{x} \|Bx-y\|_{2}$. In theory, ...
Bananach's user avatar
  • 799
7 votes
0 answers
584 views

Is there any catch on using `zgemm3m` vs regular `zgemm`?

I've just (to my embarrassment) encountered a BLAS-like extension of a matrix-matrix product subroutine gemm in Intel MKL: gemm3m...
Anton Menshov's user avatar
  • 8,672
2 votes
0 answers
46 views

Best way of porting code from the GPU to MPI-nodes

I have a program, structured in two parts, $A$ and $B$. Both parts are capable of running as standalone units, and written in C++. $A$ is written for cluster systems, running entirely on CPU-nodes, ...
arc_lupus's user avatar
  • 553
2 votes
1 answer
197 views

BLAS operation question

I want to perform the following operation: $$ A = A + U B^T $$ where $A$ is $m \times n$ dense, $U$ is $m \times m$ upper triangular, and $B$ is $n \times m$ dense. The BLAS function ...
vibe's user avatar
  • 1,058
2 votes
3 answers
264 views

C standard for computational science

Which C standard should be used for computational science code ? Should we keep compatibility with C89/90/ANSI or jump to C99 or C11 ? Context: Code will use third-party : BLAS, LAPACK, MKL, ...
Johann MARTINET's user avatar
4 votes
0 answers
104 views

Block matrix and DSYRK

I want to compute the matrix $$ A = \sum_{i=1}^N v_i v_i^T $$ where each $v_i$ is a given vector of length $2500$, so that $A$ is $2500 \times 2500$, and my $N$ is about 2 million. Rather than call ...
vibe's user avatar
  • 1,058
3 votes
2 answers
229 views

Parallel assembly of matrix

I have a matrix which I want to assembly quickly, which is in block form: $$ A = \pmatrix{ A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33}} $$ ...
vibe's user avatar
  • 1,058
4 votes
1 answer
325 views

Fast matrix multiplication with matrix elements computed on-the-fly (without forming the matrix)

Is there any library or routine for high-performance matrix-matrix product, where the matrix elements are computed on-the-fly using a given function of $i$ and $j$? More specifically, in the problem ...
fcdimitr's user avatar
  • 141
1 vote
0 answers
88 views

Fast calculation of $A^T B$

I need to compute a matrix-matrix product, $A^T B$, where $A$ is $n \times r$ sparse, and $B$ is $n \times q$ dense. The number of rows $n$ is far larger than both $r$ and $q$. In fact $n$ is so large ...
vibe's user avatar
  • 1,058
1 vote
1 answer
264 views

Wrong result of 'ddot' from BLAS

I am having trouble with a C/C++ program that uses the BLAS routine ddot. I am running Linux and so far LAPACK routines worked without any problems. I get a wrong ...
Blablablu's user avatar
1 vote
0 answers
149 views

$ A * B $ computation when B is a symmetric matrix in armadillo [closed]

Is there any way to multiply a symmetric matrix by a dense one in armadillo(and use the fact that we have a symmetric matrix)? I know about DSYMM Routine in BLAS,...
MAh2014's user avatar
  • 131
1 vote
0 answers
289 views

Kronecker product of matrices

I have to use Kronecker product of a matrix with a unit matrix is there any routine in ScaLapack or Lapack which can do so efficiently.
Puneet Sharma's user avatar
1 vote
0 answers
127 views

Eigenvalue problem (LAPACK)

I am working on a project in numerical analysis which I have to program in C (using Lapack and Blas). Matrix is given which is tridiagonal and "almost" symmetric (one element is to be changed to make ...
Tino's user avatar
  • 111
2 votes
1 answer
1k views

The difference between mkl_intel_lp64 vs mkl_gf_lp64 in a numerical reproducibility issue with Intel MKL

It has been discussed that Intel MKL can exhibit irreproducible behavior under certain conditions. In fact, this is a known thing and described by Intel as Conditional Numerical Reproducibility. A ...
xeroqu's user avatar
  • 143
1 vote
1 answer
193 views

GPU libraries for integer matmul | overflow tolerated

Are there any high performance integer BLAS libraries that implement matrix multiplication i.e. i32gemm and i64gemm ? I need to use them for a cryptographic application and can tolerate overflows, i.e....
kesari's user avatar
  • 287
2 votes
0 answers
203 views

What matrix criteria is "large enough" for Eigen to use a BLAS backend?

Eigen's documentation says that any BLAS back-end can be used (e.g. MKL) to perform the actual matrix calculations. It is, however, very vague when discussing the criteria as to which the ...
Damien's user avatar
  • 802
2 votes
1 answer
760 views

Distributed (MPI) matrix matrix multiplication

I perform matrix matrix multiplications (between rank-3 and rank-2 arrays) in fortran using following subroutine, ...
trblnc's user avatar
  • 125
17 votes
3 answers
2k views

Are BLAS implementations guaranteed to give the exact same result?

Given two different BLAS implementations, can we expect that they make the exact same floating point computations and return the same results? Or can it happen, for instance, that one computes a ...
Federico Poloni's user avatar
3 votes
2 answers
7k views

BLAS libraries for Octave or Matlab, preferrably with GPU support?

I just searched around a bit for BLAS implementations and was amazed by the sheer amount of libraries around. Does someone know of a benchmark or otherwise rating of the various libraries? How easy ...
mathreadler's user avatar
1 vote
1 answer
118 views

Set strictly upper triangular part of a matrix to alpha using BLAS or LAPACK

Is there routine in standard BLAS or LAPACK to set strictly-upper triangular part (the part above the diagonal) of a matrix to alpha? I do not want to change diagonal elements so ...
Kadir's user avatar
  • 273
6 votes
4 answers
7k views

Beating typical BLAS libraries matrix multiplication performance

A dull matrix multiplication algorithm where we use the formula $$C_{ij}=\sum_{k}A_{ik}B_{kj}$$ By literally following this in 3 loops we'll get a very slow program, because we don't utilize ...
The Quantum Physicist's user avatar
5 votes
2 answers
1k views

Smart way to multiply 3 matrices

I have a quantum mechanics simulation where I need to multiply three matrices that look like this: $$\rho(t_1)=U^\dagger \rho(t_0) \, U$$ where $U^\dagger$ is the hermitian conjugate of $U$. This ...
The Quantum Physicist's user avatar
2 votes
2 answers
4k views

Fastest way to perform element-wise multiplication on a sparse matrix

I have two large-ish matrices (~100K cols x ~100K rows). They are sparse and symmetrical (about 0.1% of them values are non-zero). I want to do element-wise multiplication between them. Also, I ...
Ale Morales's user avatar
7 votes
0 answers
912 views

Sparse matrix format and sparse-matrix sparse-matrix multiplication

I'm having some performance problems with my code dealing with the multiplication of big sparse matrices (stiffness and aerodynamic influence coefficient matrices). Mainly I have to multiply such ...
murph_sof's user avatar
1 vote
1 answer
519 views

Efficiently rotate vector in 2D (and 3D)

I need to efficiently rotate a 2D (and 3D) vector in a CUDA kernel. I was thinking about generating random unitary rotation matrices. I don't need to know the angle, it just has to be randomly ...
iko's user avatar
  • 13
12 votes
0 answers
4k views

Optimized open source BLAS / LAPACK package

I was wondering what is a more optimized open source BLAS/LAPACK package with respect to modern multi-core processors (Haswell and beyond). Is there any distribution that can attain performance close ...
tamumiket's user avatar
  • 121
4 votes
2 answers
429 views

Optimized parallel routine for $X' W X$ with $W$ diagonal

$X$ is a dense matrix of real doubles, typically of size 20 million rows and 500 columns, and $W$ is a diagonal matrix of real, non-negative doubles stored as a vector. I'm working in C and have ...
user2179977's user avatar
3 votes
2 answers
95 views

Do BLAS routines compute their respective operations with minimum error?

Do all BLAS routines compute the respective operation with minimum error ? i.e. Is the reduction in sdot computed with least error ? I need to call these ...
kesari's user avatar
  • 287
1 vote
1 answer
401 views

Kronecker products and basis contractions (ie. B.A.Transpose[B]) in C?

I have implemented a basis transformation in C of the following form kron[A,A]*B*Transpose[kron[A,A]] where A and ...
Kevan's user avatar
  • 11
2 votes
0 answers
353 views

Sparse Linear Algebra vs Dense Linear Algebra

I am interested in a reference in the literature that discusses the performance of Dense Linear Algebra (blas routines) and dense linear algebra (sparse blas routines). I am interested in knowing for ...
fred's user avatar
  • 1,000
3 votes
2 answers
5k views

BLAS, LAPACK or ATLAS for Matrix Multiplication in C

I am trying to find the most optimized way to perform Matrix Multiplication of very large sizes in C language and under Windows 7 or Ubuntu 14.04. And searching led me to BLAS, LAPACK and ATLAS. ...
hpc_beginner's user avatar
1 vote
1 answer
127 views

How to make this matrix efficiently?

Originally posted on stats.stackexchange, I'll pair the post down to something a bit more general. Suppose I have vectors $\{\mathbf{\delta}, \mathbf{x}_1, \ldots, \mathbf{x}_J\}$, where $\delta \in \...
StevieP's user avatar
  • 111