Difference between revisions of "Example fbench"

From wiki.emacinc.com
Jump to: navigation, search
(Added OE5 instructions)
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{todo|Review(12.03.13-14:18->JG+)|Jgreene|project=oe 4,oe 5,jg,md,InProgress}}
+
{{todo|SEOKWREV (12.03.13-14:18->JG+);(12.04.13-03:15->MD-);(12.04.13-13:56->JG+);(12.10.13-00:10->MD+);(01.03.13-18:41->MW+);(01.03.14-18:55->MD+);(04.02.14-17:00->BS+);(04.10.14-13:45->BS+)|Jgreene|project=oe 4,oe 5,jg,md,SEOKWREV,mw,bs}}
This is a guide to the '''fbench''' C example project included in the EMAC OE SDK.
 
  
How fast does your machine execute floating point operations? How accurate are those operations? This project is a floating point benchmark and accuracy testing application that utilizes ray tracing algorithms. It's also a good example of a method of processor performance comparison and compiler optimization testing. It's an excerpt from the '''fbench''' project by John Walker of Fourmilab. See [http://www.fourmilab.ch/fbench/ John Walker's '''Floating Point Benchmarks''' project homepage] for more information.
+
{{#seo:
 +
|title=Example fbench
 +
|titlemode=append
 +
|keywords=Floating Point Operation,Floating Benchmark,Floating Point Unit
 +
|description=This is a guide to the <code>fbench</code> C example project included in the EMAC OE SDK.
 +
}}
 +
This is a guide to the <code>fbench</code> C example project included in the EMAC OE SDK.
  
The '''fbench''' project builds two executables: '''fbench''' and '''ffbench'''.
+
The project contains a floating point benchmark which tests the accuracy and speed of floating point operations on the target systems. The testing application utilizes floating point intensive ray tracing  and Fast Fourier Transform algorithms to stress the processor. This project contains excerpts from the <code>fbench</code> project by John Walker of Fourmilab. See [http://www.fourmilab.ch/fbench/ John Walker's '''Floating Point Benchmarks''' project homepage] for more information.
  
'''fbench''' is a floating point benchmark. It's actually a complete optical design raytracing algorithm based on the ''Marinchip Interactive Lens Design System''. See [http://www.fourmilab.ch/fbench/fbench.html John Walker's '''fbench''' project homepage] for more information.
+
The <code>fbench</code> project builds two executables: <code>fbench</code> and <code>ffbench</code>.
  
'''ffbench''' is a Fast Fourier Transform benchmark. It loops through a fast Fourier transform of a square matrix of complex numbers, reverses the transform and then checks the results. See [http://www.fourmilab.ch/fbench/ffbench.html John Walker's '''ffbench''' project homepage] for more information.
+
<code>fbench</code> is a trigonometry intensive floating point benchmark. It is a complete optical design raytracing algorithm without the user interface.
 +
 
 +
<code>ffbench</code> is a Fast Fourier Transform benchmark. It loops through a fast Fourier transform of a square matrix of complex numbers, reverses the transform and then checks the results.
  
 
== Opening, Building and Uploading the Project Files ==
 
== Opening, Building and Uploading the Project Files ==
  
<big>1. Open the C/C++ editing perspective.</big>
+
For information on opening the project from within Eclipse, please see [[Importing the EMAC OE SDK Projects with Eclipse]]. Then, follow [[Using the EMAC OE SDK Projects with Eclipse]] for information on how to build, upload and execute the example.
 
 
stub
 
 
 
<big>2. Open the fbench project files.</big>
 
 
 
stub
 
  
<big>3. Build the fbench project.</big>
+
Alternatively, the <code>Makefile</code> can be used with the <code>make</code> command from the commandline to build and upload the example.  For information on this method, please see [[Using EMAC OE SDK Example Projects]].
  
stub
+
====EMAC SDK 5.X====
  
<big>4. Upload the fbench and ffbench executables to the target machine.</big>
+
For information on opening the project from within QtCreator, please see [[Getting_Started_With_Qt_Creator#Adding_Source_Files | QtCreator: Adding Source Files]]. Then, follow [[Getting Started With Qt Creator]] for information on how to build, upload and execute the example.
  
stub
+
Alternatively, the <code>CMakefile.txt</code> can be used with the <code>cmake</code> command from the commandline to build and upload the example.  For information on this method, please see [[Getting_Started_with_the_EMAC_OE_SDK#Target_Machine_Compiling | Getting Started with the EMAC OE SDK]].
  
 
==Usage and Behavior==  
 
==Usage and Behavior==  
Line 32: Line 33:
 
===Hardware Requirements===
 
===Hardware Requirements===
  
The '''fbench''' project is intended for use on C implementations that define '''int''' as 32 bits or longer and permit allocation and direct addressing of arrays larger than one megabyte. If your target does not meet these requirements then you're going to have a bad time.
+
The <code>fbench</code> project is intended for use on C implementations that define <code>int</code> as 32 bits or longer and permit allocation and direct addressing of arrays larger than one megabyte.
  
 
===Using fbench===
 
===Using fbench===
  
The '''fbench''' program is executed from the console. It takes a single optional parameter.
+
The <code>fbench</code> program is executed from the console. It takes a single optional parameter.
  
  ./fbench <itercount>
+
  <code>./fbench <itercount></code>
  
Where <itercount> specifies the number of iterations to be performed, 1000 being the default.<br />
+
Where <itercount> specifies the number of iterations to be performed, with 1,000 being the default.<br />
For archival purposes you'll want to use a value slightly higher than 1000
+
For archival purposes you'll want to use a value slightly higher than 1,000.
  
 
====Usage Example====
 
====Usage Example====
  
<syntaxhighlight lang="console">
+
<syntaxhighlight lang="text">
 
root@som9g20:/tmp# ./fbench 2000
 
root@som9g20:/tmp# ./fbench 2000
 
Ready to begin John Walker's floating point accuracy
 
Ready to begin John Walker's floating point accuracy
Line 58: Line 59:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
After '''fbench''' is finished it prompts us to stop the timer (by pressing return).
+
After <code>fbench</code> has finished it prompts the user to stop the timer (by pressing return).
'''HEY MIKE it successfully runs through all iterations of it's process (I tested it with some debug code) but should it really just hang at the end waiting for your keypress? I doubt it. Further investigation is called for.'''
+
 
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
 
Stop the timer:
 
Stop the timer:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
So we press return...
+
Press return...
  
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
Line 70: Line 71:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
...and '''fbench''' reports that no errors were found in our floating point operations. Hurrah!
+
...and <code>fbench</code> reports that no errors were found in the floating point operations.
 +
 
 +
====A Note on Suspicious Systems====
 +
 
 +
The default functionality as described above is for systems that can be trusted to be reliable. When working with a system that is suspected of having issues, <code>fbench</code> can be compiled with <code>ACCURACY</code> defined. This will generate a version that executes as an infinite loop, performs the ray trace and checks the results on every pass. All incorrect results will be reported. It will keep running until it is stopped manually (using, for instance, CTRL-C).
  
 
===Using ffbench===
 
===Using ffbench===
  
The '''ffbench''' program is executed from the console. It takes no parameters.
+
The <code>ffbench</code> program is executed from the console. It takes no parameters.
  
 
  ./ffbench
 
  ./ffbench
Line 85: Line 90:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
It runs until it is finished (30 seconds or so, depending on the speed of your machine). It performed 20 iterations of our ''Fast Fourier Transform'' dance and discovered no errors.
+
It runs until it is finished and reports what it discovered. In this case it performed 20 passes (the default, specified in code) and found no errors.<br />
 +
The time that it takes for this benchmark to run is an indicator of the performance of the board running it. When running it from a Bash shell, the execution time can be measured thusly:
 +
<code>time ./fbench</code>
  
 
==Summary==
 
==Summary==
  
The ''fbench'' floating point benchmark C example tests the speed and accuracy of your floating point operations. It also provides an excellent example of code addrewssing processor performance comparison and compiler optimization. I hope you enjoyed it as much as I did.
+
The <code>fbench</code> floating point benchmark C example tests the speed and accuracy of your floating point operations, and is interactive by default. The <code>ffbench</code> example, on the other hand, is non-interactive by default and can be readily used both for benchmarking a board's floating point performance and to test the accuracy of its FPU.

Revision as of 11:20, 25 September 2020

TODO: {{#todo:SEOKWREV (12.03.13-14:18->JG+);(12.04.13-03:15->MD-);(12.04.13-13:56->JG+);(12.10.13-00:10->MD+);(01.03.13-18:41->MW+);(01.03.14-18:55->MD+);(04.02.14-17:00->BS+);(04.10.14-13:45->BS+)|Jgreene|oe 4,oe 5,jg,md,SEOKWREV,mw,bs}}

This is a guide to the fbench C example project included in the EMAC OE SDK.

The project contains a floating point benchmark which tests the accuracy and speed of floating point operations on the target systems. The testing application utilizes floating point intensive ray tracing and Fast Fourier Transform algorithms to stress the processor. This project contains excerpts from the fbench project by John Walker of Fourmilab. See John Walker's Floating Point Benchmarks project homepage for more information.

The fbench project builds two executables: fbench and ffbench.

fbench is a trigonometry intensive floating point benchmark. It is a complete optical design raytracing algorithm without the user interface.

ffbench is a Fast Fourier Transform benchmark. It loops through a fast Fourier transform of a square matrix of complex numbers, reverses the transform and then checks the results.

Opening, Building and Uploading the Project Files

For information on opening the project from within Eclipse, please see Importing the EMAC OE SDK Projects with Eclipse. Then, follow Using the EMAC OE SDK Projects with Eclipse for information on how to build, upload and execute the example.

Alternatively, the Makefile can be used with the make command from the commandline to build and upload the example. For information on this method, please see Using EMAC OE SDK Example Projects.

EMAC SDK 5.X

For information on opening the project from within QtCreator, please see QtCreator: Adding Source Files. Then, follow Getting Started With Qt Creator for information on how to build, upload and execute the example.

Alternatively, the CMakefile.txt can be used with the cmake command from the commandline to build and upload the example. For information on this method, please see Getting Started with the EMAC OE SDK.

Usage and Behavior

Hardware Requirements

The fbench project is intended for use on C implementations that define int as 32 bits or longer and permit allocation and direct addressing of arrays larger than one megabyte.

Using fbench

The fbench program is executed from the console. It takes a single optional parameter.

./fbench <itercount>

Where <itercount> specifies the number of iterations to be performed, with 1,000 being the default.
For archival purposes you'll want to use a value slightly higher than 1,000.

Usage Example

root@som9g20:/tmp# ./fbench 2000
Ready to begin John Walker's floating point accuracy
and performance benchmark.  2000 iterations will be made.


Measured run time in seconds should be divided by 2
to normalise for reporting results.  For archival results,
adjust iteration count so the benchmark runs about five minutes.

Press return to begin benchmark:

After fbench has finished it prompts the user to stop the timer (by pressing return).

Stop the timer:

Press return...

No errors in results.

...and fbench reports that no errors were found in the floating point operations.

A Note on Suspicious Systems

The default functionality as described above is for systems that can be trusted to be reliable. When working with a system that is suspected of having issues, fbench can be compiled with ACCURACY defined. This will generate a version that executes as an infinite loop, performs the ray trace and checks the results on every pass. All incorrect results will be reported. It will keep running until it is stopped manually (using, for instance, CTRL-C).

Using ffbench

The ffbench program is executed from the console. It takes no parameters.

./ffbench

Usage Example

root@som9g20:/tmp# ./ffbench
20 passes.  No errors in results.

It runs until it is finished and reports what it discovered. In this case it performed 20 passes (the default, specified in code) and found no errors.
The time that it takes for this benchmark to run is an indicator of the performance of the board running it. When running it from a Bash shell, the execution time can be measured thusly:

time ./fbench

Summary

The fbench floating point benchmark C example tests the speed and accuracy of your floating point operations, and is interactive by default. The ffbench example, on the other hand, is non-interactive by default and can be readily used both for benchmarking a board's floating point performance and to test the accuracy of its FPU.