PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Compilation problems for loop parallelization
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
andref



Joined: 19 Apr 2012
Posts: 7

PostPosted: Tue Apr 24, 2012 2:16 pm    Post subject: Compilation problems for loop parallelization Reply with quote

Hello,

I would like to improve performances of my code using parallelization of a loop. The loop's data input are common for all loop cycles but the computations are clearly independent for each cycle. I think it is perfectly convenient for parallelization, though this loop calls a function which itself calls other subroutines and functions in chain but automatic inlining allows to make it parallelizable (at least to some extent, see below). The output of the loop is a 1D array of 'nf' complex numbers ('nf' being the number of cycles of the loop) which I want to finally export to a text file (separating real and imaginary parts of the complex number) for further processing with other softwares.

Here is the part of the code containing the loop I intend to parallelize:

Code:

273   !call acc_init(acc_device_nvidia)
274   !$acc region
275   !$acc do kernel, parallel, independent, private(k)
276   do k=1,nf
277      GxxV(k)=Gxxf(k,nl,d,c0,pi,fmin,df,eps,mu,sigma,alpha,dz,rho,theta,eta,zeta)
278   enddo
279   !$acc end region
280   open(unit=1,file='plmexjxFGPU64.out',status='replace')
281   do l=1,nf
282      write(1,*) real(GxxV(l)),imag(GxxV(l))
283   enddo
284   close(1)


The compiler command I used:

Code:
pgfortran plmexjx.f90 zbsubs.f machine.f90 -ta=nvidia -Minfo=accel -Minline,reshape -Mipa=inline,reshape


The compiler messages I got from it (Minfo=accel messages only):

Code:

plmexjx.f90:
zbsubs.f:
machine.f90:
plmexjx.f90:
PGF90-W-0155-Accelerator region ignored; see -Minfo messages  (plmexjx.f90: 274)
plmexjx:
    274, Accelerator region ignored
    276, Accelerator restriction: function/procedure calls are not supported
         277, Accelerator restriction: function/procedure calls are not supported
  0 inform,   1 warnings,   0 severes, 0 fatal for plmexjx
zbsubs.f:
machine.f90:
IPA: no IPA optimizations for 1 source files
IPA: Recompiling plmexjx.obj: new IPA information
plmexjx:
    274, Accelerator region ignored
    276, Accelerator restriction: size of the GPU copy of an array depends on values computed in this loop
                   277, Accelerator restriction: function/procedure calls are not supported
                   277, Accelerator restriction: : array accessed with too many dimensions, possibly due to inlining: ..inline
                        Accelerator restriction: : array accessed with too many dimensions, possibly due to inlining: real(..inline)
                        Accelerator restriction: : array accessed with too many dimensions, possibly due to inlining: imag(..inline)
                        Accelerator restriction: size of the GPU copy of '..inline' is unknown
                        Accelerator restriction: array accessed with too many dimensions, possibly due to inlining
                        Accelerator restriction: size of the GPU copy of an array depends on values computed in this loop
                        Accelerator restriction: one or more arrays have unknown size
              277, Accelerator restriction: size of the GPU copy of '..inline' is unknown
                   Accelerator restriction: loop has multiple exits
                   Accelerator restriction: one or more arrays have unknown size
                   Accelerator restriction: array accessed with too many dimensions, possibly due to inlining
  0 inform,   1 warnings,   0 severes, 0 fatal for plmexjx
IPA: Recompiling zbsubs.obj: new IPA information


I think several problems occured at compilation but I have difficulties in determining their origin:

1. Apparently some inlining problems are still remaining but I cannot locate them because the list of '-Minfo=inline' messages is so long that I cannot access the first messages in the compiler command window. Is there a way to export compilation messages to a text file...?
For this, I just saw your reply to my previous post. I am using command line shell PGI Workstation 12.4(64) on Windows. I tried what you suggested but did not succeed, but may be I did not catch the idea... I typed:
Code:

> pgfortran plmexjx.f90 zbsubs.f machine.f90 -ta=nvidia -Minfo=accel -Minline,reshape -Mipa=inline,reshape


and then:
Code:

> & logfile.txt

Is it correct?

