The description of problem: I have a very old subprogram which was written for Microsoft Fortran v.5 (DOS, pre-windows era). There are two arrays in program code. The dimensions, the array specifications are (35,40) and (37,38). The program code was written so that it assumed that all elements of array specification that less than 1 are computed, but their values are equal 0. In Intel Fortran, the elements of array specification that less than 1 are computed with the own values. As result, the two summations give two different results of computing compared MS-Fortran and Intel Fortran. I understand that the modern Fortran operates with elements of array specification that less than 0 and negative ones. And the old code is a heritage of Fortran IV. Thus I have a question: how to lock the individual elements of array which are less than 1 and make all calculations with them are equal 0 in order to revert to the scheme of old Fortran.
How to tame the ancient arrays?
Runtime issues in legacy multiple entry subroutines
Hi, I am in evaluation mode of your product on Windows and OS X. I am trying to get some legacy FORTRAN IV code running and I have issues with existing multiple entry point subroutines. Here is a basic sample that has the problem I am having:
DIMENSION TEST(10),NTEST(5)
N=5
CALL TESTENTRY(N,TEST,NTEST)
A=2.
B=3.
C=5.
I=2
CALL ENTRY1(I,A,B,C)
END
SUBROUTINE TESTENTRY(NENT,TESTENT,NTESTENT)
DIMENSION TESTENT(NENT),NTESTENT(NENT+1)
RETURN
ENTRY ENTRY1(ICOUNT,A,B,C)
DO 10 I=1,ICOUNT
TESTENT(I) = A*FLOAT(I)
NTESTENT(I) = I
10 CONTINUE
RETURN
END
what happens is the program logic expects the arrays to be available under ENTRY1 but they are not available, as indicated in the debugger with a breakpoint set at the first line of the do loop. It appears the arrays and variables available in the main entry are not available in the second entry, even the integer NENT. Is there some flag I can set for the compiler to understand this kind of FORTRAN IV style logic?
Thanks
can build a DLL, but cannot run it on another pc
I have built a very simple DLL using Intel fortran. I can successfully call a routine in it from an Excel visual basic macro on my own computer, but not on another computer. I get a message about "file not found" and "error 53".
I think the right compiler options are what I'm looking for. Can anyone tell me what I need to do?
So far I'm doing everything with 32 bit options, and Excel is a 32 bit version. Once I get this working, I want to get it working for 64 bit Excel.
Thanks,
Brian
Is it possible to call C# directly from Fortran?
Hello,
I know its possible to call C# from Fortran via C++. but was wondering do we some direct way to do it with the new intel compiler 2015?
Thanks
Creating .exe file from Fortran
Hi, So I am very new to Fortran and just started working with Microsoft Visual Studio.
I was wondering how it is possible to export the code as .exe so it would be readable by other computers with no compiler .
Thanks,
Arman
Polymorphic Pointers
I am trying to use pointers to create links between objects. Using Fortran and here is the code piece:
module base_pars_module type,abstract,public :: base_pars end type end module module test_parameters_module use base_pars_module type, extends(base_pars) :: test_pars contains procedure :: whoami end type contains function whoami(this) result(iostat) class( test_pars) :: this write(*,*) 'i am a derived type child of base_pars' end type end module module base_mask_module use base_pars module type, abstract , public :: base_mask class(base_pars),pointer :: parameters end type end module module test_mask_module use base_mask_module implicit none type, extends(base_mask) :: test_mask end type end module program driver type(test_pars) , target :: par_Test type(test_mask) :: mask_test iostat= par_test%whoami() mask_test%parameters=>par_test iostat=mask_test%parameters%whoami() end program
parameters at base_mask_module is a pointer with base_pars class. I would like to use this pointer to refer par_test object which is test_pars type that extends base_pars type. So the pointer and the target has the same class. But when I compile this it gives an error:
driver.f90:17.37: iostat=mask_test%parameters%whoami() 1 Error: 'whoami' at (1) is not a member of the 'base_pars' structure
Is it a bug or am i doing something wrong?
Program using IMSL LIN_SOL_GEN crashing on runtime machine
Hello all,
This has to be a silly problem but I can't seem to find the source of it.
I have created a Fortran module which I compile and link to work with Python. This module makes use of several routines of the IMSL library, including LIN_SOL_GEN. Compilation seems to work fine( I'm using static linking) and the whole thing runs fine on my machine. However, when I give the compiled file to a colleague to run on his machine (he has installed the Intel Fortran redistributables library), everything works fine except for the LIN_SOL_GEN routine. On his machine, when that particular routine is called, the program stops without any error message. Absolutely no clue whatsoever.
I have modified the terminal error flags so that IMSL routines won't stop the program, to no avail.
I have tried to use an alternate routine to perform the linear solve, LIN_SOL_SVD (basically, just changed the name of the routine called!), and the whole thing works fine on the runtime machine, albeit LIN_SOL_SVD is a lot slower than LIN_SOL_GEN for my particular problem.
I suspect this has to do with "High performance"/SMP behaviour of LIN_SOL_GEN but can't find exactly what makes it fail on the runtime machine but not on mine. Is there something special to do to make SMP routines work on runtime-only machines?
Many thanks.
Cédric
Debug impossible with Visual Studio 2013
Dear all,
up to a week ago I was perfectly able to compile and debug a Fortran code with Visual Studio 2013, paralleziled with openMP, but now, when debugging, I get the error message:
Debug assertion failed!
Program:*\mycode.exe
File:f:\dd\vctools\crt\crtw32\misc\winsig.c
Line:418
Expression: invalid signal or error.
This happens only when debugging because the executable is actually working nicely. Moreover I have no error message on the command window. I haven't change any settings in VS.
Could you please help me to figure out what can cause the problem?
Thanks
error #5082: Syntax error, found
Hi Steve
could you help me please?
Thanks
David
I have following error:
Error 1 error #5082: Syntax error, found '(' when expecting one of: <END-OF-STATEMENT> ; <LABEL> BLOCK BLOCKDATA PROGRAM MODULE TYPE COMPLEX BYTE ... c:\Source\neu29.05.15\src\traeger12\traeger12\traeger12\h_anstell.f90 13
here my cods:
subroutine h_anstell (kontur, anstmass)
use modmpc, only: profil
record / profil/ kontur
real(kind=8) :: anstmass
integer :: i
do i=1,kontur.anz_punkte
if (kontur.pkt(i).y < 0 ) then
(kontur.pkt(i).y = kontur.pkt(i).y - anstmass/2_8)
elseif (kontur.pkt(i).y > 0) then
(kontur.pkt(i).y = kontur.pkt(i).y + anstmass/2_8)
endif
enddo
end subroutine
Visual Studio 2005 and Composer XE 2013
I have Visual Studio 2005 installed and am trying to upgrade my FORTRAN projects from Composer XE 2011 to Composer XE 2013. Composer XE 2013 seemed to install properly but it does not appear under Options -> Intel Visual Fortran -> Compilers in Visual Studio. How can I get Visual Studio to compile with Composer XE 2013?
File is opened. But giving an error
Hi,
I open a file using this.
open(100,FILE ='temp.txt',STATUS='OLD',ERR=63)
But it goes to error line.
Then,I check the error using this(when the error is happen) .
INQUIRE (100, OPENED=I_OPENED, NAME=I_NAME, ACTION=I_ACTION)
But it says file is opened.
I_OPENED = T and other variable are fine.
Please help me.
Composer XE 2011 License File Error in Windows 8.1
I have a Windows 8.1 laptop that I am trying to install Composer XE 2011.n Intel has provided the .lic file for my serial #/copy of the installation disks. However, the installation using a license file still says the Intel provided file in invalid. Are there known compatibility issues with Composer XE 2011 license file installations and Windows 8.1? A Google search was unproductive.
Stack Error Passing a string from VB.NET to a Fortran DLL
Hi,
I am rewriting a large application moving from VB6 using FORTRAN executables, to VB.NET using FORTRAN DLL's.
I am able to move single values and arrays both to and from the DLL, but now have gotten stuck trying to push strings.
Here is the relevant VB.NET code:
In the declarations section:
<UnmanagedFunctionPointer(CallingConvention.StdCall)> Private Delegate Sub pushString(ByRef varIndex As Short, ByVal MsgString As StringBuilder) Dim EntryPointer As IntPtr = NativeMethods.LoadLibrary(EXE_DLL_filename) FunctionPointer = NativeMethods.GetProcAddress(EntryPointer, "pushString") Dim pushString As pushString = CType(Marshal.GetDelegateForFunctionPointer(FunctionPointer, GetType(pushString)), pushString)
Executable code:
Dim index As Short = 501 Dim filePath As String = "C:\Users\mark.ARROWTECH\AppData\Local\Temp\tmpD33F.tmp" Dim strMessage As StringBuilder = New StringBuilder(filePath, 120) pushString(index, strMessage)
The DLL that I link to is only known at runtime.
Relevant FORTRAN code:
!dec$ attributes dllexport, CVF, alias : 'pushString' :: pushString SUBROUTINE pushString(varIndex, InputString ) use, intrinsic :: ISO_C_BINDING USE Traj20006D_Global_Export integer(2), intent(in) :: varIndex CHARACTER(KIND=C_CHAR,LEN=1), INTENT(in) :: InputString(*) INTEGER :: StringLen INTEGER :: I !.. Determine input string length; check for null-termination StringLen = 0 Loop_SizeVec: DO ! IF (InputString(StringLen+1) == C_NULL_CHAR) THEN EXIT Loop_SizeVec End If StringLen = StringLen + 1 IF (StringLen == 2048) THEN !.. Replace: arbitrary large length EXIT Loop_SizeVec END IF END DO Loop_SizeVec IF (StringLen == 0) RETURN select case(varIndex) Case (501) FORALL (I = 1:StringLen) !.. Copy string TEXTFILE1(I:I) = InputString(I)(1:1) END FORALL Case (502) FORALL (I = 1:StringLen) !.. Copy string TEXTFILE2(I:I) = InputString(I)(1:1) END FORALL End Select Return END SUBROUTINE pushString
So what happens is the string is transferred fine, but on leaving the routine I get this error:
"Additional information: A call to PInvoke function 'PRODASV4!PRODASV4.prodasTask+pushString::Invoke' has unbalanced the stack. "
I am just not sure what to try next.
Thanks,
Mark
Matrix Determinant
Hi all,
I am just trying to get a determinant of a matrix ( could be from 4x4 to 10x10 , so not huge matrices). I was wondering what is the most efficient way?
Using MKL or....
also the matrix would not be always a sparse matrix.
Thanks,
Arman
Optional Arguments and Their Uses.
Dear All,
I was wondering: is it worth considering to code using optional arguments or should they be avoided at any cost? Is there a loss in performance if optional arguments are used?
I have read the FORTRAN Newsletter Articles posted by Dr.Fortran.
Looking forward to your thoughts,
Daniel.
std_minus0_rounding
I have Visual Studio 2013 with the Intel(R) Visual Fortran Compiler XE 14.0.5.239 which is supposed to support the std_minus0_rounding compiler option but I cannot figure out how to set that option using the Visual Studio IDE. Can anyone help? Thanks.
debugging sample project VB-Calls-Fortran.sln
I have built this sample project, and it runs fine, but I'm having limited success with the debugger. The instructions say...
To enable debugging of Fortran code called from Visual Basic, right click on project "VBCallsFortran" and then select Properties. In the left column, select Configuration Properties > Debugging. Check the box labeled "Enable unmanaged code debugging"
VS 2012 doesn't have that option, but there is Enable Native Code Debugging. Checking that gets the debugger to step into and through the fortran code, but the values of arguments cannot be examined, although local variables can. Is there something else I need to do to enable this?
Overriding the READ function in Fortran
All,
I have inherited a legacy Fortran system which contains several different modules which read ASCII text files from various logical units. Examples:
100 read (userin,1,iostas=ios) line
READ(I3,805) ACTYCO,
etc.
The Fortran system is distributed with the necessary ASCII text files. I have been given the task to only delivered the system with binary files instead of ASCII files for proprietary data security. An easy solution would be to add a converter of the binary files to ASCII in a temporary file at the beginning of the system and then delete the temporary ASCII files after all the reads are complete. This solution has been removed due to the possible of temporary file remaining on the user's machine after an unexpected crash of the Fortran.
So, my question is: Can I override the "READ" function in Fortran ( similar to C capability ) to insert my own READ which would handle either ASCII or binary? This would allow me to not change the hundred or so READ statements in the legacy code. Also, if there is a more elegant solution this the problem stated, I am all ears.
Thanks,
Bryan
Calling C in dynamically loaded DLL from Fortran
I have always been using this method to call functions in a dynamically loaded DLL: INTERFACE logical function Check_Security_DLL(itype) BIND(C, NAME="Check_Security_DLL") integer(4) :: itype [value] end function Check_Security_DLL END INTERFACE pointer (p_CheckSecurity, Check_Security_DLL) if(.not. LibLoaded) then dll_handle = LoadLibrary('Tec1.dll'//char(0)) if (dll_Handle /= 0) then i_CheckSecurity = GetProcAddress(dll_handle, "Check_Security_DLL"C) if (i_CheckSecurity /= 0) then p_CheckSecurity = i_CheckSecurity LibLoaded = .true. endif endif endif if (LibLoaded) then result = Check_Security_DLL(type) endif
However I get these warnings if I switch on F2008 checking:
D:\ToolsetIncs\Check_SecF.F90(23): warning #7028: Integer pointer non-standard
D:\ToolsetIncs\Check_SecF.F90(17): warning #7372: Procedures as pointees is not supported in Fortran 2008 standard. [CHECK_SECURITY_DLL]
So I guess there is a new method, however the Samples do not have an example for dynamically loading the DLL and how to call a function in the DLL.
Program Exception - access violation
I am running some simulation software written in Fortran while using Matlab to automate the simulations. The simulations run through, but I keep getting this error very frequently while the program is running:
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
Simulate.exe 000000013F473F2B Unknown Unknown Unknown
Simulate.exe 000000013F473BDC Unknown Unknown Unknown
Simulate.exe 000000013F4DF4BC Unknown Unknown Unknown
Simulate.exe 000000013F4C80F6 Unknown Unknown Unknown
kernel32.dll 00000000773559CD Unknown Unknown Unknown
ntdll.dll 000000007758B981 Unknown Unknown Unknown
From what I found online, this error apparently means that I am using memory that I am not supposed to. However, I am puzzled by how it's reporting "unknown" for the Routine, Line, and Source. Any suggestions on how to deal with this?