user2023370
user2023370

Reputation: 11056

Missing OpenMP 4 function in GCC 4.8.2

Compiling the following code:

#include <iostream>                                                             
#include <omp.h>                                                                

int main(int argc, char *argv[])                                                
{                                                                               
  std::cout << omp_get_default_device() << '\n';                                
  return 0;                                                                     
}

with GNU G++ 4.8.2, using the command:

g++ -fopenmp test.cpp

results in the following error message:

test.cpp: In function ‘int main(int, char**)’:
test.cpp:6:39: error: ‘omp_get_default_device’ was not declared in this scope
std::cout << omp_get_default_device() << '\n';

Am I right to think that omp_get_default_device should be callable outside of a parallel region? Is this a bug?

Upvotes: 2

Views: 1912

Answers (1)

David Brown
David Brown

Reputation: 13536

omp_get_default_device appears to have been added in OpenMP 4.0 (here is the 3.1 spec which does not have that function). GCC 4.8 only supports version 3.1, though 4.0 will be supported in GCC 4.9: http://gcc.gnu.org/wiki/openmp

Upvotes: 5

Related Questions