- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI
I have a set of old Fortran 77 code, they were compiled and executed with old Compaq Fortran and it worked fine. With the Intel Fortran, they either cannot be compiled, or the results of execution different form results with Compaq.
Is there any setting/flags available to make the Intel compiler bahave the same as Compaq f77? Or are there any settings required to compile 77 Fortran code?
Thanks
Howard
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Read this note:
Migrating from CVF
and, if there are still questions left unanswered, you may ask here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please note that Intel Visual Fortran is directly descended from Compaq Visual Fortran (there was never any such thing as Compaq F77), so correct code should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the code base is pretty big (about 5000 lines of code for one module)
so far i encounter 2 discrepancies: when a main program call a subroutine, the array in the sub dimension with larger value, then it will not spit error message in Intel, however, it seems accepted in Compaq.
another issome local variables (undeclared with sobroutine)which i know they behave differently from the 'old module'. In the intel environment,they weresometimes set to 0, however, under Compaq environment, seems they carry the values set in previous call.
is there any way i can make the compiled behavior the same as the 'old Compaq' does?
Thanks
Howard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For the first case, it is an error for an array dummy argument in the subroutine to be larger than the array you are passing to it. You should fix this, as otherwise you may get unpredictable results. If you know that the subroutine never accesses past the end of the array, declare it with (*) in the subroutine instead of the larger size.
In the second case, you make the invalid assumption that local variables retain their value across calls without the SAVE attribute. Add a SAVE statement in the subroutine that names the variables where this is needed. You can just say SAVE with no variable names listed, and all will be saved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your suggestions do help, the first program seems working now. However, still there are other discrepancies found in the subsequent modules.
My qeustion is: are there any documentation on all the possible discrepancies between Compaq and Intel, and how to remediate them to make them compatible?
Thanks
Howard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please describe the problems and we'll be glad to help you with them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:Dear Steve, Could you please help me? I have a code (attached with the post, downloaded from netlib.org) which used to work fine with Compaq, but it does not give proper results in Intel. I am calling ranf() function which logically should return a random value between 0 - 1, but it gives me 48271.0 always. :( Looking forward for your reply. Regards, VinodAlso, if you would like help, please post or attach the code in question along with the error messages. If you are getting argument type mismatch errors or similar, then these are coding errors not detected by the earlier compiler.
Please note that Intel Visual Fortran is directly descended from Compaq Visual Fortran (there was never any such thing as Compaq F77), so correct code should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:Thank you Steve and mecej4 for your replies. The function, oranf() has solved my problem. :) With best regards, VinodThe file that was attached (snorm.f) contains a function that returns normally distributed real numbers, which it obtains from uniformly distributed random numbers using a transformation. The uniformly distributed random numbers are supposed to be obtained by calling RANF(), which https://wci.llnl.gov/codes/basis/manual/node183.html identifies as an old 48-bit RNG.
This RANF was part of Mathlib on CRAY computers, and there is mention of RANF in the CXML library documentation that came with Compaq Visual Fortran, but that documentation says that the Windows version of CXML did not have the Scilib component, which would have provided RANF.
Steve's advice to call the modern RANDOM_NUMBER is good. If, however, you need to reproduce the behavior of old code I suggest that you change all instances of RANF in snorm.f to ORANF, and use the following for ORANF, which implements the old function referenced above.
function oranf() integer*8 S,a,M data S/Z'0000948253fc9cd1'/,a/Z'00002875a2e7b175'/ data M/Z'0001000000000000'/ oranf=real(S)/M S=iand(a*S,Z'0000FFFFFFFFFFFF') return end

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