@@ -357,8 +357,7 @@ void CGeometry::AllocateP2PComms(unsigned short countPerPoint) {
357357
358358 if (countPerPoint <= maxCountPerPoint) return ;
359359
360- SU2_OMP_BARRIER
361- SU2_OMP_MASTER {
360+ BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
362361
363362 /* --- Store the larger packet size to the class data. ---*/
364363
@@ -379,8 +378,7 @@ void CGeometry::AllocateP2PComms(unsigned short countPerPoint) {
379378 bufS_P2PRecv = new unsigned short [maxCountPerPoint*nPoint_P2PRecv[nP2PRecv]] ();
380379
381380 }
382- END_SU2_OMP_MASTER
383- SU2_OMP_BARRIER
381+ END_SU2_OMP_SAFE_GLOBAL_ACCESS
384382
385383}
386384
@@ -763,10 +761,7 @@ void CGeometry::CompleteComms(CGeometry *geometry,
763761 /* --- For efficiency, recv the messages dynamically based on
764762 the order they arrive. ---*/
765763
766- SU2_OMP_MASTER
767- SU2_MPI::Waitany (nP2PRecv, req_P2PRecv, &ind, &status);
768- END_SU2_OMP_MASTER
769- SU2_OMP_BARRIER
764+ SU2_OMP_SAFE_GLOBAL_ACCESS (SU2_MPI::Waitany (nP2PRecv, req_P2PRecv, &ind, &status);)
770765
771766 /* --- Once we have recv'd a message, get the source rank. ---*/
772767
@@ -831,12 +826,8 @@ void CGeometry::CompleteComms(CGeometry *geometry,
831826 data in the loop above at this point. ---*/
832827
833828#ifdef HAVE_MPI
834- SU2_OMP_MASTER
835- SU2_MPI::Waitall (nP2PSend, req_P2PSend, MPI_STATUS_IGNORE);
836- END_SU2_OMP_MASTER
829+ SU2_OMP_SAFE_GLOBAL_ACCESS (SU2_MPI::Waitall (nP2PSend, req_P2PSend, MPI_STATUS_IGNORE);)
837830#endif
838- SU2_OMP_BARRIER
839-
840831}
841832
842833void CGeometry::PreprocessPeriodicComms (CGeometry *geometry,
@@ -1186,8 +1177,7 @@ void CGeometry::AllocatePeriodicComms(unsigned short countPerPeriodicPoint) {
11861177
11871178 if (countPerPeriodicPoint <= maxCountPerPeriodicPoint) return ;
11881179
1189- SU2_OMP_BARRIER
1190- SU2_OMP_MASTER {
1180+ BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
11911181
11921182 /* --- Store the larger packet size to the class data. ---*/
11931183
@@ -1213,8 +1203,7 @@ void CGeometry::AllocatePeriodicComms(unsigned short countPerPeriodicPoint) {
12131203 bufS_PeriodicRecv = new unsigned short [nRecv] ();
12141204
12151205 }
1216- END_SU2_OMP_MASTER
1217- SU2_OMP_BARRIER
1206+ END_SU2_OMP_SAFE_GLOBAL_ACCESS
12181207}
12191208
12201209void CGeometry::PostPeriodicRecvs (CGeometry *geometry,
@@ -3136,7 +3125,7 @@ void CGeometry::FilterValuesAtElementCG(const vector<su2double> &filter_radius,
31363125 END_SU2_OMP_FOR
31373126
31383127 /* --- Share with all processors ---*/
3139- SU2_OMP_MASTER
3128+ BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS
31403129 {
31413130 su2double* dbl_buffer = new su2double [Global_nElemDomain*nDim];
31423131 SU2_MPI::Allreduce (cg_elem,dbl_buffer,Global_nElemDomain*nDim,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm ());
@@ -3150,8 +3139,7 @@ void CGeometry::FilterValuesAtElementCG(const vector<su2double> &filter_radius,
31503139 MPI_Allreduce (halo_detect.data (),char_buffer.data (),Global_nElemDomain,MPI_CHAR,MPI_SUM,SU2_MPI::GetComm ());
31513140 halo_detect.swap (char_buffer);
31523141 }
3153- END_SU2_OMP_MASTER
3154- SU2_OMP_BARRIER
3142+ END_SU2_OMP_SAFE_GLOBAL_ACCESS
31553143
31563144 SU2_OMP_FOR_STAT (256 )
31573145 for (auto iElem=0ul ; iElem<Global_nElemDomain; ++iElem) {
@@ -3190,14 +3178,13 @@ void CGeometry::FilterValuesAtElementCG(const vector<su2double> &filter_radius,
31903178
31913179#ifdef HAVE_MPI
31923180 /* --- Share with all processors ---*/
3193- SU2_OMP_MASTER
3181+ BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS
31943182 {
31953183 su2double *buffer = new su2double [Global_nElemDomain];
31963184 SU2_MPI::Allreduce (work_values,buffer,Global_nElemDomain,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm ());
31973185 swap (buffer, work_values); delete [] buffer;
31983186 }
3199- END_SU2_OMP_MASTER
3200- SU2_OMP_BARRIER
3187+ END_SU2_OMP_SAFE_GLOBAL_ACCESS
32013188
32023189 /* --- Account for duplication ---*/
32033190 SU2_OMP_FOR_STAT (256 )
0 commit comments