Ask Your Question
0

Fast math flags: ENABLE_FAST_MATH, and CUDA_FAST_MATH

asked 2019-11-21 03:31:51 -0600

Martian gravatar image

I've seen examples of cmake files that set flags ENABLE_FAST_MATH, and CUDA_FAST_MATH. That would seem logical in systems with CUDA installed.

But there are warnings, particularly for the 'ENABLE_FAST_MATH' option, where even the CMakeLists file comes with a built in warning "not recommended."

Are there any guidelines for setting these flags? Any idea why ENABLE_FAST_MATH would not be recommended?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-11-21 04:38:06 -0600

It is not recommended because the results of floating point calculations are not guaranteed to be IEEE compliant. See /fp:fast if you are compiling with Visual Studio or -ffast-math if you are using GCC.

edit flag offensive delete link more

Comments

Awesome that you knew this. I have no idea how you found enough info to make that connection, but it makes sense. I trust that this does not relate to the CUDA_FAST_MATH flag though...or does it?

Martian gravatar imageMartian ( 2019-11-21 04:44:28 -0600 )edit
1

Yes it does, see --use_fast_math for the switches this enables and this for a discussion on accuracy of the implementation.

cudawarped gravatar imagecudawarped ( 2019-11-21 05:00:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-11-21 03:31:51 -0600

Seen: 4,685 times

Last updated: Nov 21 '19