• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 836
  • Last Modified:

Disable FMA in Compiler

How to disable and enable the FMA option of g++ compiler?
0
thirst4truth
Asked:
thirst4truth
  • 11
  • 9
1 Solution
 
Infinity08Commented:
FMA ?
0
 
thirst4truthAuthor Commented:
Yes, Fused-Multiply Add
0
 
Infinity08Commented:
use -mfused-madd to enable, and -mno-fused-madd to disable. Enabled is the default.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
thirst4truthAuthor Commented:
i tried to disable FMA with following command line, but It is followed by a error.

csci2>g++ -c -mno-fused-madd main.cpp heap.cpp
cc1plus: error: invalid option `no-fused-madd'
cc1plus: error: invalid option `no-fused-madd'

can you help with it ?

regards,
Sata
0
 
Infinity08Commented:
You are on an architecture that supports Fused-Multiply Add, aren't you (Mips for example) ?

What version of g++ do you have ?
0
 
thirst4truthAuthor Commented:
I believe it is a standalone sparc machine.

The following is the

csci2>g++ --version
g++ (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

csci2>uname -X
System = SunOS
Node = csci2
Release = 5.10
KernelID = Generic_118855-33
Machine = i86pc
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 4




0
 
Infinity08Commented:
Are you sure that your system supports fused multiply add ? I'm not sure whether Sparc does - I think Sparc64 does, but you'll have to check that.

In any case, gcc does not provide the -mno-fused-madd and -mfused-madd options for Sparc :

        http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/SPARC-Options.html#SPARC-Options
0
 
thirst4truthAuthor Commented:
Thank you for your hasten response.
1) How can I know that my system support FMA or not?

2) Does SUN provides its native C++ compiler through which I can disable and enable FMA?


 
0
 
Infinity08Commented:
I'm a bit surprised that you want to disable fused multiply add without even knowing whether your system supports it. Why do you want to disable it ?

Sun's C compiler - if it's installed - is cc.
0
 
thirst4truthAuthor Commented:
I am checking to see the performance of my program by enabling and disabling FMA.

I am currently working on a school server. I have no clue of how it is configured.

Also cc I believe is a C compiler. I am looking the SUN CPP compiler.

Thank you.

0
 
thirst4truthAuthor Commented:
I have used gcc on Intel machine this time, instead of Sparc. It throw me the following error:


csci>g++ -mno-fused-madd main.cpp heap.cpp
cc1plus: error: invalid option `no-fused-madd'
cc1plus: error: invalid option `no-fused-madd'
0
 
Infinity08Commented:
>> Also cc I believe is a C compiler.

Yes, that's what I said :)


>> I am looking the SUN CPP compiler.

That's CC


>> I have used gcc on Intel machine this time, instead of Sparc. It throw me the following error:

Try specifying the architecture using the -march flag.
0
 
thirst4truthAuthor Commented:
wow. cool.

CC works. However I am using FMA disbaling option.

csci2>CC -fma=none main.cpp heap.cpp
CC: Warning: Option -fma=none passed to ld, if ld is invoked, ignored otherwise
main.cpp:
heap.cpp:
ld: fatal: option -f and building a dynamic executable are incompatible
ld: fatal: Flags processing errors

Can u help me with this?

Thank you.

0
 
thirst4truthAuthor Commented:
Hi Expert

I learned that by default CC has FMA disabled (The default is -fma=none. ) and by default gcc has FMA enabled.

So If I compile a program with CC, it suppose to give me a.out file with FMA Disabled.
And again I will compile the same program with gcc, then it suppose to give me a.out file with FMA Enabled.

Am I correct?  Please correct me if I am wrong.

Thank you.
0
 
Infinity08Commented:
What's the point ? Comparing them would be meaningless, since you're using different compilers.

Did you read the link I posted ?
0
 
thirst4truthAuthor Commented:
I read your that posting, I didn't understood following :

Minimum requirements are -xarch=sparcfmaf and an optimization level of at least -xO2

How can I check these minimum requirements.

the -fma=fused currently giving be fatal error.

At this point, I need to show atleast why the fma option is not working?
0
 
Infinity08Commented:
They are the options that are required to be there for the fma=fused to work. Note that you'll need a Sparc64 for that as I said earlier.
0
 
thirst4truthAuthor Commented:
Thank you for your help.
Appreciated.
0
 
thirst4truthAuthor Commented:
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 11
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now