Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

327
Visualizações
What preprocessor define does -fopenmp provide?

I've got some code that can run with (or without) OpenMP - it depends on how the user sets up the makefile. If they want to run with OpenMP, then they just add -fopenmp to CFLAGS and CXXFLAGS.

I'm trying to determine what preprocessor macro I can use to tell when -fopenmp is in effect. The omp.h header does not look very interesting:

$ cat /usr/lib/gcc/x86_64-linux-gnu/4.8/include/omp.h | grep define
#define OMP_H 1
#define _LIBGOMP_OMP_LOCK_DEFINED 1
# define __GOMP_NOTHROW throw ()
# define __GOMP_NOTHROW __attribute__((__nothrow__))

And I can't get the preprocessor to offer up anything useful:

$ cpp -dM -fopenmp </dev/null | grep -i omp
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
#define __STDC_IEC_559_COMPLEX__ 1

$ cpp -dM -fopenmp </dev/null | grep -i version
#define __GXX_ABI_VERSION 1002
#define __VERSION__ "4.8.2"

What preprocessor define does -fopenmp provide?


This is similar to How to tell if OpenMP is working? But I'm interested in compile time, and not post-build or runtime.

Note: this project does not use Boost, does not use Autotools, and does not use Cmake. It just uses a makefile.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your grep was overly specific, you should have looked for "openmp".

Or rather, diffing cpp -dM -fopenmp </dev/null and cpp -dM </dev/null produces a single diff:

#define _OPENMP 201107

Which should be exactly what you are looking for.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda