Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying OpenMP compatibility #35

Open
jwreep opened this issue Nov 8, 2018 · 1 comment
Open

Verifying OpenMP compatibility #35

jwreep opened this issue Nov 8, 2018 · 1 comment

Comments

@jwreep
Copy link
Member

jwreep commented Nov 8, 2018

Since not all compilers (or versions) support OpenMP, it would be useful to have a check that prevents crashes when attempting to use OpenMP with a compiler that doesn't support it.

For example, embed the OPENMP define in something like the following:

// Check if compiler is GNU:
#if defined(__GNUC__) || defined(__GNUG__)   
   // Check version >= 6.1, which has full OpenMP support:
   #if (__GNUC__ > 6) ||  (__GNUC__ == 6 && (__GNUC_MINOR__ >= 1) ) 
      #define OPENMP
   #endif 
#endif 

This isn't strictly necessary, but it might save a headache if one forgets to verify compiler version.

@jwreep
Copy link
Member Author

jwreep commented Nov 8, 2018

Alternatively, a warning could be added to alert the user.

// Check if compiler is GNU:
#if defined(__GNUC__) || defined(__GNUG__)   
   // Check version >= 6.1, which has full OpenMP support:
   #if (__GNUC__ > 6) ||  (__GNUC__ == 6 && (__GNUC_MINOR__ >= 1) ) 
      printf("Compiler version not compatible with OpenMP: expect this to crash!");
   #endif 
#endif 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant