CULA_DEVICE_DSYEV-Segmentation fault

General CULA Dense (LAPACK & BLAS) support and troubleshooting. Use this forum if you are having a general problem or have encountered a bug.

CULA_DEVICE_DSYEV-Segmentation fault

Postby perrineedham » Thu Nov 29, 2012 10:27 am

Hi there,

I'm trying to run the device interface using fortran code but not having much luck. When I ran it using the host interface it ran fine but now, as I have CUDA Fortran code before and after the CULA routine, I need to use the device interface.

The segfault is happening on the call to the CULA routine CULA_DEVICE_DSYEV. Here is some of my code... please advise me of what I'm doing wrong.

Code: Select all
   
   subroutine formd(ftot,dtot,lowt,eigvec,eigval,scr1,scr2,
     &   scr9,scr10,nocc,iuhf)
      use cudafor
      use CULA

      implicit real*8(a-h,o-z)

#include "commongauss.inc"
#include "commonmopac.inc"

      dimension scr9(nbasis), scr10(2*nbasis)
      dimension ftot(lowt),dtot(lowt),eigvec(nbasis,nbasis),
     &     eigval(nbasis),scr1(nbasis,nbasis),scr2(4*nbasis)

      double precision,device,allocatable,dimension(:)::eigval_d
      double precision,device,allocatable,dimension(:,:)::scr1_d

      data zero /0.0d0/
      data one  /1.0d0/

!     Declare variables for timer
      real:: ctimeall
      integer:: count1, count4, ioutsecs,status,cuError
c
c     Initialise Arrays
c
      call sqzero(eigvec,nbasis)
      call ltzero(eigval,nbasis)
      call sqzero(scr1,nbasis)
      call ltzero(scr2,4*nbasis)
      call ltzero(scr9,nbasis)
      call ltzero(scr10,2*nbasis)

!     Allocate device memory
      allocate(scr1_d(nbasis,nbasis),eigval_d(nbasis))
c
c     Copy Fock to Work (for diagonaliser)
c
      ij=0
      do i=1,nbasis
         do j=1,i
            ij=ij+1
            scr1(i,j)=ftot(ij)
         enddo
      enddo
c
c     Diagonalise Fock (LAPACK)                                             
c
!     Copy to device
      eigval_d=eigval
      scr1_d=scr1
             
      status=CULA_DEVICE_DSYEV("V","L",nbasis,scr1_d,nbasis,eigval_d)

      CALL CULA_CHECK_STATUS(STATUS)
   
!     Copy  to host
      eigval=eigval_d
      scr1=scr1_d

.
. !(more code)
.
      end


FYI: CULA initialization and shutdown happens in the calling routine. CULA.mod contains the cula_check_status routine.

Any suggestions much appreciated.

Cheers,
Perri
perrineedham
 
Posts: 10
Joined: Mon Jul 09, 2012 3:39 am

Re: CULA_DEVICE_DSYEV-Segmentation fault

Postby perrineedham » Fri Nov 30, 2012 6:21 am

Could someone tell me if the CULA package allows for Fortran-device interfacing please? If not, how do I go about calling a CULA routine when I have CUDA Fortran kernels being executed both before and after the call for CULA as I don't think the Fortran-host interface allows for this?

Cheers,
Perri
perrineedham
 
Posts: 10
Joined: Mon Jul 09, 2012 3:39 am

Re: CULA_DEVICE_DSYEV-Segmentation fault

Postby john » Fri Nov 30, 2012 11:05 am

Please grab R16a and see the examples folder.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: CULA_DEVICE_DSYEV-Segmentation fault

Postby perrineedham » Tue Dec 04, 2012 3:22 pm

Hi John,

I've installed CUDA 5.0 and subsequently CULA r16a but now I can't get my program to compile. I've looked in to the examples and I'm pretty sure I've got all the correct library paths and library flags in my makefile:

Code: Select all
-L/opt/pgi/lib/ -I/usr/local/cula_r16a/include -L/usr/local/cula_r16a/lib64 -llapack -lblas -lcula_core -lcula_lapack -lacml_mp -lcublas -lcudart


This is the compilation error I'm getting:

Code: Select all
scf.o: In function `scf_cart_iter_cuda_':
/home/mbdx6pn2/work/full_SCF_combined/Algorithm_IV/parallelFconstruct_culaDiag/./scf.f:2197: undefined reference to `cula_shutdown_'
cula.o: In function `cula_cula_check_status_':
/home/mbdx6pn2/work/full_SCF_combined/Algorithm_IV/parallelFconstruct_culaDiag/./cula.f:54: undefined reference to `cula_get_error_info_'
/home/mbdx6pn2/work/full_SCF_combined/Algorithm_IV/parallelFconstruct_culaDiag/./cula.f:54: undefined reference to `cula_get_error_info_string_'
formd.o: In function `formd_':
/home/mbdx6pn2/work/full_SCF_combined/Algorithm_IV/parallelFconstruct_culaDiag/./formd.f:143: undefined reference to `cula_dsyev_'
zdogrd.o: In function `zdogrd':
/home/mbdx6pn2/work/full_SCF_combined/Algorithm_IV/parallelFconstruct_culaDiag/./zdogrd.f:166: undefined reference to `cula_initialize_'
make[1]: *** [muse.exe] Error 2
make[1]: Leaving directory `/home/mbdx6pn2/work/full_SCF_combined/Algorithm_IV/parallelFconstruct_culaDiag'
make: *** [default] Error 2


It's not recognising the calls to any of the CULA functions. I'm using pgfortran, so I presumed I wouldn't need to interface to the ISO_C_BINDINGS. Is this correct?

Cheers,
Perri
perrineedham
 
Posts: 10
Joined: Mon Jul 09, 2012 3:39 am

Re: CULA_DEVICE_DSYEV-Segmentation fault

Postby john » Wed Dec 05, 2012 9:35 am

Hello,
There was a significant revamp to the Fortran support in R16a, and all Fortran usage was converted to ISO_C_BINDING mode. You'll want to invoke the module files for this. There's an example showing usage, which has been tested against pgfortran.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron