CULA_DGEMM not found in R17 using FORTRAN

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

CULA_DGEMM not found in R17 using FORTRAN

Postby quinioue » Fri May 24, 2013 6:33 am

I migrated to R17 cula dense library. But now, when I compile my source I obtain this message about CULA_DGEMM : undefined reference to `cula_dgemm_'
To test I adapted the FortranInterface example like this :

*
* CULA Example: Fortran Interface
*
* This example is meant to show a typical program flow when using CULA's
* fortran interface. Data resides in host memory and is automatically
* transferred to and from the GPU as needed.
*
* 1. Initialize CULA with CULA_INITIALIZE
* 2. Call CULA_SGEQRF
* 3. Call CULA_SHUTDOWN to free resources
*
* After each CULA operation, the status of CULA is checked. On failure, an
* error message is printed and the program exits.
*
* Note: this example performs the QR factorization on a matrix of zeros, the
* result of which is a matrix of zeros, due to the omission of ones across the
* diagonal of the upper-diagonal unitary Q.
*
PROGRAM CULA_TEST

use CULA_STATUS
use CULA_LAPACK

INTRINSIC MAX, MIN

INTEGER M, N, K, STATUS, L
PARAMETER ( M = 8192, N = 8192, K = 8192 )

REAL A(M, N)
REAL TAU(K)

REAL*8 AA(3,3), BB(3,3), CC(3,3), ALPHA, BETA

AA(1,1) = 1.
AA(2,1) = 1.
AA(3,1) = 1.
AA(1,2) = 1.
AA(2,2) = 1.
AA(3,2) = 1.
AA(1,3) = 1.
AA(2,3) = 1.
AA(3,3) = 1.

BB(1,1) = 1.
BB(2,1) = 1.
BB(3,1) = 1.
BB(1,2) = 1.
BB(2,2) = 1.
BB(3,2) = 1.
BB(1,3) = 1.
BB(2,3) = 1.
BB(3,3) = 1.

CC(1,1) = 1.
CC(2,1) = 1.
CC(3,1) = 1.
CC(1,2) = 1.
CC(2,2) = 1.
CC(3,2) = 1.
CC(1,3) = 1.
CC(2,3) = 1.
CC(3,3) = 1.

L = 3

WRITE(*,*) 'Initializing CULA'
STATUS = CULA_INITIALIZE()
CALL CULA_CHECK_STATUS(STATUS)

WRITE(*,*) 'Calling CULA_SGEQRF'
STATUS = CULA_SGEQRF(M, N, A, M, TAU)
CALL CULA_CHECK_STATUS(STATUS)

ALPHA = 1.
BETA = 1.

STATUS = CULA_DGEMM('N', 'N', L, L, L, ALPHA, AA, L, BB,
* L, BETA, CC, L)


WRITE(*,*) CC(1,1), CC(1,2), CC(1,3)

WRITE(*,*) 'Shutting down CULA'
CALL CULA_SHUTDOWN()
END

I used the Makefile, and I obtained the same message : fortranInterface.f:(.text+0x28b): undefined reference to `cula_dgemm_'

The same example in R16 works fine !

Have you an idea ?

Many thanks in advance
quinioue
CULA Academic
 
Posts: 9
Joined: Tue Feb 23, 2010 3:27 am

Re: CULA_DGEMM not found in R17 using FORTRAN

Postby john » Fri May 24, 2013 10:33 am

The Fortran modules were unchanged for R17, so I'm not sure why this would have worked in R16. I don't believe we've ever had a module file for BLAS, to my memory. You can easily add the declaration though, following the cula_lapack.f90 file as an example.

(This may have worked in R15 when we supported implicit linking from Fortran, but that proved unsafe and not very portable.)
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: CULA_DGEMM not found in R17 using FORTRAN

Postby quinioue » Sat May 25, 2013 5:44 am

Many thanks John, I simply added the declaration of the function and all works fine.
I don't know why, but in my configuration this declaration was not necessary in R16.
quinioue
CULA Academic
 
Posts: 9
Joined: Tue Feb 23, 2010 3:27 am

Re: CULA_DGEMM not found in R17 using FORTRAN

Postby bub2357 » Thu Nov 06, 2014 12:04 pm

I'm having similar problems.

1. Can you show me how you declared cula_dgemm?
2. How do I declare the modules besides a 'use' statement?



/opt/nn/s4/./s3.f:406: undefined reference to `cula_status_cula_check_status_'
/opt/nn/s4/./s3.f:406: undefined reference to `cula_dgemm_'
s3.o: In function `.STATICS1':
s3.f:(.data+0x280): undefined reference to `cula_status_'
s3.f:(.data+0x288): undefined reference to `cula_lapack_'
s3.f:(.data+0x298): undefined reference to `cula_type_'
pgacclnk: child process exit status 1: /usr/bin/ld
bub2357
 
Posts: 4
Joined: Mon Oct 27, 2014 12:27 pm

Re: CULA_DGEMM not found in R17 using FORTRAN

Postby quinioue » Fri Nov 07, 2014 4:39 am

I have just add these lines to cula_lapack.f90 :

interface
integer(C_INT) function cula_dgemm(transa,transb,m,n,k,alpha,a,lda,b,ldb,beta,c,ldc) &
BIND(C,NAME="culaDgemm")
! Consult the API Reference for all array sizes
use ISO_C_BINDING
character(C_CHAR), value :: transa
character(C_CHAR), value :: transb
integer(C_INT), value :: m
integer(C_INT), value :: n
integer(C_INT), value :: k
real(C_DOUBLE), value :: alpha
integer(C_INT), value :: lda
real(C_DOUBLE), dimension(lda,*) :: a
integer(C_INT), value :: ldb
real(C_DOUBLE), dimension(ldb,*) :: b
real(C_DOUBLE), value :: beta
integer(C_INT), value :: ldc
real(C_DOUBLE), dimension(ldc,*) :: c
end function
end interface
quinioue
CULA Academic
 
Posts: 9
Joined: Tue Feb 23, 2010 3:27 am


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron