Re: [Q] including omp.h?
Re: [Q] including omp.h?
- Subject: Re: [Q] including omp.h?
- From: Marcus Karlsson <email@hidden>
- Date: Sat, 06 Aug 2011 10:31:03 +0200
--On July 31, 2011 4:49:34 PM -0700 JongAm Park <email@hidden>
wrote:
Hello,
Because gcc now supports OpenMP, we can use pragmas for OpenMP without
doing any special steps except for setting "Enable OpenMP" and "-fopenmp".
However, when I tried to use OpenMP functions like :
int omp_get_max_threads(void)
omp.h should be included.
However the location of omp.h is not /usr/inlcude, /usr/local/include (
if any ) etc. It was under
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/omp.h
/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/include/omp.h
/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/omp.h
However, as you can see, they are under /usr/lib.
It means that Apple or GCC people wanted to hide the include directory ,
i.e. lib/gcc/i686-apple-darwin10/4.2.1/include for example, under a
specific compiler's folder under /usr/lib.
So, although it would be possible to set a header path, but to make the
compiler choose appropriate one ( as you can see, those three are for
different gcc versions, intel, powerpc and llvm-gcc ), I believe there
should be some mechanism to include them in "directory-path-free" way.
Is there any such way to include the omp.h?
Or should their include path set just like other header path?
The reason why the header file is located in a per-compiler directory is
that OpenMP has to be implemented by the compiler itself. That way, omp.h
may change from compiler to compiler. It will also assure that an error is
generated if OpenMP is not supported.
In general you shouldn't have to deal with where exactly the file is
located. Just include <omp.h> and give the compiler the -fopenmp option. In
Xcode setting "Enable OpenMP Support" should be sufficient. The compiler
will find the correct header file.
Marcus
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden