I really wonder if this thing compiles? You specify default(none)
, but consistently use data members of your class. Are they all static?
What you could do is either i) leave default(none)
away, which means default(shared)
, ii) have a shared access to the values by explicitly sharing them, or iii) initialise the variables you use inside the parallel region so that each thread has it's own private copy of, say, m_RxInitial
called p_RxInitial
etc. The first option is almost guaranteed to get you into trouble.
Following illustrates option ii):
1) Make a helper class containing everything you need to pass, for you this could be
struct ShareData{
int s_RxInitial
/* ... */
}
2) In the member function containing parallel section, before parallel loop define
ShareData SD;
SD.s_RxInitial = m_RxInitial;
/* ... */
3) Give it to the parallel section
#pragma omp parallel for schedule(static), default(none), shared(SD)
4) Use the SD datamembers in function calls.
I hope this was clear enough. I would appreciate it if someone had a more elegant solution to offer.
If you wanted private variables of option iii), you could say firstprivate(SD)
instead of shared(SD)
. This would give each thread initialized (to the original values) private copy of SD. It may or may not give some performance advantage by avoiding serial access. I had a similar problem few days ago and there was no difference.