As a programmer, what do I need to do to optimize a program for multiple cores/threads? The future is obviously in more and more threads, but It feels like some programs don't benefit enough from it.
I already do compute intensive tasks on separate threads, but is that all it takes? Optimizing for concurrent execution sounds crucial for me.
It's simple, just throw your work into multiple processes and the OS scheduler will do it for you.
>>61039370
Isn't that the same as running one process and using multiple threads? Thread management is also done by the OS, isn't it?
>>61039404
One is more difficult than the others.
>>61039211
>is that all it takes
Does your CPU utilization continously look like in your picture? Then job well done.
If not, run a CPU profiler and you'll find out exactly where the CPU intense operations are, or any bottlenecks in form of waits.
Get a book
Too much to explain in 2000 characters
>>61039847
This, you need to learn to locate the bottlenecks in your program first and optimize it the best way you can. Throwing threads and cores to the problem could make the program slower.
>>61039211
Do everything explicitly with either openmp or mpi. And if you're compiler doesn't support them stop using such a shit language.
>>61039211
You should've bought Intel, anon. It doesn't have this problem.
>>61040876
>It doesn't have this problem.
Yeah, too few cores for the same money.
>>61039370
> Brainlet
>>61040964
Intel 4 cores = AMD 8 cores
>>61041071
>>61040876
1 Intel RAID key has been shipped to your address, thanks again for your work.
Regards,
Shlomo #5,697
>>61041071
So Intel 8 cores is slower than AMD 8 cores but Intel 4 cores is faster than AMD 8 cores?
Really makes you think.
>>61039211
Use Go.
>>61039211
Don't optimize for a problem you only think exists.
Chances are, single threaded is fine for your purposes. (The OS will distribute running programs across cores/threads to load balance)
>>61041071
2011 called, they want their memes back.
>>61041117
Depends on whether performance is actually needed.
If it's just some game that runs fine on anything, then don't bother.
>>61041159
Exactly, but at that point you know for sure there's a problem.
Making a multi threaded program just because you think the processor doesn't have a distributed enough load is a bad idea.
>>61041071
No?
>>61041117
I think this mentality results in "okay, we have X cores in our CPU, but our software does not benefit from it enough"