PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

dynamically allocate an array of structure in cuda fortran?

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
steve.xu



Joined: 20 Feb 2012
Posts: 25

PostPosted: Mon Feb 20, 2012 8:44 pm    Post subject: dynamically allocate an array of structure in cuda fortran? Reply with quote

hi,everyone.
I am using cuda Fortran and the compiler is pgi11.8.
I want to allocate memory on device for an array of structure(say STRUCT1) ,whose member is another structure (say STRUCT2). The following is the skeleton of our code:
TYPE STRUCT2
INTEGER,ALLOCATABLE::A(:)
END TYPE

TYPE STRUCT1
TYPE(STRUCT2),ALLOCATABLE::B(:)
END TYPE

TYPE(STRUCT1),ALLOCATABLE,DEVICE::C(:)

INTEGER::NA=5,NB=5,NC=5
INTEGER::I,J

ALLOCATE(C(NC))
DO I=1,NC
ALLOCATE(C(I)%B(NB))
DO J=1,NB
ALLOCATE(C(I)%B(J)%A(NA))
END DO
END DO

when compiling it reports following warning:

/tmp/pgcudafori18dyVySZDk7.gpu(58): Warning: Cannot tell what pointer points to, assuming global memory space

when running it reports "Segmentation fault" runtime error.

The problem is cuda Fortran cannot allocate a structure array of unknow size. But this is the usual case in real applications such as CFD, the problem size (the dimension of grid block) is often determined at runtime.

Can i figure it out by using runtime API or some other alternative methods are available???
Any suggestion will be appreciate. Thanks in advance.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
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