Shallot icon indicating copy to clipboard operation
Shallot copied to clipboard

Threading inefficient, run in parallel instead

Open paulmenzel opened this issue 7 years ago • 2 comments

Strangely, running Shallot with for example -t 8, the cores/threads are only used by 80 percent on Intel devices, and around 93 percent on AMD devices.

Using GNU Parallel instead to start several instances of Shallot with one thread each, that means -t 1, the cores/threads are used by 100 percent.

paulmenzel avatar Jul 27 '16 14:07 paulmenzel

Hi @paulmenzel,

I don't have such problem with an Intel Xeon D-1531 (Debian 8.5 x64):

htop

I'm not a dev but this can come from your processor / OS maybe?

By the way, except for stress testers and cpu burning software I've never seen one using all the threads at 100%.

stylersnico avatar Jul 30 '16 17:07 stylersnico

Hi @stylersnico,

You do have this problem, too. Have a look at the colors of your htop-load-bars. Green vs. red. Green means user CPU, red is system CPU. Threading in shallot uses more system/kernel-CPU power to switch between threads or wait for semaphores/locks ( I didn't dig into this deeper ) than it actually compute hashes.

If you modify the code to actually print out how many hashes have bee calculated in a given time, you will find out the result is way below the possible maximum of hashes/core * numCores.

Here's a screenshot of shallot running on a 40core machine using gnu-parallel :

seq 40 | parallel -n0 ./shallot -x 840 -t 1 stylersnico

shallot-40-parallel

Have a look at the green bars.

This is the same program using threads:

./shallot -x 840 -t 40 stylersnico

shallot-40-threads

wwwutz avatar Aug 25 '16 08:08 wwwutz