473,473 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calculating MFLOPS

Hi,

Can someone tell me how to calculate MFLOPS for the following C# code
(on a Pentium 4 2.0 Ghz)?

for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
{
for (k=0; k<n; k++)
{
C[i,j] = C[i,j] + A[i,k] * B[k,j];
}
}
}

Thanks!

Miller

Nov 15 '05 #1
3 5331
What's the point of calculating MFLOPS? What does it show us when
normally we can't get the maximum amount of floating point operations,
as we should. What can we normally tell with such a measure? I'm sure
two different compilers (doing different things) would give separate
results... so can we then predict how good or bad one is from the other?

Thanks

James

Anders Forsgren wrote:
If the process takes a fair amount of time, you can use the tick count or
current time to measure the time for completion. i.e. The number of
operations is
2*n^3 then divide by one million times the number of seconds to get the
approximate MFLOP count. Your processor model and clock really only matters
if you assume the thread is the only thread executing, which is not that
likely.

System.DateTime start = System.DateTime.Now;

for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
{
for (k=0; k<n; k++)
{
C[i,j] = C[i,j] + A[i,k] * B[k,j];
}
}
}

System.DateTime end = System.DateTime.Now;

double dt = now.Subtract(start).TotalSeconds;

double mflops = (2*n*n*n) / (1e6 *dt);

System.Diagnostics.Debug.WriteLine("Time : "+dt+" seconds, MFLOPS:
"+mflops);

Note however that this needs the time dt to be fairly long (i.e. n needs to
be fairly large).

/A



Nov 15 '05 #2

"James" <sn****@jamison.snort> wrote in message
news:3f********@clarion.carno.net.au...
What's the point of calculating MFLOPS? What does it show us when
normally we can't get the maximum amount of floating point operations,
as we should. What can we normally tell with such a measure? I'm sure
two different compilers (doing different things) would give separate
results... so can we then predict how good or bad one is from the other?


The MegaFLOP (million floating point operations per second) is an old
measure of supercomputer performance, dating from the days when
supercomputers ran at 50 MHz.

Many operating systems let you measure the CPU time of an individual thread.
That's how it was normally done, although I occasionally saw MFLOP ratings
based on "wall clock time" instead. In that case you'd do your best to keep
other threads from running during the test.
Nov 15 '05 #3

"Michael A. Covington" <Mi*****@CovingtonInnovations.com> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...

"James" <sn****@jamison.snort> wrote in message
news:3f********@clarion.carno.net.au...
What's the point of calculating MFLOPS? What does it show us when
normally we can't get the maximum amount of floating point operations, as we should. What can we normally tell with such a measure? I'm sure two different compilers (doing different things) would give separate
results... so can we then predict how good or bad one is from the
other?
The MegaFLOP (million floating point operations per second) is an old
measure of supercomputer performance, dating from the days when
supercomputers ran at 50 MHz.


Or you're desperately trying to sell Apple computers, in which
case you might as well claim it goes "1,000,000 MPH"

:)

-c
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
0
by: Kasp | last post by:
Hi there, I am trying to make an OLAP cube on a table having two columns (datetime, Number_of_times_an_event_occured). My dimension is time and I want to measure the Min and Max times an event...
1
by: Joe Bongiardina | last post by:
What does the message "calculating...." mean in the lower left status area of a form? I have a form with no calculated, concatenated or lookup fields, yet it displays this msg. The form takes...
1
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on...
0
by: robin9876 | last post by:
In an Access 2000 database on some forms 'Calculating...' is continuously displayed in the status bar window and the text of the control is automatically selected. The only workaround is switching...
5
by: sugaray | last post by:
Hi, my problem with calculating the size of an array is when I pass an array as a parameter to a function which perform the calculation, the result never comes right, like below: int...
1
by: Michael | last post by:
Is it possible to make a 1992 flops.c program by Al Alburto which compiled in VC++ 6.0 on Windows XP work on a Pocket PC with windows mobile 2003 second edition. I haven't programmed for a long...
25
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for...
1
by: laredotornado | last post by:
Hi, Can anyone recommend a free script for calculating UPS shipping? I am familiar with the script written in 2000 by Jason Costomiris, but UPS is using an XML interface and I wondered if...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.