How can I make a program which uses all cores and 100% of cpu power?

Russel Winder russel at winder.org.uk
Fri Oct 11 06:57:46 UTC 2019


On Fri, 2019-10-11 at 00:41 +0000, Murilo via Digitalmars-d-learn wrote:
> I have started working with neural networks and for that I need a 
> lot of computing power but the programs I make only use around 
> 30% of the cpu, or at least that is what Task Manager tells me. 
> How can I make it use all 4 cores of my AMD FX-4300 and how can I 
> make it use 100% of it?

Why do you want to get CPU utilisation to 100%?

I would have thought you'd want to get the neural net to be as fast as
possible, this does not necessarily imply that all CPU cycles must be used.

A neural net is, at it's heart, a set of communicating nodes. This is as much
an I/O bound model as it is compute bound one – nodes are generally waiting
for input as much as they are computing a value. The obvious solution
architecture for a small computer is to create a task per node on a thread
pool, with a few more threads in the pool than you have processors, and hope
that you can organise the communication between tasks so as to avoid cache
misses. This can be tricky when using multi-core processors. It gets even
worse when you have hyperthreads – many organisations doing CPU bound
computations switch off hyperthreads as they cause more problems than theysolve. 

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20191011/f8afdb1e/attachment.sig>


More information about the Digitalmars-d-learn mailing list