Email or username:

Password:

Forgot your password?
Top-level
Devine Lu Linvega

@wakame In this case I'm just modifying each cell, not even moving data. I was trying to figure in how many threads I should split the job in. I've tried all sorts of things, and for some reason, a bit more more threads than the number of cores my laptop has, is faster than exactly the number that I have. So I thought maybe there was some logic to it.

2 comments | Expand all CWs
wakame

@neauoire I am sure there is. Reminds me of some work a friend of mine did many years ago. He was testing a graphics pipeline with several threads and... the results were mostly counter-intuitive.

Since your computer likely also use threads for UI etc. The cores likely benefit from doing "two things at (almost) once".

There is at least some memory management involved, for getting the code into the CPU, and moving data around means "waiting" for the CPU.

So
thread_count = 2*cores - os_thread_count
seems like a good hypothesis to me.

@neauoire I am sure there is. Reminds me of some work a friend of mine did many years ago. He was testing a graphics pipeline with several threads and... the results were mostly counter-intuitive.

Since your computer likely also use threads for UI etc. The cores likely benefit from doing "two things at (almost) once".

Kartik Agaram

@neauoire @wakame Aaah, I really need to click on the top-level message before reading.

The rough reasoning is: your CPU is never perfectly busy. Lots of things can cause threads to stall. An extra thread or two can keep the CPU going when other threads stall.

But too many threads and the CPU wastes time trying to decide which one to do next.

Go Up