- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I recently encountered a problem that I have not seen before, and am not sure I understand. I have been working on some code for around 10 years now. This code is all compiled into a single executable file. The program is designed to undertake repeated numerical optimisations a large number of times (running into the billions), and stores results in a series of allocatable arrays (to avoid stack over-flow issues). I also use a large number of allocatable variables as globals, which are referenced throughout the code. I recently found that adding a single global allocatable array to my program now produces unreliable results. Specifically, if you run the program without the addition of (global) allocable variable X, then you get some answer for a particular optimisation Y1. If you then add the allocatable variable X, and allocate but do not use it, then you get the same result Y1 if teh revised code is run through VS. But if you then run the revised code outside of the debugger, then you get result Y2.ne.Y1 - using the same compiled version of the code (ie, not recompiling, just double clicking the executable rather than launching it through the debugger).
This is obviously a non-trivial problem for me. Could this be happening because I have reached some sort of technical limit in relation to the use of allocatable variables? If so, then would cutting my program up into pieces resolve the issue? Any other comments or suggestions would be most welcome.
I am using IVS 13.0.1.119 in VS 2010 and do not provide my compiler options here, as the same result seems to crop up in both my development and release configurations.
Justin.
Link Copied
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:1) Apologies - how to you provide an explicit interface? I may be missing this. I do, however, have the "warn: interfaces" option turned on, and no warnings are being generated by the compiler.If a subprogram has one or more arguments that are declared with the ALLOCATABLE attribute, the program units that call or invoke that subprogram must be provided with an explicit interface. Failing to provide an interface when one is required can cause problems of the type described, as can the use of undefined variables.
The Intel compiler allows you to receive warnings of incorrect interfaces.
- 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
jvandeven wrote:One way is to put the body of the subroutine in a module, and then USE that module in the subprograms that call the subroutine. Another is to provide interface blocks, but in this case you have to be careful about providing a correct interface block. If /warn:interfaces is not turning up errors, however, the source of your problem may lie elsewhere Just as local variables in a subprogram need not retain values from a previous call, module variables may come into scope and go out of scope. Do you have your "global" variables in a module that is USEd in the main program?Quote:
Apologies - how to you provide an explicit interface?
- 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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page