PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

two pointers
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Efortin



Joined: 19 Oct 2012
Posts: 6

PostPosted: Wed Oct 24, 2012 7:30 am    Post subject: two pointers Reply with quote

Hi everyone,

In my program (a big model) there are two pointers profiles%p(:), and coef%rfp_p(:), both are defined in the derived type data.

In one subroutine coef%rfp_p(:) = pres (which is read from the input file),

In the main program, after the allocate(profiles%p), there is
profiles%p(:) = coef%rfp_p(:)
but profiles%p can not get the data from coef%rfp_p, I printed out both sides, left is always 0.0, while the right side has correct value.

as pointers, I thought I could do these things:
a: profiles%p = coef%rfp_p
b: profiles%p => coef%rfp_p
c: profiles%p(:) =coef%rfp_p(:)
d: profiles%p(1:nlevels) = coef%rfp_p(1:nlevels)
e:
do ii = 1, nlevels
profiles%p(ii)=coef%rfp_p(ii)
end do

I tried these a,b,c,d,and e cases, and printed out the both side values. Then I found in a and c cases, profiles%p are always 0.0; For b case the model crashed because of signal 11. For d, the values of profiles%p for all of the dimenstion is equal to the last value of coef%rfp_p. Only in e case I got what I should have: the real value from coef%rfp_p.

As our computer adviser said only in e the compiler does not make any mistake. While in my model there are many places using the profiles%p, so I don't want to modify everywhere. Is there simple way to make this done? I doubt there is some thing can be done with the compiler, so any ideas? thanks you all in advance.

Efortin
Back to top
View user's profile
brentl



Joined: 20 Jul 2004
Posts: 132

PostPosted: Wed Oct 24, 2012 9:49 am    Post subject: Reply with quote

Hi,

We need a little more information. Which version of the compiler are you using? We'd like to see also the actual way coef and profiles are declared and allocated. If you could put together a little working code snippet, that would be great.
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Oct 24, 2012 9:50 am    Post subject: Reply with quote

Hi Efortin,

Can you post or send to PGI Customer Support (trs@pgroup.com) a reproducing example. We're not positive what's wrong but given your information if sounds like a compiler issue, but we'll need a full example to make sure.

Thanks,
Mat
Back to top
View user's profile
Efortin



Joined: 19 Oct 2012
Posts: 6

PostPosted: Wed Oct 24, 2012 11:05 am    Post subject: Reply with quote

Hi Mat and brentl,

thank you very much for reply, which is very supportive. I will try to make the complicated things simple and easily understandable.

the compiler I am using is Version 11.7, and I run this model in a Linux cluster. Also the same model is running in another IBM machine, from where we moved the model.

coef's declaration:(I put the part for the rfp_p)
type (rttov_coef), allocatable :: coef(:)
allocate (coef(nsensors) ,stat= alloc_status(6)) (nsensors is the dimenstion)
here is some information about type rttov_coef
Type rttov_coef
..
..
Real(Kind=jprb), Pointer :: rfp_p(:)
..
..
End Type rttov_coef


Similarly for profiles, here it is
type( profile_type ), allocatable :: profiles(:)
allocate(profiles(NOBTOV) , stat= alloc_status( 9)) (NOBTOV is the dimension for profiles)
do jo = 1, NOBTOV
allocate( profiles(jo) % p ( coef(no_id) % nlevels ) ,stat= alloc_status(14)) (here coef(no_id)%nlevels is the dimension of profiles%p
end do
for type profile_type, here it goes:
Type profile_type
..
Real(Kind=jprb), Pointer :: p(:)
..
End Type profile_type

I don't know if this information is enough for you.

Your suggestion is highly appreciated,

thanks,

Efortin
Back to top
View user's profile
Efortin



Joined: 19 Oct 2012
Posts: 6

PostPosted: Wed Oct 24, 2012 12:38 pm    Post subject: Reply with quote

Again,

for a reproducing example, in fact I made some simple example just using profiles%p and coef%rfp_p, it is normal. Also for coef$rfp_p it is from a RTTOV package, which have more than 50 subroutines. I don't know how to make an example for you?
While once in my model the problem is there. I really have no idea what to do with this problem. Any ideas?

thanks,

Efortin
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
Goto page 1, 2  Next
Page 1 of 2

 
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