Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
64 Views

IMSL non-linear solver NEQNF exception

I called the DNEQNF non-linear solver by IMSL but keep getting this exception after a few iterations. An mkl_dfti module is used during as part of the function needs to be solved during DNEQNF.

"Exception thrown at 0x3D3E5144 (imslmkl_dll.dll) in *.exe: 0xC0000005: Acess violation writing location 0xCCCCCCCC.

If there is a handler for this exception, the program may be safely continued."

 

The error is forrtl: severe (157): Program Exception - access violation

0 Kudos
7 Replies
Highlighted
Black Belt Retired Employee
64 Views

Going by the error messages, you've passed an invalid storage address to the routine for an output parameter. 

0 Kudos
Highlighted
64 Views

In Debug build (depending on other factors), the runtime image initializes uninitialized data to 0xCCCCCCCC.

I agree with Steve, the address of an output (or workspace) has not been initialized. Note, this can also occur if you declare an incorrect interface or lack thereof, use something like EXTERN someFunction where the function requires an interface.

Jim Dempsey

0 Kudos
Highlighted
Beginner
64 Views

Thanks for answers, Steve and Jim.

Why this only occurs after a few iterations? Also, I am wondering how I can fix this?

0 Kudos
Highlighted
Black Belt
64 Views

Please show the source code, or at least the subroutine in which the nonlinear equations are defined, the call to DNEQNF, and the declarations of the variables in the CALL statement.

Access errors can occur if you are using ALLOCATE for some temporary array (possibly needed for the FFT calls inside your FCN subroutine) and use the array without checking the allocation status. Your program may run out of heap space if you do not deallocate such variables after they are no longer needed.

0 Kudos
Highlighted
64 Views

Are you USE-ing the provided module interfaces .OR. did you provide your own?

Speaking of allocatables. Should you have realloc_lhs enabled (default now)

arrayOut = ArrayOrArrayExpression

can resize arrayOut. Should this arrayOut be a workspace array or output array of MKL or other library, these library calls will use the (then) provided array. IOW they will not re-re-size the array to what is necessary. It is your responsibility to assure proper arguments to the routine called.

Jim Dempsey

0 Kudos
Highlighted
Beginner
64 Views

I used the provided module interface. Thanks for all the help. I figured out the problem is because I used a pre-assigned fnorm variable for the non-linear solver. 

0 Kudos
Highlighted
Black Belt
64 Views

xi, shun wrote:

I figured out the problem is because I used a pre-assigned fnorm variable for the non-linear solver. 

I find that puzzling. Since FNORM is an output variable for NEQNF, it should not matter whether or not a value is assigned to it before the call. However, if a literal constant were used as the actual argument, then an attempt to overwrite it could cause an access violation.

Please clarify what exactly happened, because the answer could help others later with similar problems.

0 Kudos