3

我正在使用 MAGMA 从 Fortran 代码库中卸载 dsyevd 调用(它计算平方实对称矩阵 A 的所有特征值和特征向量),调用 MAGMA 例程的子例程如下。

subroutine sh_diag
! diagonalize the matrix a

use iso_c_binding

!interface to magma
!(jobz, uplo, ny, a, ny, evals, work, lwork, iwork, liwork, info)
interface
  subroutine turn_magma_on() bind(c,name='magma_init')
  end subroutine turn_magma_on
  subroutine dsyevd(jobz, uplo, ny, a, ny2, evals, work, lwork, iwork, liwor                                                                                                                k, info) bind(c,name='magma_dsyevd')

    import :: c_char
    import :: c_int
    import :: c_ptr

    integer(c_int), value :: jobz
    integer(c_int), value :: uplo
    integer(c_int), value    :: ny
    type(c_ptr), value       :: a
    integer(c_int), value    :: ny2
    type(c_ptr), value       :: evals
    type(c_ptr), value       :: work
    integer(c_int), value    :: lwork
    type(c_ptr), value       :: iwork
    integer(c_int), value    :: liwork
    type(c_ptr), value       :: info

  end subroutine dsyevd
end interface

real(wp), allocatable        :: work(:)
integer, allocatable         :: iwork(:)
integer                      :: lwork, liwork
real(wp)                     :: alpha, beta
integer          :: jobz, uplo
logical                      :: ismycol
real(wp)                     :: dnorm2
integer                      :: status, ii, nstrt, trilwmin
integer                      :: np, nq, lda, iproc, info, numroc
integer                      :: indxg2p, lwork1, ip, iq, imyrow, imycol
integer :: rows, cols
real(wp)                     :: t0, t1
integer                      :: c0, c1, cr
real(wp), external :: dnrm2




! initialize eigenvector distributed array, z.
 alpha = 0.0_wp
 beta = 1.0_wp
!     call pdlaset ('all', ny, ny, alpha, beta, z, 1, 1, descz)
!     np = mynumrows
!     nq = mynumcols5

! perform diagonalization:
 jobz = 302!'V'
 uplo = 121!'U'
 liwork = 3 + 5*ny
 lwork = 1 + 6*ny + 2*ny*ny

 allocate (work(lwork), iwork(liwork), evals(ny), stat=status)
 call error_check (status, 'sh_diag: allocation error')

 write (fo,'(/,a,/)') 'start of DSYEVD'
 write (*,*) 'Turn on MAGMA!'

 call turn_magma_on()
 write (*,*) 'MAGMA ON'


 call cpu_time (t0)
 call system_clock (count=c0)

 call dsyevd (jobz, uplo, ny, c_loc(a), ny, c_loc(evals), c_loc(work), lwork                                                                                                                , c_loc(iwork), liwork, c_loc(info))

 write (fo,'(/,a,/)') 'end of DSYEVD'
 call cpu_time (t1)
 write (fo,'(a,f16.4,a)') 'DSYEVD CPU time     = ', t1 - t0, ' secs'
 call system_clock (count=c1, count_rate=cr)
 write (fo,'(a,f16.4,a)') 'DSTEVD Elapsed time = ', REAL(c1-c0,wp) / &
         REAL(cr,wp), ' secs'

 call error_check (info, 'sh_diag: pdsyevd error')

 deallocate (work, iwork, stat=status)

 call error_check (status, 'sh_diag: deallocation error')

 evecs: do ii = 1, ny ! normalize eigenvectors
! indxg2p computes process coord which posseses entry of a
! distributed matrix specified by a global index INDXGLOB.
!        iproc = indxg2p(ii, descz(nb_), mycol, descz(csrc_), q)
!        ismycol = (iproc == mycol)
!        if (ismycol) then
!           call pdnrm2 (ny, dnorm2, z, 1, ii, descz, 1)

       dnorm2 = dnrm2(ny,z,1)
       alpha = 1.0_wp / REAL(dnorm2,wp)
       call dscal(ny, alpha, z, 1)
!        end if
 end do evecs
end subroutine sh_diag

MAGMA 库“开箱即用”

运行时,MAGMA 库失败,scif_writeto failed a for mic-1 with err 6 error in magma_mic_bindings 在第 152 行,我的问题是为什么?

我正在使用 MAGMA1.1,我的编译行是

 ifort -mkl -g -traceback -openmp -DHAVE_MIC -c *.f90

我的链接线是

ifort -mkl -g -traceback -openmp -DHAVE_MIC *.o  -Wl,--start-group -L/home/greg/magmamic-1.1.0/lib -lmicmagma -L../lib -lfxdr -lscif -lstdc++ -Wl,--end-group
4

0 回答 0