Difference between revisions of "Example fbench"

From wiki.emacinc.com
Jump to: navigation, search
m (Marked buggy and annotated.)
Line 1: Line 1:
{{todo|Review(12.03.13-14:18->JG+);(12.04.13-03:15->MD-)|Jgreene|project=oe 4,oe 5,jg,md,Buggy}}
+
{{todo|Review(12.03.13-14:18->JG+);(12.04.13-03:15->MD-);(12.04.13-14:18->JG+)|Jgreene|project=oe 4,oe 5,jg,md,Buggy}}
'''NOTE ---- As I said before, we do not put program names, keywords from programming languages, shell commands, etc. in bold.  We put them in Courier using the code tag.  I did the first one for you.  You need to fix the rest of them.'''
 
 
 
 
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.
  
'''NOTE ---- Use of the second person tense is not acceptable for professional writing.  This needs to be worded differently.'''
+
Test the speed and accuracy of a machine's floating point operations. This project is a floating point benchmark and accuracy testing application that utilizes ray tracing algorithms and Fast Fourier Transforms to test your CPU and floating point library to it's limits. It's also a good example of a method of processor performance comparison and compiler optimization testing. It's an excerpt 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.
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.
 
  
The '''fbench''' project builds two executables: '''fbench''' and '''ffbench'''.
+
The <code>fbench</code> project builds two executables: <code>fbench</code> and <code>ffbench</code>.
  
'''NOTE ---- "it's actually" doesn't sound very professional.  "It was derived from," "It is based on," and "It utilizes" are all more professional.  If you're going to tell them this, then you should also give them a quick summary of what the algorithm is for rather than just pointing them at some non-EMAC webpage.'''
+
<code>fbench</code> is a trigonometry intensive floating point benchmark. It is a complete optical design raytracing algorithm, shorn of its ui.
'''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.
 
  
'''NOTE ---- Be careful about capitalization.  Remember that Fast Fourier Transform, in its entirety, is a proper name.  Therefore, it must always be capitalized fully, and always the same way.'''
+
<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.
'''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.
 
  
 
== Opening, Building and Uploading the Project Files ==
 
== Opening, Building and Uploading the Project Files ==
Line 37: Line 32:
 
===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.
'''NOTE ---- again, 2nd person, and again, too informal.'''
 
  
 
===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, with 1,000 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 1,000.
 
For archival purposes you'll want to use a value slightly higher than 1,000.
  
====Usage Example====
+
<syntaxhighlight lang="text">
'''NOTE ---- Make sure to look at how the text is displayed.  In this case, using console provided no benefit over using text, but had the drawback that half the text was printed in blue.  The Internal Wiki page provides a link to a page which tells all about the syntax highlighting of the plugin we use.  You should read over that page to see the different languages available.  The text "language" is often what we want for the console, since what we type on the console doesn't get syntax highlighted as we type (in bash, at least).  The console type is more for pasting scripts into a wiki page.'''
 
<syntaxhighlight lang="console">
 
 
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 81: Line 73:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
So we press return...
+
Press return...
''' NOTE: -----  again, 2nd person'''
+
 
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
 
No errors in results.
 
No errors in results.
 
</syntaxhighlight>
 
</syntaxhighlight>
  
...and '''fbench''' reports that no errors were found in our floating point operations. Hurrah!
+
...and '''fbench''' reports that no errors were found in our floating point operations.
''' NOTE: -----  Hurrah?  Really?'''
+
 
 
===Using ffbench===
 
===Using ffbench===
  
Line 107: Line 99:
 
==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 addressing processor performance comparison and compiler optimization. <s>I hope you enjoyed it as much as I did.</s>
+
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 addressing processor performance comparison and compiler optimization. We hope that you found this guide informative.
''' NOTE: -----  look at the last sentence.'''
 

Revision as of 12:16, 4 December 2013

TODO: {{#todo:Review(12.03.13-14:18->JG+);(12.04.13-03:15->MD-);(12.04.13-14:18->JG+)|Jgreene|oe 4,oe 5,jg,md,Buggy}}

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

Test the speed and accuracy of a machine's floating point operations. This project is a floating point benchmark and accuracy testing application that utilizes ray tracing algorithms and Fast Fourier Transforms to test your CPU and floating point library to it's limits. 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 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, shorn of its ui.

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

1. Open the C/C++ editing perspective.

stub

2. Open the fbench project files.

stub

3. Build the fbench project.

stub

4. Upload the fbench and ffbench executables to the target machine.

stub

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.

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 is finished it prompts us 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. NOTE: ----- looking in the code, you will find this bit:

#ifndef ACCURACY
        }

        printf("Stop the timer:\007");
        fgets(tbfr, sizeof tbfr, stdin);
#endif

NOTE: ----- As you can see above, the preprocessor define, ACCURACY, can be used to remove the wait. You should document both ways of building it. gcc has an argument that can be used to set preprocessor defines without having to modify the c program.

Stop the timer:

Press return...

No errors in results.

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

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.

NOTE: ----- The important thing to note about how long it takes is that this example is included so that customers can determine the relative speed of our different boards. The transformation is also not a "dance." 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.

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 addressing processor performance comparison and compiler optimization. We hope that you found this guide informative.