What REALLY, is the function of multi cores?

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

S.Taylor
Posts: 8514
Joined: Thu Mar 09, 2006 3:25 am
Location: Jerusalem Israel

What REALLY, is the function of multi cores?

Post by S.Taylor »

I used to think that 2 cores meant 2 engines, and 4 meant 4 engines, and that doubling the cores was almost like doubling the speed of ONE core.

But now, some computer
dealer tells me that an i7 with 8 cores is slower than an i7 with 4 cores! (and that more cores are there to cool it down by distributing the heat).

Is this then the whole story?
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: What REALLY, is the function of multi cores?

Post by sje »

Get a new dealer. If they lie about one thing, they're probably lying about many things.

1) Having N cores means having up to N concurrent processes or threads with each process/thread receiving about the same amount of CPU resource as if the process/thread had a single core CPU all to itself.

2) An application will not gain speed by having additional cores unless the application is multithreaded.

3) An i7 (of which there are many models) which has four physical cores may have support for eight hyperthreads. A hyperthread may be worth slightly more than half a core, and that's on a good day.

4) Cores can only add to CPU current draw, which means more heat and not less.

5) CPU manufacturers have deliberately obfuscated model names to increase customer confusion and so increase profit.

6) For the vast majority of home and work computers, each of the second through Nth cores wastes nearly all of its time doing nothing except sitting on its ass.
mike_bike_kite
Posts: 98
Joined: Tue Jul 26, 2011 12:18 am
Location: London

Re: What REALLY, is the function of multi cores?

Post by mike_bike_kite »

I'm confused. I thought these chips mostly had 4 cores (a few have 2 cores and some expensive models have 6). Then when you add hyper-threading they show up on the system screen as double this ie 8 core (and 4 to 12). The real number of cores hasn't changed though but the number of threads has gone up.

One missing advantage of multiple cores is bragging rights - a friend was telling me the specs of his latest i7, multi core, 8GB ram laptop and I felt almost unworthy to be in the same room.
User avatar
Eelco de Groot
Posts: 4557
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: What REALLY, is the function of multi cores?

Post by Eelco de Groot »

Stuart either did not understand at all what his dealer was trying to say or the dealer himself has a really poor understanding of what he is selling. When he is talking about eight cores it sounds to me he was maybe referring to hyperthreading, the i7 in most versions just has four cores, never eight and only some very expensive versions have six. But with hyperthreading the taskmanager can show eight threads. Rybka does not use threads but processes, there the picture in taskmanager is different a bit. Jut remember that hyperthreading has limited use for a computer you want to use for computerchess alone. But I don't think hyperthreading on is worse than hyperthreading off, the only thing I can think of is the seller trying to say it would use a little more current with hyperthreading on?

Bob made the following post on the Rybkaforum about hyperthreading in general:
I do not believe hyperthreading will be a "win" here, ever. It will help compute-bound processes that have a lot of memory traffic that stalls a pipeline waiting on data from memory. For a program that is cache-friendly, it offers zero, and for chess, which has SMP search overhead, it offers a net loss, although it is not a big loss.

I've tested it extensively every time a new instantiation of the idea comes out. Always with the same result.

