File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,15 @@ namespace grb {
7979 return ret;
8080 }
8181
82+ /* *
83+ * @returns The maximum number of threads reported by OpenMP.
84+ *
85+ * This function can be called from any context.
86+ */
87+ static size_t maxThreads () {
88+ return omp_get_max_threads ();
89+ }
90+
8291 /* *
8392 * @returns The number of threads in the current OpenMP parallel section.
8493 *
Original file line number Diff line number Diff line change @@ -1275,7 +1275,12 @@ namespace grb {
12751275 template < typename D, typename C >
12761276 inline C & getCoordinates ( Vector< D, reference, C > &x ) noexcept {
12771277#ifdef _H_GRB_REFERENCE_OMP_VECTOR
1278- assert ( x._coordinates .requiredThreadsForUpdate () == config::OMP::threads () );
1278+ if ( x._coordinates .requiredThreadsForUpdate () != config::OMP::maxThreads () ) {
1279+ #pragma omp critical
1280+ std::cerr << " " << x._coordinates .requiredThreadsForUpdate ()
1281+ << " != " << config::OMP::maxThreads () << " \n " ;
1282+ }
1283+ assert ( x._coordinates .requiredThreadsForUpdate () == config::OMP::maxThreads () );
12791284#endif
12801285 return x._coordinates ;
12811286 }
You can’t perform that action at this time.
0 commit comments