Problem with AMD FX-8150

Hello,

I’m having problem compiling my Fortran codes on an AMD FX-8150 running Debian Squeeze, kernel 2.6.32-5-amd64. I think I have
the latest installation of your compiler
elbereth-lionel:pgf90 -V

pgf90 12.5-0 64-bit target on x86-64 Linux -tp bulldozer
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2012, STMicroelectronics, Inc. All Rights Reserved.


This very simple program gives the wrong answer:

      program simplest
      implicit none
      real:: a1,a2,a3
!
      a1=1.0
      a2=10.0
      a3= a1*4.0 + a2*6.0
!
      write(6,*) ' '
      write(6,*) 'Correct answer: a3 = 1.0 * 4.0 + 10.0 * 6.0 = 64.0'
      write(6,*) ' '
      write(6,*) 'a1=',a1
      write(6,*) 'a2=',a2
      write(6,*) 'a3=',a3
      stop
      end

elbereth-lionel:pgf90 simplest.f -o simplest
elbereth-lionel:./simplest

Correct answer: a3 = 1.0 * 4.0 + 10.0 * 6.0 = 64.0

a1= 1.000000
a2= 10.00000
a3= 34.00000
FORTRAN STOP

[/quote]

Hi lionel@predsci.com,

This is very odd. I’ve tried to repeat your result on several systems, but always get the correct value of 64.

To help narrow this down, please add the flags “-Mkeepasm -Manno” to your compile and then send the resulting “simplest.s” file, along with you simplest executable to PGI Customer Service (trs@pgroup.com). Please ask them to forward these to me and I’ll see if I can determine the cause of the problem.

Thanks,
Mat

I sent you what you asked for. But perhaps I can also give you an account on my machine.

Hi lionel,

When I run your binary I can recreate the error. However, if I assemble the simplest.s file, the resulting binary runs fine. To me, this indicates a problem with your assembler. What version do you have installed? (i.e. ‘as --version’).

Thanks,
Mat

% simplest

 Correct answer: a3 = 1.0 * 4.0 + 10.0 * 6.0 = 64.0

 a1=    1.000000
 a2=    10.00000
 a3=    34.00000
FORTRAN STOP
% pgf90 -o s simplest.s -V12.5
% s

 Correct answer: a3 = 1.0 * 4.0 + 10.0 * 6.0 = 64.0

 a1=    1.000000
 a2=    10.00000
 a3=    64.00000
FORTRAN STOP

That’s what I get:

elbereth-lionel:as -v
GNU assembler version 2.20.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.20.1-system.20100303

Thanks to a suggestion from a colleague, I discovered that this works:


elbereth-lionel:pgf90 -tp=amd64e simplest.f -o simplest
elbereth-lionel:./simplest

Correct answer: a3 = 1.0 * 4.0 + 10.0 * 6.0 = 64.0

a1= 1.000000
a2= 10.00000
a3= 64.00000
FORTRAN STOP

But I guess this would slow down a production code.

My best guess is that your assembler has a bug in where it’s not generating FMA instructions correctly. By targeting an older processor, the FMA instructions are not used and hence, you get correct answers.

Do you mind updating your binutils and see if it corrects the problem?

Thanks,
Mat

It works with this
GNU assembler (GNU Binutils for Debian) 2.20.1-system.20100303

Thanks!