lundi 31 décembre 2018

Will threads be faster if each gets their own copy of a read only array

If I have a number of threads that each do some calculations based on a joint read only array, will it be faster if I provide each array with a separate copy of that array. For example, assume X is an array with numbers between 0 and 1 and each thread computes $sin(X)$ (entrywise). Should I create deep copies of $X$ to each thread?

Of course I could just try it out, but I will first have to learn how to implement threads in the first place. I am looking to do this in C++, in case it matters.

Aucun commentaire:

Enregistrer un commentaire