“Segmentation fault” when calling a device interface to cula

This code is modified from the fortran example.

PROGRAM CULA_TEST

use CULA

EXTERNAL CULA_INITIALIZE
EXTERNAL CULA_SGEQRF
EXTERNAL CULA_DEVICE_SGEQRF
EXTERNAL CULA_SHUTDOWN

INTEGER CULA_INITIALIZE
INTEGER CULA_SGEQRF
INTEGER CULA_DEVICE_SGEQRF


INTEGER M, N, K, STATUS
INTEGER,device:: M_d, N_d, K_d
PARAMETER ( M = 8192, N = 8192, K = 8192 )

REAL A(M, N)
REAL,device:: A_d(M, N)
REAL TAU(K)
REAL,device:: TAU_d(K)

A_d = A
M_d =M; N_d= N; K_d=K

STATUS = CULA_INITIALIZE()
STATUS = CULA_SGEQRF(M, N, A, M, TAU)
STATUS = CULA_DEVICE_SGEQRF(M_d, N_d, A_d, M_d, TAU_d)

CALL CULA_SHUTDOWN()
END

I want to test CULA_DEVICE_SGEQRF, thus I added the line

STATUS = CULA_DEVICE_SGEQRF(M_d, N_d, A_d, M_d, TAU_d)

However, I got “Segmentation fault”. Could you tell me why, please? Thank you very much!

Hi Happyfish,

In you CULA module, do you have interfaces to the CULA routines? If not, you will need to add them. Also, you’ll need to remove the external and integer declarations in favor of the interfaces.

Have you read our articles on interfacing with CULA?


  • Mat