- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Intel Forum,
I am developing a molecular dynamic system with a several MKL functions, the atoms position is a double **mat to the mkl function like cblas_dgemm. However, is necessary to convert the pointer ** to *, like:
void mv(double** m,double* v)
{
int i = 0, j = 0,z = 0;
for(i = 0; i < natom;i++)
{
for(j = 0; j < natom;j++)
{
v
}
}
}
Please, there is a way to use cblas_dgemm without this conversation ?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, cblas_dgemm() is simply a wrapper to dgemm() and so the data must be interoperable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Fabio,
is the pointer of double **mat point to a continuous memory? If yes, then you don't need to change, just feed the cblas_dgemm with
cblas_dgemm(&m[0][0], ...)
it should be ok
Best Regards,
Ying
Here is one sample:
A = (double *)mkl_malloc( m*k*sizeof( double ), 64 );
B = (double *)mkl_malloc( k*n*sizeof( double ), 64 ); C = (double *)mkl_malloc( m*n*sizeof( double ), 64 ); if (A == NULL || B == NULL || C == NULL) { printf( "\n ERROR: Can't allocate memory for matrices. Aborting... \n\n"); mkl_free(A); mkl_free(B); mkl_free(C); return 1; } printf (" Intializing matrix data \n\n"); for (i = 0; i < (m*k); i++) { A = (double)(i+1); } for (i = 0; i < (k*n); i++) { B = (double)(-i-1); } for (i = 0; i < (m*n); i++) { C = 0.0; } printf (" Computing matrix product using Intel® MKL dgemm function via CBLAS interface \n\n"); cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, A, k, B, n, beta, C, n);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply.
Is point to a continuous memory, i tried this solution, but the solution in different when i use this solution, even with Row ou Col major...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page