PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Compile bug?

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



Joined: 09 Feb 2006
Posts: 2

PostPosted: Thu Feb 09, 2006 4:39 pm    Post subject: Compile bug? Reply with quote

Here is a short Fortran 90 program that I think shows a compiler problem:

subroutine stats_data(bd)
implicit none
integer, parameter :: MAX_SOUND=100000
integer, parameter :: MAX_CHANNEL=15
integer :: i
integer :: isound=1
real, dimension(MAX_CHANNEL) :: bd
real, dimension(MAX_CHANNEL,MAX_SOUND) :: tovs_bt_dev=0.0


! Compiling with the next line takes 1000 times longer than
! compiling with the line after next instead!
integer :: ncount(MAX_SOUND)= (/(0,i=1,MAX_SOUND)/)
! integer :: ncount(MAX_SOUND)=0


tovs_bt_dev(:,isound)=bd(:)
end subroutine stats_data


Initializing the ncount array with the data statement style, compile time is 290 seconds; initializing with the othre style, compile time is 0.27 seconds. The compile command was:

pgf90 -c stats_data.o -g stats_data.f90

Compiler version is: pgf90 6.1-1 64-bit target on x86-64 Linux

Resulting object files are almost the same size, and are very large, scaling linearly with MAX_SOUND. The compile time with the slow method, however, is quadratic in MAX_SOUND.

I tested the same program with the SGI f90 compiler and the IBM xlf90 compiler, and they do not exhibit the compile time slowdown with the first method. The SGI compiler also produces an object file that is proportional in size to MAX_SOUND, while the IBM compiler does not.

So, is this definitely the compiler, or could it be some issue related to the (new) Linux cluster that this compiler is on, such as stack/heap space, etc?

Bill Campbell
Naval Research Laboratory
Monterey, CA
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Feb 10, 2006 11:54 am    Post subject: Reply with quote

Hi Bill,

Thanks from the post. I've passed you example on to our compiler team and created a technical problem report (TPR#3743) since I'm hoping we can do something about the compile time. Unfortunately, we can't do anything about the object size due to constraints in a Linux object file format.

What's occurring is that for each element of the array, an assembly directive must used to perform the data initialization. This directives become part of the object file and account for the large size. In the case of initializing the array to zero using "ncount(MAX_SOUND)=0", the compiler recognizes that this is a constant repeating value and does not need to perform the extra processing needed to initialize the array. Hopefully, our compiler team will be change the compiler to recognize this as well for the second case.

If the object size is a concern, you'll need to change the code to initial large arrays at runtime. On my system, when I remove the data initialization from "tovs_bt_dev" and "ncount" and add set these values are runtime, the object went from 6002032Kb to 1584Kb. Note that in this example, ncount is not used and hence not included in the final object. The size reduction is only attributed to "tovs_bt_dev" being initialized at runtime.

- 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