gfortran

Continuation in gfortran 5.2.0

℡╲_俬逩灬. 提交于 2019-12-12 04:08:50
问题 I need to work on Fortran90 code on my Macbook Pro, which was written on Microsoft Developer Tools years ago. As a free option, I have installed gfortran on my Macbook to be able to compile it. The original code includes & continuation character for the long lines but I am not able to use it. Without & character, everything works fine. What might be the problem? Do I need to activate something to be able to use & character? For example, I think something like this should work: x = 1 y = 2 z =

Error 'nf90_def_var_deflate has no IMPLICIT type' only on one computer

左心房为你撑大大i 提交于 2019-12-12 03:52:40
问题 I have some code which compiles fine on one machine but on a different machine (using the same compilers, gcc and gfortran, and same flags) I get an error which I can't understand how it is compile related: deflate_status = nf90_def_var_deflate(NCF%ncid, i, 0, 1, 7) 1 Error: Function 'nf90_def_var_deflate' at (1) has no IMPLICIT type The variable is definitely declared (and it compiles and runs on the first machine). What sort of problems with compile setup could cause this error? 来源: https:/

How can I get a basic Fortran file to compile on Windows/MinGW using CMake?

给你一囗甜甜゛ 提交于 2019-12-12 03:28:39
问题 I feel completely lost trying to get CMake to work on Windows. I have a project (ECCODES) that has Fortran and C files. I can compile Fortran files if I don't use CMake. But this project came with a ton of CMake files. I look at the error below and it says to me, " I (CMake) cannot compile a simple Fortran program even though you can compile Fortran files when you aren't using CMake." Can anyone make sense of this? I'm trying to use mingw64 since I can't use cygwin on this project for the

How to read real numbers as characters

懵懂的女人 提交于 2019-12-12 03:08:14
问题 I want to do some arithmetic operation to an array of real number and later I have to read it as an input for character variable. I used read statement still I get the error as UNIT SPECIFICATION MUST BE AN INTEGER OR CHARACTER VARIABLE. I also verified the format descriptor. Here is my piece of code real::la(10), sl integer::i character(len=5)::lat character(len=7)::station sl=11.25 do i=1,10 la = sl+ (i*0.25) read(la(i),'(F5.2)')lat station= lat//'xx' end do 回答1: When you have read(la(i),'

Is MPI_Gather the best choice?

白昼怎懂夜的黑 提交于 2019-12-12 01:36:52
问题 There are 4 processes and one of them ( 0 ) is the master which has to build the matrix C as follow -1 0 0 -1 0 0 -1 0 0 -1 -1 1 1 -1 1 1 -1 1 1 -1 -1 2 2 -1 2 2 -1 2 2 -1 -1 3 3 -1 3 3 -1 3 3 -1 To do so, the matrix is declared as REAL, DIMENSION(:,:), ALLOCATABLE :: C and allocated with IF (myid == 0) THEN ALLOCATE(C(2*nprocs,-2:+2)) END IF where nprocs is the number of processes. Process 0 also sets C = -1 . For the communications I first tried with CALL MPI_GATHER((/0.0+myid,0.0+myid/),&

Fortran: Syntax error in CHARACTER declaration

你。 提交于 2019-12-12 01:13:20
问题 I am trying to run a program, which works fine on my laptop, on a remote supercomputer. But the program is not compiling there. Trying to trace the problem, I reduced the program to the basic minimum, and still it is giving me a compilation error. Anyone has any ideas what might be going wrong here? [k00603@fe01p08 python_utilities]$cat test.f90 program test character(:), allocatable :: out end program test [k00603@fe01p08 python_utilities]$gfortran test.f90 In file test.f90:3 character(:),

Polymorphic dummy allocatable argument

廉价感情. 提交于 2019-12-11 17:08:12
问题 I have three functions that to the same thing but for different dummy argument types: flip, flipLogical and flipInt. Their very code is actually exactly the same! There is another function, called flip3D, which is only for real dummy arguments, that calls flip from its inside. This is the way that everything is working right now: function flip(data) real, dimension(:,:), intent(in) :: data real, dimension(:,:), allocatable :: flip integer :: m, n, i m = size(data,1) n = size(data,2) allocate

GDB debugger hangs on Fortran READ command when reading from a text file

限于喜欢 提交于 2019-12-11 17:05:25
问题 This is my fortran code (fortcode.for) CHARACTER TITLE*80 COMMON IN COMMON TITLE PARAMETER (MAXTIT=20) 20 FORMAT (A80) C*****FORTRAN LOGICAL UNIT NUMBER OF INPUT FILE IN = 5 DO 1665 I=1, MAXTIT READ (IN,20) TITLE 1665 CONTINUE CLOSE (IN) END I compile the fortran file into an executable (fortexec.exe) using the following command. gfortran -g -fno-align-commons fortcode.for -o fortexec.exe I then use gdb debugger by typing gdb fortexec I then give it the following file input (input.inp) testx

Why does f2py not include all arguments?

自古美人都是妖i 提交于 2019-12-11 13:57:07
问题 I am attempting to build a python wrap for some fortran code I have using f2py and am experiencing a very odd problem. I am using Python 3.4.3 32 bit, gfortran 4.8.1, and numpy 1.9.2 on Windows 8. f2py compiles the fortran code so I can call it from python. The code has multiple subroutines. Some of them work, but two do not. The important difference seems to be subroutine declaration spanning multiple lines. The working subroutines are declared on a single line. The ones that fail span

fortran write output: all variables in a line

老子叫甜甜 提交于 2019-12-11 13:48:56
问题 sorry, I try to write a file.dat whit a lot of columns (11) with different format (1.4e-12, 10...) when i try ro write the code i use the following fortran command: WRITE(7,*) id,t,a,e,inc,capom,omega,capm,mass,radius but each line in the original file is now write in multiply lines. From: 1222221 0.0 10.0 0.0 3.1415927 0.0 0.0 3.7828348 9.0E-9 4.0E-6 to: 1222221 0.000000000000000E+000 10.0000000000000 0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000