fmihpc / vlasiator

Vlasiator - ten letters you can count on
https://www.helsinki.fi/en/researchgroups/vlasiator
Other
47 stars 38 forks source link

Vlasiator does not compile without -fopenmp (Poisson solver) #250

Open ykempf opened 8 years ago

ykempf commented 8 years ago

I got the following (I wanted to compile without threading for debugging purposes).

In file included from projects/Poisson/poisson_test.cpp:15:0:
projects/Poisson/../../poisson_solver/poisson_solver.h: In member function 'Real poisson::PoissonSolver::error(std::vector<poisson::CellCache3D<VARS> >&)':
projects/Poisson/../../poisson_solver/poisson_solver.h:182:59: error: there are no arguments to 'omp_get_max_threads' that depend on a template parameter, so a declaration of 'omp_get_max_threads' must be available [-fpermissive]
       Real* threadMaxError = new Real[omp_get_max_threads()];
                                                           ^
projects/Poisson/../../poisson_solver/poisson_solver.h:182:59: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
projects/Poisson/../../poisson_solver/poisson_solver.h:186:45: error: there are no arguments to 'omp_get_thread_num' that depend on a template parameter, so a declaration of 'omp_get_thread_num' must be available [-fpermissive]
          const int tid = omp_get_thread_num();
                                             ^
projects/Poisson/../../poisson_solver/poisson_solver.h:213:43: error: there are no arguments to 'omp_get_max_threads' that depend on a template parameter, so a declaration of 'omp_get_max_threads' must be available [-fpermissive]
       for (int i=1; i<omp_get_max_threads(); ++i) {
galfthan commented 8 years ago

Well, why would you ;) These can be hidden behind an ifdef:


#ifdef _OPENMP
   #include <omp.h>
#else
   #define omp_get_thread_num() 0
   #define omp_get_max_threads() 1
#endif