testing_dgels.cpp not running as expected

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
dariofigueira
Posts: 16
Joined: Wed Oct 31, 2018 12:06 pm

testing_dgels.cpp not running as expected

Post by dariofigueira » Wed Oct 31, 2018 1:06 pm

Hello,

The example code "testing_dgels.cpp" is seemingly failing to run properly.
At most calls it outputs "Intel MKL ERROR: Parameter .. was incorrect on entry to .."
Namely:

Code: Select all

lapackf77_dgels( MagmaNoTransStr, &M, &N, &nrhs, unused, &lda, unused, &ldb, tmp, &lhwork, &info );
where

Code: Select all

MagmaNoTransStr="NoTrans", int M=1088, int N=1088, int nrhs=1, double * unused[1], int lda=1088, int ldb=1088, double * tmp[1], int lhwork=-1, int info=-2
causes:

Code: Select all

Intel MKL ERROR: Parameter 2 was incorrect on entry to DGELS .
I'm in Windows, VS2017. Project solution generated by CMake with parameters:
  • CUDA_SDK_ROOT_DIR=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
    GPU_TARGET=Pascal
    LAPACK_LIBRARIES=mkl_intel_ilp64.lib;mkl_intel_thread.lib;mkl_core.lib;libiomp5md.lib (copied from IntelSWTools/parallel_studio_xe_2019.0.045/ compilers_and_libraries_2019/windows/mkl/lib/intel64_win)
    MKLROOT=D:/Program Files (x86)/IntelSWTools/parallel_studio_xe_2019.0.045/compilers_and_libraries_2019/windows/mkl
    USE_FORTRAN=Yes
Compiled and then Statically linked (/MT linker flag)

What more information do we need to unveil what is going on?

Doubt: Should I have set USE_FORTRAN=Yes?
Double doubt: lapackf77_dgels -> does this mean this is a Fortran 77 calling function? (Do I even have Fortran 77 in my laptop? I vaguely think I saw IntelSWTools only installing Fortran 90

Thank you

mgates3
Posts: 842
Joined: Fri Jan 06, 2012 2:13 pm

Re: testing_dgels.cpp not running as expected

Post by mgates3 » Wed Oct 31, 2018 1:53 pm

Instead of mkl_intel_ilp64, try mkl_intel_lp64. The former uses int64_t, the later uses int.

BLAS & LAPACK are written in Fortran, so when calling lapackf77_dgels it uses the Fortran77 interface that is provided by MKL. You don't need a Fortran compiler to get BLAS & LAPACK, as MKL provides them.

You can safely set USE_FORTRAN = No. MAGMA should compile fine, it just won't include Fortran wrappers. The testers will be lacking some checks, but should otherwise compile and run fine.

But if you compiled with USE_FORTRAN = Yes, then presumably CMake found your Fortran compiler and was able to compile the few optional Fortran files that MAGMA provides.

-mark

dariofigueira
Posts: 16
Joined: Wed Oct 31, 2018 12:06 pm

Re: testing_dgels.cpp not running as expected

Post by dariofigueira » Wed Oct 31, 2018 5:13 pm

Yup worked perfectly.

Now, "why?"

testing_dgels.cpp was written with 32-bit integer interface in mind, and thus, for a 64-bit integer the variable declaration

Code: Select all

    magma_int_t M, N, size, nrhs, lda, ldb, min_mn, max_mn, nb, info;
should be something else?

mgates3
Posts: 842
Joined: Fri Jan 06, 2012 2:13 pm

Re: testing_dgels.cpp not running as expected

Post by mgates3 » Wed Oct 31, 2018 7:30 pm

testing_dgels.cpp can work with either 32-bit or 64-bit integer. By default, magma_int_t is int (32-bit). If MAGMA_ILP64 is defined, then magma_int_t is long long (64-bit).
-mark

Post Reply