c++ - Can I pass a subset of a matrix into another function in MKL? -
i trying optimize lot of matrix calculations in mkl requires me allocate large blocks of memory using :
double* test_matrix = (double*)mkl_malloc(n * sizeof(double), 64)
.
recently, have been finding lot of memory allocation errors popping - hard replicate , harder debug. worried there internal header data mkl puts heap not accounting using current method.
is there "official" way of passing subset of mkl matrix function? passing copy increase overhead much. giving reference of matrix subset this:
double* = (double*)mkl_malloc(4 * 4 * sizeof(double), 64); double* b = (double*)mkl_malloc(4 * 4 * sizeof(double), 64); double* c = (double*)mkl_malloc(2 * 2 * sizeof(double), 64); ... fill in values , b ... cblas_dgemm(cblasrowmajor, cblasnotrans, cblasnotrans, 2, 2, 2, 1, &a[2], 4, &b[2], 4, 0, c, 2); cout << "result is: " << c[0] << c[1] << c[2] << c[3] << endl;
what did official way reference sub-matrix.
one of important reasons blas functions take leading dimensions of matrices input parameters enable easy referencing sub-matrix without data copy.
Comments
Post a Comment