- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am compiling my code sometimes in Linux Intel Fortran, sometimes in Windows Compaq Visual Fortran.
The problem is that I use an intrinsic module (for some time/date functions such as TIMEF, FDATE, DATE, CLOCK and ETIME) which is common both compilers except that it has a different name for each compiler (DFPORT in Win CVF and IFPORT in Linux Intel Fortran).
Presently, when switching compilers I have to manually write "USE DFPORT" instead of "USE IFPORT" or vice-versa in all the subroutines using the module. This rather inconvenient.
Is there an automatic way of doing it, without having to manually change the text when swiching compilers? This would render the code platform independent (at least for the two platforms I am testing).
Thanks,
Francisco
I am compiling my code sometimes in Linux Intel Fortran, sometimes in Windows Compaq Visual Fortran.
The problem is that I use an intrinsic module (for some time/date functions such as TIMEF, FDATE, DATE, CLOCK and ETIME) which is common both compilers except that it has a different name for each compiler (DFPORT in Win CVF and IFPORT in Linux Intel Fortran).
Presently, when switching compilers I have to manually write "USE DFPORT" instead of "USE IFPORT" or vice-versa in all the subroutines using the module. This rather inconvenient.
Is there an automatic way of doing it, without having to manually change the text when swiching compilers? This would render the code platform independent (at least for the two platforms I am testing).
Thanks,
Francisco
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you notice the .pdf documentation for ifort recommends the standard Fortran intrinsic DATE_AND_TIME in preference to a majority of those, or ETIME could usually be replaced by CPU_TIME?
Besides, you might make an ifport.f90 which USEs dfport.f90 so as to make CVF resemble ifort in this respect. According to the doc, not all the functions you mentioned are declared there.
Besides, you might make an ifport.f90 which USEs dfport.f90 so as to make CVF resemble ifort in this respect. According to the doc, not all the functions you mentioned are declared there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can consider using the Intel Compiler predefine (__INTEL_COMPILER) and -fpp.
Compile the sample below on Linux with ifort using:
ifort -fpp sample.f
Compile the sample on Windows with CVF using:
cvf -fpp sample.f
sample.f
=======
[cpp]program sample #ifdef __INTEL_COMPILER USE IFPORT #else USE DFPORT #endif end[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
Did you notice the .pdf documentation for ifort recommends the standard Fortran intrinsic DATE_AND_TIME in preference to a majority of those, or ETIME could usually be replaced by CPU_TIME?
Besides, you might make an ifport.f90 which USEs dfport.f90 so as to make CVF resemble ifort in this respect. According to the doc, not all the functions you mentioned are declared there.
Besides, you might make an ifport.f90 which USEs dfport.f90 so as to make CVF resemble ifort in this respect. According to the doc, not all the functions you mentioned are declared there.
When I composed the code I did not find those intrinsic procedures, only the DFPORT module's ones. I am convinced it will not be difficult to adapt my code with it.
Thanks for the tip!
Francisco
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Kevin Davis (Intel)
You can consider using the Intel Compiler predefine (__INTEL_COMPILER) and -fpp.
Compile the sample below on Linux with ifort using:
ifort -fpp sample.f
Compile the sample on Windows with CVF using:
cvf -fpp sample.f
sample.f
=======
[cpp]program sample
#ifdef __INTEL_COMPILER
USE IFPORT
#else
USE DFPORT
#endif
end[/cpp]
It worked! Thanks!
When I'll have the time, I will also try Tim18's tip of switching to standard Fortran procedures.
Francisco

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