PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

-fast compiler instruction is producing incorrect results.
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
haz13



Joined: 17 Mar 2014
Posts: 13

PostPosted: Wed Mar 26, 2014 9:15 am    Post subject: -fast compiler instruction is producing incorrect results. Reply with quote

Hi all,

I am just trying to use pgfortran to compile a program for which I have used gfortran to compile in the past. When I ran the program I noticed I was getting both incorrect and NaN output. This was using these compiler flags:

Code:
pgfortran -Minfo=ccff -fast


When I recompiled without the '-fast' option, the answers come out corect and identical to the gfortran compiled code.

I am using the 14.3 release.

Any ideas what might be causing this would be great thanks. I am just going to try and change to using double precision rather than single to see if that makes any difference to the output.

EDIT: I replaced -fast with its individual components as follows:
Code:
-Mflushz -Mnoframe -Mlre -Mpre -Mcache_align -Mvect=simd -Munroll=c:1 -O2


I tested each flag and found that the last two, -Munroll=c:1 and -O2 each cause the incorrect values and NaN values, all the other flags are fine without either or both of those two. -O1 seems to work fine too.

Any help on the issue would be great, thanks.
Back to top
View user's profile
cparrott



Joined: 02 May 2011
Posts: 146

PostPosted: Wed Mar 26, 2014 12:20 pm    Post subject: Reply with quote

Hi Harry,

Can you either post a small snippet of the code that demonstrates the problem, or point us at a copy of the code? I would like to check this and see if we have a possible bug.

Also, if you could tell us the platform of the system you are running on, that would also be helpful. In particular, I would like to know what platform the PGI driver thinks it is generating code for. Please run pgcc with the "-V" flag, and note the platform after the "-tp" option below (e.g. "sandybridge" in this case):

$ pgcc -V

pgcc 14.3-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.

This will help us with trying to reproduce and isolate the problem.

Thanks in advance,

+chris
Back to top
View user's profile
haz13



Joined: 17 Mar 2014
Posts: 13

PostPosted: Fri Mar 28, 2014 7:18 am    Post subject: Reply with quote

My pgcc -V and pgfortran -V output are exactly the same as yours, i.e. version 14.3, linux x86_64 and -tp sandybridge.

The system has 2 x Intel Xeon E5-2650 CPUs which are Sandybridge-E architecture as far as I know... it also has 64GB RAM and a Nvidia Tesla K20c. It is running Ubuntu 13.04.

I have narrowed down the incorrect results to a function called 'applyBC' not functioning correctly in one of my modules. This module can be seen in the dropbox link at the bottom of this post. If you compile as following:

Code:
gfortran -O3 -ffast-math -funroll-loops --param max-unroll-times=4 -fno-protect-parens fieldtest.f95


and run the output file, you will see the correct result for 'applyBC'. If you compile the same file with:

Code:
pgfortran fieldtest.f95


you get the same result. However, trying the pgfortran with either -O2 or -Munroll=c:1 flags will change the applyBC result.

Hope this helps to work out why this is happening.

Here is the fieldtest.f95 file:

https://www.dropbox.com/sh/7qeih9y39vcr9sn/CBdvP3gR2D


Last edited by haz13 on Sat Mar 29, 2014 8:54 am; edited 1 time in total
Back to top
View user's profile
haz13



Joined: 17 Mar 2014
Posts: 13

PostPosted: Fri Mar 28, 2014 11:27 am    Post subject: Reply with quote

In the same file, I have also been testing out the filter function. (replace a%applyBC with a%filter in the test case) ... this compiles fine with no flags, but if I use the -acc flag then it compiles but changes the behaviour of the filter function. Again, gfortran compiles and runs that function fine. I have a feeling it is to do with how the compiler deals with pointers and using them in calculations.

Thanks, Harry
Back to top
View user's profile
haz13



Joined: 17 Mar 2014
Posts: 13

PostPosted: Mon Mar 31, 2014 8:15 am    Post subject: Reply with quote

UPDATE: The -acc flag is also causing the same incorrect result, meaning that I cannot compile any of my new sped up acc code because the -acc flag invalidates other areas of the program.

Is there a way to prevent the -acc flag operating on a certain portion of the file? E.g. get it to compile lines x-y without -acc, then the rest with? Just so I can have my applyBC and filter functions working normally...

Any help on this ASAP would be great as I am working to a tight deadline.

Thanks, Harry
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