← Back to team overview

yade-dev team mailing list archive

Re: Note on optimized compilation / optimized coding / profiling results

 

>> Janek, is multi_index random-access in O(1)? That is important if we try
>> to use openMP, which can parallelize some loops by itself.
>>     
>
> yes, of course. Every action has constant time. No matter if you have
> only 100 or 10^10 elements, the time to access 50th element consumes
> the same constant amount of time. You could have a look at my
> concerns about this in that boost mailing list thread (which I linked
> from Development_schedule on wiki)
>   
OK. That is scaling issue. But can it access elements by a number
(without any particular order) directly, just by dereferencing, without
any big computations? For openMP, parallel loops must loop over numbers,
so instead of interactionContainer iterator, it must be rewritten in
something like this:
 
 #pragma parallel for
 for(int i=0; i<interactions.size(); i++){
    const Interaction& i(interactions[i]);
  ...
 }

You get the idea, right? If getting "interactions[i]" is just a bit
slower than pointer arithmetics in old-style array or std::vector, it
will be much slower in total, I think.

Read this, very nice: http://bisqwit.iki.fi/story/howto/openmp/

_______________________________________________
yade-dev mailing list
yade-dev@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-dev



Follow ups

References