oneDAL icon indicating copy to clipboard operation
oneDAL copied to clipboard

`xsyrk` vs `xxsyrk` vs `dsyrk` (in netlib LAPACK)

Open ajay-fuji opened this issue 1 year ago • 5 comments

Hi,

In the mkl function call, I have seen two types of call of same basic function, prefixed with x and xx .e.g, xsyrk and xxsyrk. What is difference between these two type of functions and how is it different from function implementation in netlib LAPACK or OpenBLAS.

ajay-fuji avatar Jun 05 '23 12:06 ajay-fuji

Reading MklLapack code you can find xx functions set number of threads to 1 locally:

template <CpuType cpu>
struct MklLapack<double, cpu>
{
    typedef DAAL_INT SizeType;

    static void xgetrf(DAAL_INT * m, DAAL_INT * n, double * a, DAAL_INT * lda, DAAL_INT * ipiv, DAAL_INT * info)
    {
        __DAAL_MKLFN_CALL(lapack_, dgetrf, (m, n, a, lda, ipiv, info));
    }

    static void xxgetrf(DAAL_INT * m, DAAL_INT * n, double * a, DAAL_INT * lda, DAAL_INT * ipiv, DAAL_INT * info)
    {
        int old_threads = fpk_serv_set_num_threads_local(1);
        __DAAL_MKLFN_CALL(lapack_, dgetrf, (m, n, a, lda, ipiv, info));
        fpk_serv_set_num_threads_local(old_threads);
    }
...
}

Alexsandruss avatar Jun 07 '23 11:06 Alexsandruss

Thankyou @Alexsandruss for your response. I still have two questions,

  1. Why xx.. version of function set number of local thread to 1. What are the cases when this function will be used?
  2. I can see xxgemm function call https://github.com/oneapi-src/oneDAL/blob/23786e6b02f6a0e10eccc31f00e737abef8319eb/cpp/daal/src/externals/service_blas_mkl.h#L140 doesn't set thread number to 1 but instead call a different function xdgemm. Please comment on this.

Thanks!

ajay-fuji avatar Jun 08 '23 05:06 ajay-fuji

@ajay-fuji is this still a pressing issue?

Braza avatar Feb 19 '24 16:02 Braza

I still want to understand reason behind setting local threads to 1 in one case (xx) not in other case.

ajay-fuji avatar Feb 21 '24 03:02 ajay-fuji