- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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 ?
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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);