Big pages are a different issue however, as small pages can really thrash the TLB when you use a large hash size. Big pages stop that and can offer a signficant gain, the larger the hash size, the better the potential gain (because more virtual memory pages means more TLB thrashing, bigger pages reduce the total number of pages by a factor of 1000x, which is significant, IF you use large hash sizes. For smaller hash sizes, there is no gain to speak of.

The only good thing about the last 3-4-5 years is that the operating systems are very aware of hyper-threading. You don't need to disable it, just make sure you don't run more threads than physical cores. Any good OS will make sure you get just one thread per physical core and not get zapped performance-wise. I did encounter a problem with this when the first 6 core CPUs hit the street, as the scheduler I had seemed to work well with 2/4 cores per chip, but not 6, as it is not a power of 2. That seems clean, today. Leaving HT on will help when you run non-chess things that HT might benefit.
Hyperthreading isn't there to save electricity I think, but modern Intel chips with hyperthreading, like i7 and i5 are for sure demanding less power than the older ones without hyperthreading, I am thinking Q6600 and Q6700 of regular previous quadcore chips from Intel. They are not terribly much faster, especially if you would overclock the old Q6600 or Q6700, you can overclock those to high frequencies but in that case they use progressively more power. Which is not good for your electricity bill.

Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
syzygy
Posts: 5554
Joined: Tue Feb 28, 2012 11:56 pm

Re: What REALLY, is the function of multi cores?

Post by syzygy »

Eelco de Groot wrote:Stuart either did not understand at all what his dealer was trying to say or the dealer himself has a really poor understanding of what he is selling. When he is talking about eight cores it sounds to me he was maybe referring to hyperthreading, the i7 in most versions just has four cores, never eight and only some very expensive versions have six. But with hyperthreading the taskmanager can show eight threads. Rybka does not use threads but processes, there the picture in taskmanager is different a bit.
Whether the software uses threads or processes doesn't make much difference in the picture that the taskmanager is giving (assuming you are talking about the 8 graphs corresponding to the 8 hyperthreads of an i7).
S.Taylor
Posts: 8514
Joined: Thu Mar 09, 2006 3:25 am
Location: Jerusalem Israel

Re: What REALLY, is the function of multi cores?

Post by S.Taylor »

I have a new computer. Everything new.
It says about proccessor:
Intel(R)Core(TM)i7-3770 CPU@3.40GHz 3.GHz.

Can someone explain what all this means?

And how much better could i have got (for chess) had i asked for it?

(and did i do a clever thing by insisting on an i7 instead of i5?)
User avatar
jshriver
Posts: 1342
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

Re: What REALLY, is the function of multi cores?

Post by jshriver »

If you're using Linux just cat /proc/cpuinfo as it'll give stats on each core. Namely 2, 4 or 6. Possibly 8 if you have a 8-core AMD bulldozer. But it doesn't count hyperthreading.

It always grinds my gears when I hear a seller say "This has 4 cores" when it really has 2, with hyperthreading.

A core in more or less a single CPU 'core'. Hyperthreading is a way to allow mulitple threads to sometimes in certain situations execute 2 instructions at the same time, but even if Linux utils or Windows mimics it as multiple CPU's it is not in fact multiple CPU's cores.

On a side note, I'd really love to have a quad socket AM3 with 4 6-core AMD chips ^_^

With all of this multi-core craze the past couple years it's hard to find multi-socket MB's, Titan aside.
syzygy
Posts: 5554
Joined: Tue Feb 28, 2012 11:56 pm

Re: What REALLY, is the function of multi cores?

Post by syzygy »

S.Taylor wrote:I have a new computer. Everything new.
It says about proccessor:
Intel(R)Core(TM)i7-3770 CPU@3.40GHz 3.GHz.

Can someone explain what all this means?
Maybe the second Ghz should have been "3.9 Ghz"?

The i7-3770 is a CPU with 4 real cores, each core being capable of simultaneously running 2 threads. The cores normally run at 3.4Ghz, but at up to 3.9 Ghz when turboboost is enabled (with the Ghz higher if fewer cores are actively being used, say 3.9 Ghz when 1 core is in use and 3.6 Ghz when 4 cores are in use).

I don't know what CPU your first computer had, but to give an example when Windows 95 came out it typically ran on a pentium 90, which had just 1 core running at 90Mhz, i.e. at 0.090Ghz. In addition, these old CPUs could do far less work per "clock tick" (1 Ghz means 1 billion clock ticks per second). So your CPU is incredibly much faster than those old CPUs (which were already incredibly fast compared to my first CPU, the MOS Technology 6510 running at 0.000985 Ghz).
And how much better could i have got (for chess) had i asked for it?
The i7-3930K and i7-3960X have 6 cores. However, they are considerably more expensive (especially the i7-3960X) and also require a more expensive motherboard.

If you were planning to overclock your system, e.g. to let all cores run at 4.2Ghz or even higher, the "unlocked" i7-3770K would have been a better (and of course somewhat more expensive) choice.
(and did i do a clever thing by insisting on an i7 instead of i5?)
If the only computationally intensive task you will be running is chess, you could probably have lived without hyperthreading. But having hyperthreading doesn't hurt. If you let your engines use 4 threads, your system will probably remain more responsive compared to an i5 running the same engine with 4 threads. You could also experiment with running an engine with 8 threads to see how that compares to running with 4 threads. Most engines will probably do better with 4 threads, though. (Total nps might be a bit higher with 8 hyperthreads, but the parallel tree search algorithms used by engines are relatively less efficient with more threads.)

Compared to the i5-3570 (also running at 3.40 Ghz), the i7-3770 has 2MB extra cache (8MB versus 6MB), higher turbo boost frequency (3.9 Ghz versus 3.8 Ghz) and of course hyperthreading. The extra cache certainly helps.
S.Taylor
Posts: 8514
Joined: Thu Mar 09, 2006 3:25 am
Location: Jerusalem Israel

Re: What REALLY, is the function of multi cores?

Post by S.Taylor »

syzygy wrote:
S.Taylor wrote:I have a new computer. Everything new.
It says about proccessor:
Intel(R)Core(TM)i7-3770 CPU@3.40GHz 3.GHz.

Can someone explain what all this means?
Maybe the second Ghz should have been "3.9 Ghz"?

The i7-3770 is a CPU with 4 real cores, each core being capable of simultaneously running 2 threads. The cores normally run at 3.4Ghz, but at up to 3.9 Ghz when turboboost is enabled (with the Ghz higher if fewer cores are actively being used, say 3.9 Ghz when 1 core is in use and 3.6 Ghz when 4 cores are in use).

I don't know what CPU your first computer had, but to give an example when Windows 95 came out it typically ran on a pentium 90, which had just 1 core running at 90Mhz, i.e. at 0.090Ghz. In addition, these old CPUs could do far less work per "clock tick" (1 Ghz means 1 billion clock ticks per second). So your CPU is incredibly much faster than those old CPUs (which were already incredibly fast compared to my first CPU, the MOS Technology 6510 running at 0.000985 Ghz).
And how much better could i have got (for chess) had i asked for it?
The i7-3930K and i7-3960X have 6 cores. However, they are considerably more expensive (especially the i7-3960X) and also require a more expensive motherboard.

If you were planning to overclock your system, e.g. to let all cores run at 4.2Ghz or even higher, the "unlocked" i7-3770K would have been a better (and of course somewhat more expensive) choice.

.
So are you saying as follows?

That for the money i probably paid, i should have got the same, but with 3.9 Ghz instead?

That overclocking what i have (3.4), to 4.2Ghz, is even better (than buying the 3.9 Ghz), but more expensive?

i73930k and i73960k are at any rate, faster for chess, but cost alot more?
syzygy
Posts: 5554
Joined: Tue Feb 28, 2012 11:56 pm

Re: What REALLY, is the function of multi cores?

Post by syzygy »

S.Taylor wrote:That for the money i probably paid, i should have got the same, but with 3.9 Ghz instead?
No, your i7-3770 has 3.40 ghz with a turbo boost of max 3.90 ghz. I looked this up on Intel's website. What I mean by "second Ghz" is this:
S.Taylor wrote:Intel(R)Core(TM)i7-3770 CPU@3.40GHz 3.GHz.
The part in bold seems to be some kind of typo. I was guessing you had intended to write "3.9 Ghz". Maybe you were not, but in any case the i7-3770 does do 3.9ghz max with turboboost enabled. That means 3.9 ghz if you run something computationally intensive on 1 core, usually for a limited period of time (after which it goes back to 3.4ghz), but you might be able to tweak this in the BIOS.

For normal use you won't notice the difference between 3.4ghz and 3.9ghz, so if it is too confusing at the moment you can simply forget about it for now and come back to it later.
That overclocking what i have (3.4), to 4.2Ghz, is even better (than buying the 3.9 Ghz), but more expensive?
The i7-3770K, which is a different but comparable model, has an unlocked "multiplier" which means you can set it to run at a higher clock rate. However, you need a good cpu cooler for that and you really must know what you're doing. I'm guessing that at this time you are better off not worrying about this. Maybe if you do some reading you could consider this option for your next CPU some years from now (but if you have no time for such reading it probably means you have better things to do, which is just fine, so don't worry ;-)).
i73930k and i73960k are at any rate, faster for chess, but cost alot more?
As long as the engine is multithreaded, 6 physical cores will beat 4 physical cores. Whether you will really notice the difference depends on how you will use your computer for chess. I very much doubt that Carlsen playing against the computer would notice the difference between the engine running on an i7-3770 and the same engine running on an i7-3960X.