I suspect these inlining problems to occur from the presence of GO TO statements in the last procedure called in the chain, which would cause 'loop multiple exits' (?). But this is strange to me because these GO TO statements only point inside the procedure (do not produce exit from it), and sequentially in the loop cycles

2. Due to inlining, I also have apparently problems with the output variable of the loop (GxxV), notably when I want to write the real and imaginary parts in the output text file. I tried to solve it including the 'independent' clause, but unsuccessfully. What is it due to?

3. One or more arrays have unknown size??? Though all array sizes have been explicitely allocated at variable declaration, before the loop

4. Array accessed with too many dimensions, possibly due to inlining... What does it mean, and how to solve it?

Thanks a lot in advance for your help.
Fred
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Apr 25, 2012 11:10 am    Post subject: Reply with quote

Hi Fred,

Quote:
Is it correct?
I you are using the CYGWIN bash shell that ships with the PGI Workstation on Windows, then yes. For DOS, I believe the command to redirect stderr is "command >2 logfilename.txt". Though, I'm not a DOS user.
Quote:

I suspect these inlining problems to occur from the presence of GO TO statements in the last procedure called in the chain, which would cause 'loop multiple exits' (?). But this is strange to me because these GO TO statements only point inside the procedure (do not produce exit from it), and sequentially in the loop cycles
Without seeing the code I can't be sure, but typically yes the GOTO would prevent the acceleration of a loop. However, my guess is that these messages pertain to the inner loop and would not prevent the outer loop from being parallelized.

Quote:
2. Due to inlining, I also have apparently problems with the output variable of the loop (GxxV), notably when I want to write the real and imaginary parts in the output text file. I tried to solve it including the 'independent' clause, but unsuccessfully. What is it due to?
Using independent is correct, however, the "..inline" unknown size is most likely causing the outer loop from being accelerated.

Quote:
3. One or more arrays have unknown size??? Though all array sizes have been explicitely allocated at variable declaration, before the loop.
4. Array accessed with too many dimensions, possibly due to inlining... What does it mean, and how to solve it?
"..inline" are compiler generated temp arrays which are by product of how inlining currently works. Unfortunately, this is an known limitation of using inlined routines with local arrays within accelerator regions. We are looking at fixes but the fix will require some fundamental changes in how inlining is performed. This work is currently planned for later this year once OpenACC development is completed. The current work-around is to manually inline these routines and then use the "private" clause to privatize these arrays.

Note, you are welcome to send your code to PGI Customer Service (trs@pgroup.com) and we will then us it as a test case.

Best Regards,
Mat
Back to top
View user's profile
andref



Joined: 19 Apr 2012
Posts: 7

PostPosted: Thu Apr 26, 2012 8:46 am    Post subject: Reply with quote

Dear Mat,

As you kindly proposed, I have sent the codes by email to PGI Customer Service with explanations and a description of the problems. Could you please confirm me good reception of my email?
Please, note that these codes should remain strictly confidential.

Regarding exportation of the compilation messages from the command window to a text file, I still have problems... I used CYGWIN and the file is now well created, but is empty. May be I missed something in the command lines?? I used:

Code:

> pgfortran plmexjx.f90 zbsubs.f machine.f90 -c -ta=nvidia -Minfo=inline -Minline,reshape -Mipa=inline,reshape

> & logfile.txt


Thank you very much again for your valuable help!!

Best regards,
Fred
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Apr 26, 2012 10:43 am    Post subject: Reply with quote

Hi Fred,

Quote:
Please, note that these codes should remain strictly confidential.
Understood.

Note that I'm in Boston attending a conference so most likely wont be able to work on this til next week. Sorry for the delay.

- Mat
Back to top
View user's profile
andref



Joined: 19 Apr 2012
Posts: 7

PostPosted: Fri Apr 27, 2012 7:22 am    Post subject: Reply with quote

Dear Mat,

OK no problem, I understand. We can wait for some extra days :-)

Note that I have sent a new email to your Customer Service with the original version of the code. In the one I have sent yesterday, I removed the call of zbsubs.f in func intexjx in order to test if the compilation problems might be due to this procedure (GO TO statements, notably) and I forgot to cancel this modification before sending it to you.
So now you have the correct code. Please excuse me for this clumsiness.

Best regards,
Fred
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
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