Question: Calculating MFLOPS Calculating MFLOPS ( Million Floating Point Operations Per Second ) directly on an Arduino can be challenging due to its limited computational capabilities
Calculating MFLOPS
Calculating MFLOPS Million Floating Point Operations Per Second directly on an Arduino can be
challenging due to its limited computational capabilities and lack of native floatingpoint hardware
support. However, we can approximate MFLOPS by performing a large number of floatingpoint
operations and measuring the time it takes to execute them.
By dividing the total number of floatingpoint operations by the execution time in seconds we can
obtain an approximation of MFLOPS.
#define NUMOPERATIONS Number of floatingpoint operations to perform
#define NUMITERATIONS Number of iterations to measure execution time
void setup
Serial.begin;
void loop
unsigned long startTime, endTime;
float result ;
startTime micros;
Perform floatingpoint operations
for int i ; i NUMITERATIONS; i
for int j ; j NUMOPERATIONS; j
Perform a simple floatingpoint operation eg addition
result ;
endTime micros;
Calculate execution time in seconds
float executionTimeSec endTime startTime;
Calculate MFLOPS
float mflops NUMOPERATIONS NUMITERATIONSexecutionTimeSec ;
Print results
Serial.printExecution Time seconds: ;
Serial.printlnexecutionTimeSec;
Serial.printMFLOPS: ;
Serial.printlnmflops;
delay; Delay before next iteration
Questions:
What is the approximation of MFLOPS measured on your Arduino?
The actual MFLOPS value obtained from this program may vary. List at least reasons why the
results may vary?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
