On the complexity order of algorithms (was: Re: AMD64 X2 questions)

2007-08-27 Thread Rogério Brito
On Aug 24 2007, Chris Ahlstrom wrote:
> I found this recent article (by a Microsoft guy!) in Dr. Dobbs to be
> interesting:
> 
>http://www.ddj.com/hpc-high-performance-computing/201202924
(...)
>   * Comparing O(1) and O(K)

Ugh! This article just shows that the Microsoft people should take some
classes in theoretical computer science, as O(1) is the very same thing
for O(K), if K is a constant.


Regards, Rogério Brito.

-- 
Rogério Brito : [EMAIL PROTECTED],ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-27 Thread Michael

Just FYI - a nice one is

$ taskset 01 yes | sha1sum
versus
$ taskset 03 yes | sha1sum

to see a dualcore's different affinities in a load monitor.

(Regards to Bob Prolux)


 m°



Re: AMD64 X2 questions

2007-08-26 Thread Jim Crilly
On 08/26/07 11:26:27PM +0200, Michael wrote:
> 
> Just to avoid confusion...cpuset seems to be the kernel thing, and taskset is 
> the related userspace tool ?
> 

Yes taskset is the userland tool for setting CPU affinity but it's only
for setting CPU affinity while cpusets also restrict the nodes from which
a process is allowed to allocate memory in addition to CPU affinity.

> > What is an 'optical imbalance'?
> 
> If one pane of the load-monitor is green and the other is black ;)
> It looks like it's not 'balanced' but you really clarified that issue now.
>

Ah, ok.

Jim.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-26 Thread Michael

Just to avoid confusion...cpuset seems to be the kernel thing, and taskset is 
the related userspace tool ?

> What is an 'optical imbalance'?

If one pane of the load-monitor is green and the other is black ;)
It looks like it's not 'balanced' but you really clarified that issue now.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-26 Thread Jim Crilly
On 08/25/07 01:22:50PM +0200, Michael wrote:
> 
> Thanks Lennart, thanks Jim, for the good points.
> I think i can accept the matter of facts ;) 
> 
> It's generally a great fun to read your postings. 
> Just let me say thx here for sharing your insight.
> That should apply to all those real freaks on this list.
> 
> kr micha
> 
> 
> ps. I imagine quadcore (and beyond) may be able to solve what appears a 
> little 'optical imbalance'.
> I would be interested to know if linux has specific schedulers for these 
> archs but it's probably getting offtopic - i think quadcore is still rare at 
> least in PC world yet.
> 

What is an 'optical imbalance'? 

No, Linux only has 1 CPU scheduler for all arches no matter how many CPUs
are there. You can use cpusets to constrain processes to a specific set of
memory and processors but they're never used automatically.

Jim.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-25 Thread Michael

Thanks Lennart, thanks Jim, for the good points.
I think i can accept the matter of facts ;) 

It's generally a great fun to read your postings. 
Just let me say thx here for sharing your insight.
That should apply to all those real freaks on this list.

kr micha


ps. I imagine quadcore (and beyond) may be able to solve what appears a little 
'optical imbalance'.
I would be interested to know if linux has specific schedulers for these archs 
but it's probably getting offtopic - i think quadcore is still rare at least in 
PC world yet.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-24 Thread Chris Ahlstrom
* Lennart Sorensen <[EMAIL PROTECTED]> [2007-08-24 09:27:34 -0400]:

> In fact if you have three processes to run and in total they need 90% of
> one cpu, then it is better to run it all on one cpu and let the other
> one go to power saving mode rather than running half the load on each.
> That does save power and reduce heat.

I found this recent article (by a Microsoft guy!) in Dr. Dobbs to be
interesting:

   http://www.ddj.com/hpc-high-performance-computing/201202924

August 03, 2007
How Much Scalability Do You Have or Need?
"Orders" of Throughput
 
  * How Much Scalability?
  * O(1): Sequential Code
  * O(K): Explicitly Threaded Code
  * Comparing O(1) and O(K)
  * O(N): Scalable Throughput And the Free Lunch

-- 
Tux rox!


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-24 Thread Lennart Sorensen
On Fri, Aug 24, 2007 at 01:04:16AM +0200, Michael wrote:
> Do you know if the kernel tries to balance load really equally ?
> For my 2core AMD64 it seems cpu0 has to be about >70% before cpu1 gets 
> involved. 
> Another idea is, i always see cpu0 is the most busy one. But wouldn't 
> switching the 'most busy cpu' from 0 to 1 at certain intervals (say, 3 
> seconds) reduce heat ?

If you have a single dual core cpu, then it shouldn't make any
difference.  Also if the cpu can't handle running at 100% load forever,
then the cooling system is misdesigned.  It is just normal to always use
the first cpu first.  And moving processes around causes cache flushes
which slows things down, and probably wastes more power moving data
around needlessly.

In fact if you have three processes to run and in total they need 90% of
one cpu, then it is better to run it all on one cpu and let the other
one go to power saving mode rather than running half the load on each.
That does save power and reduce heat.

