Disable FMA in Compiler

How to disable and enable the FMA option of g++ compiler?
thirst4truthAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thirst4truthAuthor Commented:
Thank you for your help.
Appreciated.
0
thirst4truthAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software

From novice to tech pro — start learning today.