c++ - Does a shared variable have a default lock? -


i have program iterating through vector of objects , applying function each element of vector. comparison between each of elements follows:

#pragma omp parallel shared(i, myvector) for(i = 0 ; < myvector.size() ; i++) {     for(int j = + 1 ; j < bdd.size() ; j++) {         myvector[i]->compare(*myvector[j]); //     } } 

i not modify vector. add value in attribute of each object element. therefore, think not need locks use.

here problem : using several threads (tested 1 8 threads) not speed process. wondering if fact myvector shared variable automatically lock variable cannot used several threads @ same time.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -