zheev with intel fortran

Open forum for general discussions relating to PLASMA.

zheev with intel fortran

Postby fingolfin » Sat Jan 11, 2014 7:11 pm

Hi.

I want to use plasma to solve hermitian eigenvalue problems in my fortran code. Initially I compiled and successfully run plasma with ATLAS. Although when I am running the code I get the following warning:

PLASMA WARNING: plasma_setlapack_numthreads():
==========================================================================================
WARNING you are calling a parallel section without linking with a multithread library
please compile with multi thread library and add -fopenmp(gcc)/-openmp(icc) to both
compilation and linkage flags
==========================================================================================

(I use -fopenmp in both compilation and linkage) I recon that this is because BLAS provided by ATLAS is sequential, am I correct?

However, I ran into problems when I tried to use PLASMA with intel fortran and mkl. I compiled PLASMA using intel c/fortran and mkl according to the steps given in readme file (by downloading reference cbas and lapack instead of using those provided by mkl). When I try to run exactly the same code that worked with ATLAS I am getting the following error message:

PLASMA ERROR: plasma_desc_check(): invalid matrix type
PLASMA ERROR: PLASMA_zheev_Tile_Async(): invalid descriptor

The code i'm using:

subroutine zheev_plasma(A, V, eig_val, npcores, info)
complex(idp), intent(inout) :: A(:,:)
real(dp), intent(inout) :: eig_val(:)
integer(i4b), intent(in) :: npcores
logical, intent(in) :: V
integer(i4b), intent(out) :: info

integer(i4b) :: n
type(c_ptr) :: descT

n = size(A, 1)

call PLASMA_init(npcores, info)
call PLASMA_Alloc_Workspace_zheev(n, n, descT, info)
call PLASMA_zheev(PlasmaNoVec, PlasmaUpper, n, A, n, eig_val, descT, A, n, info)
call PLASMA_finalize(info)

end subroutine zheev_plasma

Am I doing something wrong? Am I calling all routines correctly?
I'll appreciate any help :)

Thanks,
Jacek

UPDATE 1:

I ran run testing_zheev.c (provided with plasma distribution) (compiled with intel c with mkl) without a problem, which makes me even more confused.

UPDATE 2:

I think I have found the culprit. It is subroutine PLASMA_zheev, in it, descT is passed by value. When I corrected it to be passed by reference everything started to work properly. I don't really know why (never have done fortran/c bindings before) but it works.
fingolfin
 
Posts: 7
Joined: Wed Jan 01, 2014 6:07 pm
Location: Manchester, UK

Re: zheev with intel fortran

Postby mateo70 » Tue Jan 14, 2014 4:01 am

Hello Jacek,

Are you using PLASMA 2.5.2 or PLASMA 2.6.0, because this problem has been reported by Joe Dobson on http://icl.cs.utk.edu/plasma/forum/viewtopic.php?f=2&t=1691 and should be fixed in 2.6.0.

Regards,
Mathieu
mateo70
 
Posts: 92
Joined: Fri May 07, 2010 3:48 pm

Re: zheev with intel fortran

Postby haidar » Tue Jan 14, 2014 5:03 am

Hi Jacek,
First of all as Mathieu mention you need to use the latest version.
Second, the eigenvalue solver require a parallel lapack/blas routines to gives high performance for that
you need to compile with -fopenmp (gcc) -openmp (icc) and -PLASMA_WITH_MKL (when you compile using the mkl multithread version).
Third, when you compile using the Intel library you just need to install the cblas and lapacke otherwise link with -mkl (or use these lib: libmkl_core, libmkl_intel_lp64, libmkl_intel_thread).

Thank
Azzam
haidar
 
Posts: 13
Joined: Tue Sep 07, 2010 12:01 pm

Re: zheev with intel fortran

Postby fingolfin » Tue Jan 14, 2014 5:11 pm

Thank you guys for your responses.

Mathieu:
As for the version I am using the newest 2.6.0. I think this problem was fixed in allocation subroutines, for example PLASMA_Alloc_Workspace_zheev passes descT by reference but the driver subroutine PLASMA_zheev (and probably some other routines) still uses value, here is the routine copied form control/:

