PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Clone device object with allocatable proprierties

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
DavideP



Joined: 16 Aug 2013
Posts: 2

PostPosted: Sat Sep 07, 2013 9:39 am    Post subject: Clone device object with allocatable proprierties Reply with quote

Hi,

I want to pass an array of type variables to cuda kernel. I have a local copy of this array on my host (GLOM) and I want to clone it on my device memory (GLOM_d). For this reason I have declared device type variable as allocatable and after initialized the host variable I try to clone the variables with the following command:

Allocate(GLOM_d(ind_j), source=GLOM(ind_j));

I do not have any error in compilation, but I have a segmentation fault error in running time.

This error is coming out when I have changed some object properties from fixed dimension to allocatable.
Should I change something in my code to clone a type variable with allocatable properties?
Thank you in advance.
Davide
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6211
Location: The Portland Group Inc.

PostPosted: Mon Sep 09, 2013 2:50 pm    Post subject: Reply with quote

Hi Davide,

Quote:
Should I change something in my code to clone a type variable with allocatable properties?
Currently user defined types can only be fixed size when used on the device. It's one of our most requested features, but unfortunately there's a few technical obstacles that prevents us from implementing it. Hopefully it's something we can support in the future.

- Mat
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6211
Location: The Portland Group Inc.

PostPosted: Tue Sep 10, 2013 2:29 pm    Post subject: Reply with quote

Hi Davide,

Engineering had the following comment/question for you:

Quote:
From a pure Fortran point of view this should all work...however, I do have a question...

Is the user trying to replicate the ind_ith element into array GLOM_d of size ind_i? If so, their code is correct. If they are trying to clone the entire GLOM array (of size ind_i), then their allocate statement should be the following:

allocate(GLOM_d(ind_i), source=GLOM)

As of PGI 13.9, they can also write this statement as

allocate(GLOM_d, source=GLOM)

assuming they want to clone the entire array of GLOM


- Mat
Back to top
View user's profile
DavideP



Joined: 16 Aug 2013
Posts: 2

PostPosted: Sun Sep 15, 2013 4:50 am    Post subject: Reply with quote

Hi Mat,

thank you for your replies.

I was trying to replicate element by element the host array into the device. My compiler version is pgf95 13.7-0 64-bit target on x86-64 Linux -tp gh.

Each element of the array is an user defined type with several properties. At the beginning, I had every property with fixed dimension, and the copy definitely worked. Now, in order to increase the flexibility of the program, I have changed some of these properties to allocatable and the segmentation fault error is appeared.

I use a subroutine to initialize the host elements and after your reply I have tried also to allocate the single allocatable properties of the device element, but without results. Probably, how you said, these allocation are not already supported.
I tried:
a)
ALLOCATE(GLOM_d(ind_i)%property(host_dim))

where ind_i is the index of the array and host_dim is the initialized properties dimension of the host array. In running time, it generates the following error" error 0: copyout Memcpy (host=0x7f32c0dbe020, dev=0x0, size=8394735960) FAILED: 11(invalid argument)", even if host_dim variable is replaced by the correct integer number.
b)

ALLOCATE(GLOM_d(ind_i)%property,GLOM(ind_i)%property)

In this case I get the following running error: "PGF90-S-0198-Illegal use of property in ALLOCATE/DEALLOCATE"

Any suggestions would be appreciated.
Thank you again.
Davide


mkcolg wrote:
Hi Davide,

Engineering had the following comment/question for you:

Quote:
From a pure Fortran point of view this should all work...however, I do have a question...

Is the user trying to replicate the ind_ith element into array GLOM_d of size ind_i? If so, their code is correct. If they are trying to clone the entire GLOM array (of size ind_i), then their allocate statement should be the following:

allocate(GLOM_d(ind_i), source=GLOM)

As of PGI 13.9, they can also write this statement as

allocate(GLOM_d, source=GLOM)

assuming they want to clone the entire array of GLOM


- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling 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 © phpBB Group