ricosjp / monolish

monolish: MONOlithic LInear equation Solvers for Highly-parallel architecture
Apache License 2.0
197 stars 12 forks source link

SpMM of MKL is deprecated #1

Open t-hishinuma opened 3 years ago

t-hishinuma commented 3 years ago
/monolish/src/blas/matrix/matmul/crs-dense_matmul.cpp:102:33: warning: 'void mkl_dcsrmm(const char*, const int*, const int*, const int*, const double*, const char*, const double*, const int*, const int*, const int*, const double*, co     nst int*, const double*, double*, const int*)' is deprecated [-Wdeprecated-declarations]
                 &N, &beta, Cd, &N);
t-hishinuma commented 3 years ago

SpMV is same

MKL_DEPRECATED void mkl_scsrmv(const char *transa, const MKL_INT *m, const MKL_INT *k, const float *alpha, const char *matdescra, const float *val, const MKL_INT *indx, const MKL_INT *pntrb, const MKL_INT *pntre, const float *x, const float *beta, float *y);
t-hishinuma commented 3 years ago

MKL's new Inspector-executor Sparse BLAS Routines cannot be used. The argument of the create_csr routine for creating the sparse_matrix_t type is not const. The argument A of the monolish::blas::matvec function is const, and this format cannot be created.

https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines/matrix-manipulation-routines/mkl-sparse-create-csr.html

image

t-hishinuma commented 3 years ago

Forcibly cast to int*. There is no change in performance of SpMV.

classic I/F:

matvec(CRS)     CRS     double  10000   10000   0.000110554     14.6535
matvec(CRS)     CRS     double  20000   20000   0.000175322     18.4802
matvec(CRS)     CRS     double  30000   30000   0.000514798     9.44059
matvec(CRS)     CRS     double  40000   40000   0.00238485      2.71715
matvec(CRS)     CRS     double  50000   50000   0.00421577      1.92136
matvec(CRS)     CRS     double  60000   60000   0.00564782      1.72102
matvec(CRS)     CRS     double  70000   70000   0.00653013      1.73657
matvec(CRS)     CRS     double  80000   80000   0.00746742      1.73554
matvec(CRS)     CRS     double  90000   90000   0.00841104      1.73344
matvec(CRS)     CRS     double  100000  100000  0.00933097      1.73615

new I/F(create & matvec):

matvec(CRS)     CRS     double  10000   10000   0.000109638     14.7759
matvec(CRS)     CRS     double  20000   20000   0.000212052     15.2793
matvec(CRS)     CRS     double  30000   30000   0.000498984     9.7398
matvec(CRS)     CRS     double  40000   40000   0.00242847      2.66835
matvec(CRS)     CRS     double  50000   50000   0.00420735      1.9252
matvec(CRS)     CRS     double  60000   60000   0.00549661      1.76836
matvec(CRS)     CRS     double  70000   70000   0.00652856      1.73698
matvec(CRS)     CRS     double  80000   80000   0.00746487      1.73613
matvec(CRS)     CRS     double  90000   90000   0.00717496      2.03207
matvec(CRS)     CRS     double  100000  100000  0.00933017      1.7363

new I/F (create & matvec & hint(1)):

matvec(CRS)     CRS     double  10000   10000   0.000118202     13.7053
matvec(CRS)     CRS     double  20000   20000   0.000211634     15.3095
matvec(CRS)     CRS     double  30000   30000   0.000602609     8.06493
matvec(CRS)     CRS     double  40000   40000   0.00238416      2.71794
matvec(CRS)     CRS     double  50000   50000   0.00423535      1.91247
matvec(CRS)     CRS     double  60000   60000   0.00548881      1.77088
matvec(CRS)     CRS     double  70000   70000   0.00652054      1.73912
matvec(CRS)     CRS     double  80000   80000   0.00747639      1.73346
matvec(CRS)     CRS     double  90000   90000   0.0084184       1.73192
matvec(CRS)     CRS     double  100000  100000  0.00933107      1.73614

new I/F (create & matvec & hint(100)):

matvec(CRS)     CRS     double  10000   10000   0.000112358     14.4182
matvec(CRS)     CRS     double  20000   20000   0.000211269     15.3359
matvec(CRS)     CRS     double  30000   30000   0.000524846     9.25986
matvec(CRS)     CRS     double  40000   40000   0.00242533      2.6718
matvec(CRS)     CRS     double  50000   50000   0.00422171      1.91865
matvec(CRS)     CRS     double  60000   60000   0.00549899      1.7676
matvec(CRS)     CRS     double  70000   70000   0.00651909      1.73951
matvec(CRS)     CRS     double  80000   80000   0.0074591       1.73748
matvec(CRS)     CRS     double  90000   90000   0.00842636      1.73028
matvec(CRS)     CRS     double  100000  100000  0.00932407      1.73744

There is a function called hint, but I don't feel it works. It may be meaningless at runtime.

https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines/inspector-executor-sparse-blas-analysis-routines/mkl-sparse-set-mv-hint.html

t-hishinuma commented 3 years ago

SpMM in Inspector-executor Sparse BLAS Routines does not fit the answer for a rectangular matrix.