Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| bibliotheques_scientifiques [2016/07/07 09:12] – [LAPACK] admin | bibliotheques_scientifiques [2016/12/15 14:34] (Version actuelle) – [BLAS] admin | ||
|---|---|---|---|
| Ligne 52: | Ligne 52: | ||
| $ gfortran stod.f -o stod -lblas | $ gfortran stod.f -o stod -lblas | ||
| </ | </ | ||
| + | |||
| + | ===== Appel de DGEMM depuis C/C++===== | ||
| + | |||
| + | <file c demm.c> | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | #include < | ||
| + | |||
| + | extern void dgemm_(const char*, const char*, int*, int*,int*, double*, double*, int*, double*, int*, double*, double*, int*); | ||
| + | |||
| + | |||
| + | int main(int argc, char **argv){ | ||
| + | |||
| + | int i,j; | ||
| + | double one = 1.0; | ||
| + | double zero = 0.0; | ||
| + | |||
| + | int n = 1024; | ||
| + | |||
| + | if(argc==2) | ||
| + | { | ||
| + | n=atoi(argv[1]); | ||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | double *A = (double*)malloc(n*n*sizeof(double)); | ||
| + | |||
| + | double *B = (double*)malloc(n*n*sizeof(double)); | ||
| + | |||
| + | double *C = (double*)malloc(n*n*sizeof(double)); | ||
| + | |||
| + | if(C==NULL || B==NULL || A==NULL){ | ||
| + | |||
| + | fprintf(stderr, | ||
| + | |||
| + | if(A!=NULL) free(A); | ||
| + | if(B!=NULL) free(B); | ||
| + | if(B!=NULL) free(C); | ||
| + | |||
| + | return -1; | ||
| + | } | ||
| + | |||
| + | for(i = 0; i < n*n; i++) { | ||
| + | A[i] = i; | ||
| + | B[i] = i; | ||
| + | } | ||
| + | |||
| + | //make BLAS 3 matrix matrix operation | ||
| + | //C = C + alpha.A.B + beta.C | ||
| + | dgemm_(" | ||
| + | |||
| + | // #elif defined(CBLAS) || defined(MKL) || defined(VECLIB) | ||
| + | | ||
| + | |||
| + | |||
| + | for(i=n-2; i< | ||
| + | | ||
| + | | ||
| + | |||
| + | printf(" | ||
| + | } | ||
| + | | ||
| + | } | ||
| + | |||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | return(0); | ||
| + | } | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| ====== LAPACK ====== | ====== LAPACK ====== | ||
| Ligne 62: | Ligne 139: | ||
| **Exemple : ** appel de la routine '' | **Exemple : ** appel de la routine '' | ||
| - | <code fortran> | + | <file fortran |
| program randomsys | program randomsys | ||
| Ligne 109: | Ligne 186: | ||
| end program randomsys | end program randomsys | ||
| - | </code> | + | </file> |
| **Compilation :** | **Compilation :** | ||