1

I am having partial success using the complex matrix multiplier method cblas_zgemm() as part of Intel's OneApi MKL (2022.2.0). I get a crash (access memory violation), on either Windows or Linux, when I use CblasConjTrans as, specifically, the second parameter. In the code below, note that the calls to b_mtimes() and mTimes() work (you can also see the sizes of the arrays A, B, C if that is relevant) and the call to c_mtimes() crashes, consistently.

Has anyone encountered this problem? Thanks.

#include "mtimes.h"
#include "CallProcessABF_EB_data.h"
#include "mtimes1.h"
#include "use_refblas.h"
#include "mkl_cblas.h"

// Variable Definitions

static const creal_T dc1{
0.0, // re
0.0  // im
};

// Function Definitions
//
//

namespace coder {
namespace internal {
namespace blas {

// *works*
void b_mtimes(const creal_T A[110592], const creal_T B[672], creal_T C[32256])
{
    if (use_refblas()) {
       ::coder::internal::refblas::b_mtimes(A, B, C);
    } else {
       cblas_zgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, (MKL_INT)2304,
            (MKL_INT)14, (MKL_INT)48, (double *)&dc, (double *)&A[0],
            (MKL_INT)2304, (double *)&B[0], (MKL_INT)48, (double *)&dc1,
            (double *)&C[0], (MKL_INT)2304);
    }
}

// *crashes*
void c_mtimes(const creal_T A[672], const creal_T B[2208000], creal_T C[644000])
{
   if (use_refblas()) {
       ::coder::internal::refblas::c_mtimes(A, B, C);
   } else {
       cblas_zgemm(CblasColMajor, CblasConjTrans, CblasNoTrans, (MKL_INT)14,
            (MKL_INT)46000, (MKL_INT)48, (double *)&dc, (double *)&A[0],
            (MKL_INT)48, (double *)&B[0], (MKL_INT)48, (double *)&dc1,
            (double *)&C[0], (MKL_INT)14);
   }
}

// *works*
void mtimes(const creal_T A[19200], const creal_T B[19200], creal_T C[2304])
{
   if (use_refblas()) {
      ::coder::internal::refblas::mtimes(A, B, C);
   } else {
      cblas_zgemm(CblasColMajor, CblasNoTrans, CblasConjTrans, (MKL_INT)48,
            (MKL_INT)48, (MKL_INT)400, (double *)&dc, (double *)&A[0],
            (MKL_INT)48, (double *)&B[0], (MKL_INT)48, (double *)&dc1,
            (double *)&C[0], (MKL_INT)48);
   }
}
PaulS
  • 11
  • 2

0 Answers0