|
| View previous topic :: View next topic |
| Author |
Message |
happyfish
Joined: 25 Jan 2011 Posts: 7
|
Posted: Sun Dec 09, 2012 5:56 am Post subject: Interface to a cublas subroutine zgeam |
|
|
I want to add two matrices. Thus I want to call zgeam, which is one of the extentions of cublas in cuda 5.0. Of course, if I want to call this subroutine in CUDA Fortran, I will have to write an interface to it. However, with following code, I get an error "Segmentation fault". Could anyone see why, please?
| Code: | module cublas_device
interface
subroutine cublas_device_zgeam( transa, transb, m, n, alpha, A, lda, beta, B, ldb, C, ldc) bind(C,name='cublasZgeam')
use iso_c_binding
character(1,c_char),value::transa,transb
integer(c_int),value::m,n,lda,ldb,ldc
complex(c_double_complex),value::alpha,beta
complex(c_double_complex),device::A(lda,*),B(ldb,*),C(ldc,*)
end subroutine cublas_device_zgeam
end interface
end module
PROGRAM main
use cudafor
use cublas_device
IMPLICIT NONE
INTEGER, PARAMETER :: M = 8
INTEGER, PARAMETER :: N = 8
INTEGER :: i,j,incx,incy
complex*16, device,allocatable::A_d(:,:),B_d(:,:),C_d(:,:)
complex*16 alpha,beta
ALLOCATE(A_d(M,N),B_d(M,N),C_d(M,N))
A_d = 1.0
B_d = 2.0
alpha = 1.0
beta = 1.0
beta = 1.0
call cublas_device_zgeam( 'N', 'N', m, n, alpha, A_d, m, beta, B_d, m, C_d, m)
END |
For me, other cublas subroutines work fine. But this one does not. |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Mon Dec 10, 2012 12:24 pm Post subject: |
|
|
Hi Happyfish,
The segv is being caused because the new CUBLAS has changed all their interfaces to return an error code. Hence, cublas_device_zgeam needs to be updated to be a function which returns an integer. Though, once you get past that, there will be other issues as well since it looks like these are now in the "V2" format. (for example you now need to pass in a handle and transa and transb need to be passed as integers)
We are in the process of adding these routines to our CUBLAS interface modules as well as CUDA 5.0 support. Hence, you may wish to wait until PGI 13.0 is released before using these new routines.
- Mat
Last edited by mkcolg on Tue Dec 11, 2012 8:52 am; edited 1 time in total |
|
| Back to top |
|
 |
happyfish
Joined: 25 Jan 2011 Posts: 7
|
Posted: Mon Dec 10, 2012 7:41 pm Post subject: |
|
|
| Many thanks. What are the differences between V1 and V2, please? Are there any examples for telling these differences when they are called? |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Tue Dec 11, 2012 8:51 am Post subject: |
|
|
Please see: http://docs.nvidia.com/cuda/cublas/index.html for documentation about CUBLAS. In particular, the differences between the old and new (V2) API can be found under the section "New and Legacy CUBLAS API".
- Mat |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|