subroutine PLASMA_zheev(jobz,uplo,N,A,LDA,W,descT,Q,LDQ,info)
use iso_c_binding
implicit none
integer(kind=c_int), intent(out) :: info
integer(kind=c_int), intent(in) :: jobz
integer(kind=c_int), intent(in) :: uplo
integer(kind=c_int), intent(in) :: N
complex(kind=c_double_complex), intent(inout), target :: A(*)
integer(kind=c_int), intent(in) :: LDA
real(kind=c_double), intent(inout), target :: W(*)
type(c_ptr), value :: descT ! Arg managed by PLASMA: opaque to Fortran
complex(kind=c_double_complex), intent(inout), target :: Q(*)
integer(kind=c_int), intent(in) :: LDQ
info = PLASMA_zheev_c(jobz,uplo,N,c_loc(A),LDA,c_loc(W),descT,c_loc(Q),LDQ)
end subroutine PLASMA_zheev

Azzam:
That is exactly what I did and I was still getting that error until I removed value keyword in PLASMA_zheev.

I also have one more question but I will make a separate post out of it.

Thanks
Jacek
fingolfin
 
Posts: 7
Joined: Wed Jan 01, 2014 6:07 pm
Location: Manchester, UK

Re: zheev with intel fortran

Postby mateo70 » Tue Jan 14, 2014 5:19 pm

Hello Jacek,

Thanks for the report you are right, I completely forgot about those cases when Joe Dobson posted the problem on the workspace interfaces. I'll try to fix that as soon as possible.

Mathieu
mateo70
 
Posts: 92
Joined: Fri May 07, 2010 3:48 pm

Re: zheev with intel fortran

Postby fingolfin » Wed Jan 15, 2014 7:09 pm

Hi Mathieu,

no problem glad I could help. If I may, I have one more suggestion for the fortran wrappers. plasma_f90 defines 2 parameters for single and double precision:

integer, parameter :: sp = kind(0.0)
integer, parameter :: dp = kind(0.0d0)

it is just that names sp and dp are quite popular and often (as it was in my case) conflict with the rest of the program. Making them private would solve this problem.

Anyway, you guys are doing great job with the software!

Best Wishes
Jacek
fingolfin
 
Posts: 7
Joined: Wed Jan 01, 2014 6:07 pm
Location: Manchester, UK

Re: zheev with intel fortran

Postby mateo70 » Tue Jan 21, 2014 11:51 am

Hello Jacek,

Thanks for the tip on the sp/dp variable. I actually never use the fortran 90 interface and I haven't seen it.
Regarding the first bug you reported, I tryed to reproduce it, but I can"t.

Do you have a more complete example with the definition of i4b, idp, dp and the call to your function ?

Regards,
Mathieu
mateo70
 
Posts: 92
Joined: Fri May 07, 2010 3:48 pm

Re: zheev with intel fortran

Postby fingolfin » Wed Jan 22, 2014 4:36 pm

Hi Mathieu,

this is a complete code that should generate this bug (only if compiled with intel fortran)

program main
use plasma
use, intrinsic :: iso_c_binding
implicit none

integer, parameter :: idp = kind((0.0_dp,0.0_dp))
complex(idp) :: A(10, 10), B(10, 10)
real(dp) :: eig_val(10)
integer :: npcores, info, i, j
type(c_ptr) :: descT

npcores = 4

do i = 1, 10
do j = 1, 10
A(i, j) = real(i + j, dp) + (0, 1)*real(i - j, dp)
end do
end do

call PLASMA_init(npcores, info)
call PLASMA_Alloc_Workspace_zheev(10, 10, descT, info)
call PLASMA_zheev(PlasmaVec, PlasmaUpper, 10, A, 10, eig_val, descT, B, 10, info)
call PLASMA_finalize(info)

end program main

When I run the code it results in:

PLASMA ERROR: plasma_desc_check(): invalid matrix type
PLASMA ERROR: PLASMA_zheev_Tile_Async(): invalid descriptor

I have also one more question regarding zheevr. It seems impossible to use it to calculate all eigenvalues and no eigenvectors.
When I try jobz=PlasmaNoVec, range=PlasmaVec, PlasmaIVec, PlasmaAllVec I am getting: PLASMA ERROR: PLASMA_zheevr(): illegal value of jobz
Is it a bug or just zheevr is not intended to be used for calculation of eigenvalues only?

Best Wishes
Jacek
fingolfin
 
Posts: 7
Joined: Wed Jan 01, 2014 6:07 pm
Location: Manchester, UK


Return to User discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron