Author |
Topic: Find processor speed (Read 3249 times) |
|
howard roark
Full Member
Posts: 241
|
|
Find processor speed
« on: Dec 4th, 2008, 11:37pm » |
Quote Modify
|
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?
|
|
IP Logged |
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Find processor speed
« Reply #1 on: Dec 4th, 2008, 11:39pm » |
Quote Modify
|
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.
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Find processor speed
« Reply #2 on: Dec 5th, 2008, 12:44am » |
Quote Modify
|
on Dec 4th, 2008, 11:37pm, 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 Dec 4th, 2008, 11:39pm, 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.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Find processor speed
« Reply #3 on: Dec 5th, 2008, 7:07am » |
Quote Modify
|
on Dec 4th, 2008, 11:37pm, 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"? 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
|
|
IP Logged |
--SMQ
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Find processor speed
« Reply #4 on: Dec 5th, 2008, 8:40am » |
Quote Modify
|
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?
|
« Last Edit: Dec 5th, 2008, 8:48am by howard roark » |
IP Logged |
|
|
|
Eigenray
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 1948
|
|
Re: Find processor speed
« Reply #5 on: Dec 5th, 2008, 9:25am » |
Quote Modify
|
on Dec 4th, 2008, 11:37pm, 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.
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Find processor speed
« Reply #6 on: Dec 5th, 2008, 11:46am » |
Quote Modify
|
on Dec 5th, 2008, 8:40am, 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.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Find processor speed
« Reply #7 on: Dec 6th, 2008, 12:02pm » |
Quote Modify
|
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).
|
« Last Edit: Dec 6th, 2008, 2:10pm by Grimbal » |
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Find processor speed
« Reply #8 on: Dec 6th, 2008, 1:21pm » |
Quote Modify
|
Or use the optimization parameters of your compiler, and just to be safe, also compile to assembly to check.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Find processor speed
« Reply #9 on: Dec 7th, 2008, 11:13am » |
Quote Modify
|
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?
|
|
IP Logged |
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Find processor speed
« Reply #10 on: Dec 7th, 2008, 11:30am » |
Quote Modify
|
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)?
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Find processor speed
« Reply #11 on: Dec 7th, 2008, 11:42am » |
Quote Modify
|
on Dec 7th, 2008, 11:13am, 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.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Find processor speed
« Reply #12 on: Dec 7th, 2008, 11:49am » |
Quote Modify
|
on Dec 7th, 2008, 11:30am, 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.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
|