Registered Member
|
Hi,
I'm thinking about using Eigen just for its convenient vector notation, but I would like to parallelize the code to take advantage of multi-core CPU. Is there a way to do it without sacrificing concise notation like this (code below is approximate - I haven't used Eigen yet):
or do I have to brake it up:
Thanks in advance for any comments, Paul |
Moderator
|
It's generally not a good idea to parallelize at such a low level. From my experience you start to get some gains for vectors larger than about 300000 elements... so we decided not to bother about parallelizing coefficient-wise ops. A considerably better approach is to parallelize the whole algorithm.
|
Registered Member
|
This was just a simple example - to make it more compelling, substitute abs() with arbitrarily compute intensive function. But even this simple case scales up very nicely on multi-core system. On my 4-core CPU it takes 1.88ms to execute non-OpenMP case and 0.55ms to execute OpenMP case with 4 threads, resulting in 3.41 speedup.
How difficult it would be to modify Eigen, so it generates "omp parallel for" code in cases like this or cases with more complex right side expression? |
Moderator
|
The simplest is probably to implement a free function like:
Please, get back to us if you go further... |
Registered Member
|
Thank you for your answer. I started using Eigen - mainly for short vector operations. I'm planning to do some comparative benchmarking against Intel Cilk Plus array notation and maybe homegrown short vector templates. I will post to the forum when I have some results.
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]