Difference between revisions of "Applications/Openblas"
From HPC
(Created page with "__TOC__ ==Application Details== *Description: *Version: 0.2.19 and 0.2.18 *Module: openblas/0.2.19/gcc-4.9.3 and openblas/gcc/0.2.18 *Licence: 3-clause BSD license ==Usage...") |
m (→Further Information) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
==Application Details== | ==Application Details== | ||
− | *Description: | + | *Description: openBLAS (open Basic Linear Algebra Subprograms) API library routines |
*Version: 0.2.19 and 0.2.18 | *Version: 0.2.19 and 0.2.18 | ||
*Module: openblas/0.2.19/gcc-4.9.3 and openblas/gcc/0.2.18 | *Module: openblas/0.2.19/gcc-4.9.3 and openblas/gcc/0.2.18 | ||
Line 9: | Line 9: | ||
==Usage Examples== | ==Usage Examples== | ||
− | OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. | + | OpenBLAS is an optimized BLAS library based on [https://en.wikipedia.org/wiki/GotoBLAS GotoBLAS2] 1.13 BSD version. |
+ | |||
+ | OpenBLAS adds optimized implementations of linear algebra kernels for several processor architectures, including Intel Sandy Bridge. It claims to achieve performance comparable to the [[applications/Intel|Intel MKL]]. | ||
+ | |||
===Module=== | ===Module=== | ||
Line 19: | Line 22: | ||
[username@login01 ~]$ module add gcc/4.9.3 | [username@login01 ~]$ module add gcc/4.9.3 | ||
− | [username@login01 ~]$ | + | [username@login01 ~]$ gcc -o test test.c -I -lopenblas |
</pre> | </pre> | ||
Line 61: | Line 64: | ||
* [http://www.openblas.net/ http://www.openblas.net/] | * [http://www.openblas.net/ http://www.openblas.net/] | ||
− | { | + | {{Librariespagenav}} |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 11:08, 16 November 2022
Application Details
- Description: openBLAS (open Basic Linear Algebra Subprograms) API library routines
- Version: 0.2.19 and 0.2.18
- Module: openblas/0.2.19/gcc-4.9.3 and openblas/gcc/0.2.18
- Licence: 3-clause BSD license
Usage Examples
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
OpenBLAS adds optimized implementations of linear algebra kernels for several processor architectures, including Intel Sandy Bridge. It claims to achieve performance comparable to the Intel MKL.
Module
This shows the openblas module being loaded and a test.c program being compiled with the library:
[username@login01 ~]$ module add openblas/0.2.19/gcc-4.9.3 [username@login01 ~]$ module add gcc/4.9.3 [username@login01 ~]$ gcc -o test test.c -I -lopenblas
If the library is multithreaded, please add -lpthread. If the library contains LAPACK functions, please add -lgfortran or other Fortran libs.
Example
This example shows calling cblas_dgemm in C. https://gist.github.com/xianyi/6930656
#include <cblas.h> #include <stdio.h> void main() { int i=0; double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0}; double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0}; double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5}; cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3); for(i=0; i<9; i++) printf("%lf ", C[i]); printf("\n"); }
Again compilation here would be the following:
[username@login01 ~]$ gcc -o test_cblas_open test_cblas_dgemm.c -lopenblas -lpthread -lgfortran