Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

Performance on Prng with Intel(R) C++ Compiler

vermue
Beginner
391 Views
Need to now the best performance of a prng on 100 Millions floating points numbers, generated with Intel C++ Compiler.

Prng algorithm: x=n*x+n*s+s*x-INT(n*x+n*s+s*x)

For more see:


Thanks

0 Kudos
3 Replies
TimP
Honored Contributor III
391 Views
I'll leave criticisms on technical grounds to those more expert on this subject. If you're asking about performance, either
n*(x+s)+s*x - int(n*(x+s)+s*x)
or
n*x+s*(n+x) - int(n*x+s*(n+x))
could prove faster with better control of roundoff (if you set /fp:source or similar option).
Do you capitalize INT to indicate use of an unspecified macro? Did you consider modf() ?
0 Kudos
vermue
Beginner
391 Views
Quoting - tim18
I'll leave criticisms on technical grounds to those more expert on this subject. If you're asking about performance, either
n*(x+s)+s*x - int(n*(x+s)+s*x)
or
n*x+s*(n+x) - int(n*x+s*(n+x))
could prove faster with better control of roundoff (if you set /fp:source or similar option).
Do you capitalize INT to indicate use of an unspecified macro? Did you consider modf() ?
No, INT=int; floor; fractional part...
I just want to now, if possible, the speed on Intel C++ Compiler, comparing to Intel Fortran (see: Floating Point prng on Intel Fortran for Linux and Mac forum):a small routine gives 100.000.000 in 1.3 sec.
I thing the algorithm n*x+n*s+s*x is faster thenn*(x+s)+s*x orn*x+s*(n+x), but??
0 Kudos
TimP
Honored Contributor III
391 Views
Quoting - vermue
No, INT=int; floor; fractional part...
I just want to now, if possible, the speed on Intel C++ Compiler, comparing to Intel Fortran (see: Floating Point prng on Intel Fortran for Linux and Mac forum):a small routine gives 100.000.000 in 1.3 sec.
I thing the algorithm n*x+n*s+s*x is faster thenn*(x+s)+s*x orn*x+s*(n+x), but??
The evident advantage of Fortran comes when you use the AINT intrinsic, with SSE2, avoiding possible unnecessary conversion and checks for (int) conversion overflow. modf() should do the same.
0 Kudos
Reply