Applications/Openblas
From HPC
Revision as of 08:15, 21 April 2017 by Pysdlb (talk | contribs) (Pysdlb moved page Openblas to Applications/Openblas without leaving a redirect)
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 Examples
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
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