wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
general >> wanted >> Find processor speed
(Message started by: hoogle on Dec 4th, 2008, 11:37pm)

Title: Find processor speed
Post by hoogle on Dec 4th, 2008, 11:37pm
Given a linux machine(to which you are remotely connected), how do you find the speed of the processor?

Also, given processor speed (say 2Ghz) how many processor cycles does comparison operation take?



Title: Re: Find processor speed
Post by hoogle on Dec 4th, 2008, 11:39pm
The reason I asked this question is the following:

I am working on distributed systems, I know the latency and bandwidth parameters of the system. I want to know computational power of the nodes so that I can analyze(derive) for what input size communication dominates computation and vice versa.

Title: Re: Find processor speed
Post by towr on Dec 5th, 2008, 12:44am

on 12/04/08 at 23:37:15, hoogle wrote:
Given a linux machine(to which you are remotely connected), how do you find the speed of the processor?
I think you can see it when you use "top", should show all the processes running, the amount of memory used and available, and CPU used and available.


Quote:
Also, given processor speed (say 2Ghz) how many processor cycles does comparison operation take?
Not sure. Also depends on whether the things being compared come from memory or are in registers (or even L1, L2 or L3 cache).


on 12/04/08 at 23:39:41, hoogle wrote:
The reason I asked this question is the following:

I am working on distributed systems, I know the latency and bandwidth parameters of the system. I want to know computational power of the nodes so that I can analyze(derive) for what input size communication dominates computation and vice versa.
Wouldn't it be simpler, and more accurate, to run a few benchmark tests? Because reality will probably get in the way of your model anyway.

Title: Re: Find processor speed
Post by SMQ on Dec 5th, 2008, 7:07am

on 12/04/08 at 23:37:15, hoogle wrote:
Given a linux machine(to which you are remotely connected), how do you find the speed of the processor?

Um, email the administrator?  "dmesg | grep BogoMips (http://en.wikipedia.com/wiki/BogoMips)"?


Quote:
Also, given processor speed (say 2Ghz) how many processor cycles does comparison operation take?

On most modern Intel cores, approximately 1/2 cycle if both operands are in registers, 1 cycle if one operand is in L1 cache and the other is in a register or both are in L1 cache, 2 cycles or more if one or both operands are in L2 cache or worse.  And as towr notes, there are approximations at best, depending strongly on what else the processor is doing at the time, especially in a multi-core processor.

--SMQ

Title: Re: Find processor speed
Post by hoogle on Dec 5th, 2008, 8:40am

Quote:
Wouldn't it be simpler, and more accurate, to run a few benchmark tests? Because reality will probably get in the way of your model anyway.


Actually I will be running my program on a cluster which will give me some dedicated processors(depends on how many I specify). However, I know that in spite of processors being dedicated they will be running something else other than my program.

Can you tell me an example of an benchmark tests to find out the time it takes to compare two integers on a processor?



Title: Re: Find processor speed
Post by Eigenray on Dec 5th, 2008, 9:25am

on 12/04/08 at 23:37:15, hoogle wrote:
Given a linux machine(to which you are remotely connected), how do you find the speed of the processor?

`cat /proc/cpuinfo` should give something useful.

Title: Re: Find processor speed
Post by towr on Dec 5th, 2008, 11:46am

on 12/05/08 at 08:40:57, hoogle wrote:
Can you tell me an example of an benchmark tests to find out the time it takes to compare two integers on a processor?
I'd make one relevant to the problem you're dealing with. So write a piece of code that is representative for the type of calculations you will do (preferably including memory/caching behaviour).
Then start a timer, loop through the code a million times (using registers for the loop-variable, to minimize it's impact), end the timer, and calculate the performance.

Title: Re: Find processor speed
Post by Grimbal on Dec 6th, 2008, 12:02pm
You could execute 2 similar loops, the only difference being that one of the loops has an extra comparison of 2 integers.  Then measure the time difference.

That must be written in assembler to make sure there is no side effect of the code optimization (a simpler loop could be better optimized).

Title: Re: Find processor speed
Post by towr on Dec 6th, 2008, 1:21pm
Or use the optimization parameters of your compiler, and just to be safe, also compile to assembly to check.

Title: Re: Find processor speed
Post by hoogle on Dec 7th, 2008, 11:13am

Quote:
I'd make one relevant to the problem you're dealing with. So write a piece of code that is representative for the type of calculations you will do (preferably including memory/caching behaviour).
Then start a timer, loop through the code a million times (using registers for the loop-variable, to minimize it's impact), end the timer, and calculate the performance.


Can we measure time  of the order 10**-9 seconds on the computer?



Title: Re: Find processor speed
Post by hoogle on Dec 7th, 2008, 11:30am

When we do analysis of sorting algorithms like merge sort and quicksort.... and we say the running time is O(nlogn)? What does nlogn represent, number of comparison operators??

If yes, total time taken by the computer should be of the order nlogn*(time it takes to perform one such operation)?

Title: Re: Find processor speed
Post by towr on Dec 7th, 2008, 11:42am

on 12/07/08 at 11:13:57, hoogle wrote:
Can we measure time  of the order 10**-9 seconds on the computer?
Possibly; however, I doubt your computer is so fast that the time it takes to do an operation a million (or billion) times is still in the order of nanoseconds.

Title: Re: Find processor speed
Post by towr on Dec 7th, 2008, 11:49am

on 12/07/08 at 11:30:38, hoogle wrote:
When we do analysis of sorting algorithms like merge sort and quicksort.... and we say the running time is O(nlogn)? What does nlogn represent, number of comparison operators??
It's a measure of the number of operations. For sorting the number of comparisons grow in the same way as the total number of operations in general.


Quote:
If yes, total time taken by the computer should be of the order nlogn*(time it takes to perform one such operation)?
Other operations can bring in an another factor. If for every comparison you have 100 other operation doing something, and they all take longer to do than a comparison, then your estimate would be way out of the ballpark.
Swapping probably takes more time per element than comparing.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board