- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When testing Fortran with the ffte (Version 6.0; http://www.ffte.jp/) I came across the following issue:
The code uses a call OMP_GET_WTIME for runtime measurement. When using everything without modification, everything works fine. When I added the compiler option "-names as_is" I get the error, that the function cannot be found. OpenMP uses the function name "omp_get_wtime" so I changed the two calls. When I compile the source now (with -names as_is) I get different strange-looking (wrong) results. After removing names as_is the code compiles again and produces correct results again.
Does anyone know what causes this behaviour? I suspect that a different module/interface is used causing wrong times to be reported but I cannot confirm that.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The include files and module we provide for OpenMP declare omp_get_wtime as bind(C) so the name would be lowercased. The symptoms you describe suggest to me that you're not using our declarations. Furthermore, this function returns a double precision, so if it is implicitly declared then Fortran thinks it is default real, which will give wrong results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
include 'omp_lib.h'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help so far. When I add include 'omp_lib.h' to the top of the source file I get an error while compiling (with -names as_is). The error is: error #6259: This array or function or substring is invalid in constant expressions. [int_ptr_kind].
It appears within the omp_lib.h file and I found out that int_ptr_kind() should return the integer pointer type but somehow was not correctly resolved. In the documentation (http://software.intel.com/sites/products/documentation/doclib/stdxe/2013/composerxe/compiler/fortran-win/GUID-E31BAAF0-4CBC-4154-84C8-6EB06E1F5844.htm) the name is in capital letters but with "-names as_is" this may cause problems within the header file. I don't want to mess around with the omp_lib.h header and change it. So I copied the header to the source file, changed it there and compiled with that copied header and everything works fine.
This solved the problem but somehow looks like a dirty solution for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
int_ptr_kind is an intrinsic that absolutely is allowed in constant expressions. However, because you are using -names as_is, you have to spell it INT_PTR_KIND. "-names as_is" is a hack that creates more problems than it solves. If you are using the .h file, you don't need -names as_is, so remove it. That will make everything better.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was originally using -names as_is because I created a wrapper for some C functions using capital and non-capital letters. Therefore I used exactly these names for the Fortran wrapper. Now I wanted to use that wrapper in the ffte program so I tested compiling the original source without any modifications with the required options to check that everything works. Maybe I will just convert the wrapper and C functions to lower case and stop using -names as_is.
But thanks for the advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a note that the OS spellings are different, and the compiler has different defaults on each:
Linux: -names lowercase
Windows /names:uppercase
So on Linux, the default action is to convert external names to lowercase; just the opposite on Windows.
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even -names lowercase is a better choice than -names as_is. But best is if you use BIND(C) with an optional NAME= if the C name isn't lowercase.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The wrapper is targeting the Intel Xeon Phi thus will be running on Linux. I was just doing some testing on the host sytem. But the BIND(C) with an optional NAME parameter will be the best way of doing it I guess. Then I won't having problems with the name conversion.
Thank you both for the help.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page