Virtualization and multi-processor engines

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

rreagan
Posts: 102
Joined: Sun Sep 09, 2007 6:32 am

Virtualization and multi-processor engines

Post by rreagan »

How does virtualization affect engines that are multi-processor aware? Can you accurately develop and test a MP engine on a virtual machine?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Virtualization and multi-processor engines

Post by bob »

rreagan wrote:How does virtualization affect engines that are multi-processor aware? Can you accurately develop and test a MP engine on a virtual machine?
You can test/debug, but performance sucks and you can't really tune the parallel algorithm for performance...
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Virtualization and multi-processor engines

Post by diep »

rreagan wrote:How does virtualization affect engines that are multi-processor aware? Can you accurately develop and test a MP engine on a virtual machine?
For some engines it will be factor 1000 slower under specific circumstances.

Stockfish is good example.

Diep suffers at least factor 2 in nps, but in search depth that's more ugly. Easily loses 3 to 5 ply search depth.

It's good to debug your engine under such circumstances usually.

SMP search suffers from exponential problems if threads suffer from unknown delays.

I assume of course virtualization where you do not have the garantuee that every virtual 'core' is getting you the 100% system time when you need it.

Suppose some virtual environment has in reality 8 cores and is showing to you 24 cores. Some threads get a short 'blockade' for a bunch of milliseconds and then others.

Instantly your SMP program will simply be in 1 thread T and that blocks all other threads T'. When T gets system time we know others get blocked again. So T can do something tiny then it runs into something that's locked or causes it to wait by some thread from the pool of T'.

Even if you would seemingly scale reasonable then, like Diep, this gives huge search depth problems. Losing 5 plies search depth is not uncommon and it's easy to prove why.

Some total idiotic subtree Y is not blocked of course. Normally spoken we would abort all cpu's now as we have a fail high somewhere; that just doesn't happen as those threads are kind of semi deadlocked thanks to the virtualization not garantueeing us a smooth run.

So the abort never occurs and we keep searching already aborted subtrees.

You really need a hard garantuee for SMP search that every thread *never* gets interrupted in any manner. It MUST be able to execute instructions nonstop. Sure it may be slow, but that's not how 99% of the virtualization world works.

They run more threads than they have cores obviously.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Virtualization and multi-processor engines

Post by mcostalba »

diep wrote: For some engines it will be factor 1000 slower under specific circumstances.

Stockfish is good example.
Set UCI option "Use Sleeping Threads" to true and retry...
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Virtualization and multi-processor engines

Post by diep »

mcostalba wrote:
diep wrote: For some engines it will be factor 1000 slower under specific circumstances.

Stockfish is good example.
Set UCI option "Use Sleeping Threads" to true and retry...
Won't help you much if you use central locking at a virtual server that
shows you n cores meanwhile you have n-i with i > 0...