Skip to content

Commit

Permalink
OpenCBLAS cblas_dgeadd is useless
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffhammond committed Apr 15, 2024
1 parent eabc353 commit 17d24ec
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions Cxx11/transpose-cblas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,33 +118,32 @@ int main(int argc, char * argv[])

if (iter==1) trans_time = prk::wtime();

#if defined(MKL)
// T = transpose(A)
mkl_domatcopy('R','T', order, order, 1.0, &(A[0]), order, &(T[0]), order);
// B += T
cblas_daxpy(order*order, 1.0, &(T[0]), 1, &(B[0]), 1);
#elif defined(ACCELERATE)
#ifdef ACCELERATE_NEW_LAPACK
#if defined(ACCELERATE) && defined(ACCELERATE_NEW_LAPACK)
// B += transpose(A)
appleblas_dgeadd(CblasRowMajor,
CblasTrans, CblasNoTrans, // opA, opB
order, order, // m, n
1.0, &(A[0]), order, // alpha, A, lda
1.0, &(B[0]), order, // beta, B, ldb
&(B[0]), order); // C, ldc (in-place for B)
#else
#else
// T = transpose(A)
#if defined(MKL)
mkl_domatcopy('R','T', order, order, 1.0, &(A[0]), order, &(T[0]), order);
#elif defined(OPENBLAS_VERSION)
cblas_domatcopy(CblasRowMajor,CblasTrans, order, order, 1.0, &(A[0]), order, &(T[0]), order);
#elif defined(ACCELERATE)
vDSP_mtransD(&(A[0]), 1, &(T[0]), 1, order, order);
// B += T
cblas_daxpy(order*order, 1.0, &(T[0]), 1, &(B[0]), 1);
#endif
#else
#warning No CBLAS transpose extension available!
// B += transpose(A)
#else
#warning No CBLAS transpose extension available!
for (int i=0;i<order; i++) {
for (int j=0;j<order;j++) {
B[i*order+j] = A[j*order+i];
T[i*order+j] = A[j*order+i];
}
}
#endif
// B += T
cblas_daxpy(order*order, 1.0, &(T[0]), 1, &(B[0]), 1);
#endif
// A += 1
cblas_daxpy(order*order, 1.0, one, 0, &(A[0]), 1);
Expand Down

0 comments on commit 17d24ec

Please sign in to comment.