- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
If I compile with the option -check bounds I get different results to when I compile without this option. But no errors come up on screen. How do I find out where the problem is?
UPDATE: I also get different results if I compile my code with and without the option debug. But again, no messages on screen - I don't have a clue where the problem is?
UPDATE: If I run my code using the two different approaches below, I end up with different results. But the only difference is that I'm passing the variable ncells (which is used to define array dimensions). I don't understand why different results are produced?
Approach 1
-------------------
program main
integer ncells
parameter (ncells=500)
CALL mbmodel(ncells)
end
subroutine mbmodel(ncells)
integer ncells
real var1(ncells,200,300),var2(ncells,200,300)
end
--------------------
Approach 2
-------------------
program main
CALL mbmodel
end
subroutine mbmodel
integer ncells
parameter(ncells=500)
real var1(ncells,200,300),var2(ncells,200,300)
end
---------------------------
Many Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
If I compile with the option -check bounds I get different results to when I compile without this option. But no errors come up on screen. How do I find out where the problem is?
UPDATE: I also get different results if I compile my code with and without the option debug. But again, no messages on screen - I don't have a clue where the problem is?
UPDATE: If I run my code using the two different approaches below, I end up with different results. But the only difference is that I'm passing the variable ncells (which is used to define array dimensions). I don't understand why different results are produced?
Approach 1
-------------------
program main
integer ncells
parameter (ncells=500)
CALL mbmodel(ncells)
end
subroutine mbmodel(ncells)
integer ncells
real var1(ncells,200,300),var2(ncells,200,300)
end
There's not enough here to give a definitive answer. In this example, you are using an f90 automatic array. It is allocated dynamically when the subroutine is entered. There is no good way to check for success of allocation of an automatic array; for this reason, ALLOCATABLE is recommended, with checking, wherever there is danger of failure.
Another recent post presented a working example, where ifort -check gave the same (correct) result as ifort -O1, but ifort -O2 (default) gave a different result. This leads to suspicion that one of the vectorization options has gone wrong, even though the case presented wasn't suitable for vectorization.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's not enough here to give a definitive answer. In this example, you are using an f90 automatic array. It is allocated dynamically when the subroutine is entered. There is no good way to check for success of allocation of an automatic array; for this reason, ALLOCATABLE is recommended, with checking, wherever there is danger of failure.
Another recent post presented a working example, where ifort -check gave the same (correct) result as ifort -O1, but ifort -O2 (default) gave a different result. This leads to suspicion that one of the vectorization options has gone wrong, even though the case presented wasn't suitable for vectorization.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you submit a problem report on you account at premier.intel.com, with a working example?
You might be able to narrow it down by compiling subroutine by subroutine at both -O1 and -O2, and by using
!dir$ no vector
directives loop by loop to turn off vectorization.
We had a case recently where such a problem was provoked by risky use of EQUIVALENCE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to revive this thread since I am having a similar problem.
Compilation with -check produces good results as does compilation with -debug.
Compilation with -debug and -O2 produces wrong results.
tim18 said in this thread (above) that there might be a problem with the vectorization. I am not familiar with this concept but if I compile with "-diag-enable vec" I have "loop was vectorized" messages everywhere, which I think is good.
When I say "wrong results", Imean that at some point in the code I have assignments like those:
XR(1) = a
XR(2) = b
but when I print XR(1) and XR(2) I do not get "a" and "b".
I am aware that this typically a sign of out of bound arrays and/or argument type mismatches, but I did check these extensively - I have been looking at it for a week now.
I would greatly appreciate any help,
Rafael

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