I have been using the Intel Visual Fortran Composer XE 2011 on my project and I found something weird recently. When I run the code in the debugging window, it produces perfect result; however, if the executable is moved to a different location and perform a standalone calculation (meaning not through the IDE) there, the result is totally off. I'm sure this is caused by the MKL because:
1) it is the only additional library my code uses, more specifically, only subroutine DGETRF and DGETRS are called, 2) a comparison of the correct and incorrect results indicate that the difference rises from the outputs of these subroutines.
I used to use the "Build IDE one button option" (http://software.intel.com/en-us/articles/using-mkl-in-intel-compiler-mkl-qmkl-options), so I thought the issue is that when the location changes, the code somehow cannot figure out where to find the library. Then I switched to the manual configuration for the MKL setup: I set the Intel MKL include dependencies (\<mkl directory>\include\ia32), the library dependencies in Linker > General (<mkl directory>\lib\ia32) and Linker > Input (mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib mkl_lapack95.lib mkl_blas95.lib). All the procedures are given in the MKL user guide (https://software.intel.com/sites/products/documentation/hpc/mkl/userguides/mkl_userguide_win.pdf). I believe at least this will help the code locate the library because everything here is given by full path. Unfortunately, the problem exists.
I wonder if anybody has seen this before. Any help will be highly appreciated. Thanks very much for your time.
This is very strange. Do you have multiple MKL installations of different versions on your system? When you use the /Qmkl link option MKL is dynamically linked. It is possible that when you moved the executable out of the IDE somehow a different set of MKL lib files were loaded at run time. I'd suggest you try linking MKL statically and see if you still have the problem. For help on how to properly do static linking, see this web tool: http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
Another thing to try is to insert in your code a call to mkl_get_version_string (see here). This function returns MKL version number. Print out the return value and compare the output from in-IDE execution and from standalone execution. If they are different then this is the problem.
Let us know if this resolves the issue.
Most probable reason for this is the executables are run in different environments, and they may pick different dlls. The easiest way to see the environment is probably as follows. Add the following line somewhere in your program and study the outputs:
call system( "set > my-env.txt")
(Subroutine system executes the command given as string.)