--
Len Sorensen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-24 Thread Jim Crilly
On 08/24/07 01:04:16AM +0200, Michael wrote:
> Lennart,
> 
> > probably don't have any good reason to.  The scheduler does a great job
> 
> Do you know if the kernel tries to balance load really equally ?
> For my 2core AMD64 it seems cpu0 has to be about >70% before cpu1 gets 
> involved. 
> Another idea is, i always see cpu0 is the most busy one. But wouldn't 
> switching the 'most busy cpu' from 0 to 1 at certain intervals (say, 3 
> seconds) reduce heat ?
> 

It balances running processes but that's all it can do. So if you have 1
single-threaded process doing something it'll only run on 1 CPU and the
other will sit idle. Trying to balance that one process between both CPUs
would be horrendous for performance since it would constantly invalidate
the cache on each CPU causing that data to be reloaded from main memory.

Jim.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-23 Thread Ivan Paganini
I would like to know that also, my cpu0 is always under some load, and
the cpu1 usually just sit tight... when I am not running some
simulation.

2007/8/23, Michael <[EMAIL PROTECTED]>:
> Lennart,
>
> > probably don't have any good reason to.  The scheduler does a great job
>
> Do you know if the kernel tries to balance load really equally ?
> For my 2core AMD64 it seems cpu0 has to be about >70% before cpu1 gets 
> involved.
> Another idea is, i always see cpu0 is the most busy one. But wouldn't 
> switching the 'most busy cpu' from 0 to 1 at certain intervals (say, 3 
> seconds) reduce heat ?
>
>
>  m°
>
>


-- 
---
Ivan S. P. Marin
--



Re: AMD64 X2 questions

2007-08-23 Thread Michael
Lennart,

> probably don't have any good reason to.  The scheduler does a great job

Do you know if the kernel tries to balance load really equally ?
For my 2core AMD64 it seems cpu0 has to be about >70% before cpu1 gets 
involved. 
Another idea is, i always see cpu0 is the most busy one. But wouldn't switching 
the 'most busy cpu' from 0 to 1 at certain intervals (say, 3 seconds) reduce 
heat ?


 m°



Re: AMD64 X2 questions

2007-08-23 Thread Chris Ahlstrom
* Lennart Sorensen <[EMAIL PROTECTED]> [2007-08-23 11:45:11 -0400]:

> On Thu, Aug 23, 2007 at 05:08:49PM +0200, Hans-J. Ullrich wrote:
> > I have an AMD64 dual-core cpu running debian-amd64. Now I have heard, that 
> > it 
> > might be possible, to run applications on different cpus. One app is 
> > running 
> > on cpu1 , the other on cpu2 at the same time. Or just using only one of the 
> > two cpu-cores. Is that right ???
> > 
> > (I know, that in M$-Windows this is possible.)
> > 
> > I always thought, the kernel is scheduling the processes without the 
> > possibility to change this by users. If I am wrong, how can I manage it ?
> 
> I imagine it is possible to lock a task to a specific CPU although
> unless you are running some server with a very specialized task, you
> probably don't have any good reason to.  The scheduler does a great job
> in general at trying to run all your programs as quickly as possible.

"man -k affinity" shows a list of related options and commands.

It looks like taskset is what you want.

Haven't tried it myself.

Chris

-- 
Tux rox!


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: AMD64 X2 questions

2007-08-23 Thread Lennart Sorensen
On Thu, Aug 23, 2007 at 05:08:49PM +0200, Hans-J. Ullrich wrote:
> I have an AMD64 dual-core cpu running debian-amd64. Now I have heard, that it 
> might be possible, to run applications on different cpus. One app is running 
> on cpu1 , the other on cpu2 at the same time. Or just using only one of the 
> two cpu-cores. Is that right ???
> 
> (I know, that in M$-Windows this is possible.)
> 
> I always thought, the kernel is scheduling the processes without the 
> possibility to change this by users. If I am wrong, how can I manage it ?

With an SMP kernel (all current debian x86/x86_64 kernels are SMP as far
as I know), you get access to both CPUs and the kernel scheduler by
default will try to keep both busy.  The scheduler will by default try
to keep a process running on the same CPU all the time to avoid cache
flush penalties and such, but of course if the load gets too unbalanced
it will move something.

I imagine it is possible to lock a task to a specific CPU although
unless you are running some server with a very specialized task, you
probably don't have any good reason to.  The scheduler does a great job
in general at trying to run all your programs as quickly as possible.

So both cores will be in use as long as there are at least two threads
that want CPU time.

Run 'top' and hit '1' I think, and it will show the cpu load per core
rather than a summary.

--
Len Sorensen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



AMD64 X2 questions

2007-08-23 Thread Hans-J. Ullrich
Hello list,

I have an AMD64 dual-core cpu running debian-amd64. Now I have heard, that it 
might be possible, to run applications on different cpus. One app is running 
on cpu1 , the other on cpu2 at the same time. Or just using only one of the 
two cpu-cores. Is that right ???

(I know, that in M$-Windows this is possible.)

I always thought, the kernel is scheduling the processes without the 
possibility to change this by users. If I am wrong, how can I manage it ?

Thanks for any hints.

Regards

Hans
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]