gfortran

Can CPP preprocessing statement in Fortran be indented?

风流意气都作罢 提交于 2019-12-29 01:47:07
问题 I am fairly new to use Fortran preprocessing statement and have a question which is probably pretty native. Can Fortran preprocessing statement be indented? I tested using Gfortran 4.8.1 on Linux (openSUSE Leap) and it turned out I it can not be indented at all. The following code main.f90 works with gfortran -cpp main.f90 -o main : program main implicit none #ifdef DEBUG print *, "I am in debug mode" #endif print *, "hello world!" end program main But the following throws an error: program

lgfortran not found

大城市里の小女人 提交于 2019-12-28 15:21:10
问题 I am using Ubuntu 10.04 and trying to compile some code that uses gfortran. At some point Makefiles does: -L. -lgfortran and I get the error /usr/bin/ld: cannot find -lgfortran although it is installed: ldconfig -p | grep fortran libgfortran.so.3 (libc6,x86-64) => /usr/lib/libgfortran.so.3 How can I fix it? P.S: The Makefile: ## FLAGS CC:= gcc C++:= g++ CFLAGS:= -c -O -Dintel -g FC:= gfortran FFLAGS:= -c -O -cpp -g LD:= g++ LDFLAGS:= -O WETTER_CGAL_FLAGS:= -g #WETTER-Data WETTER_cgal: weather

Including a compiled module in module that is wrapped with f2py (Minimum working example)?

末鹿安然 提交于 2019-12-28 12:09:22
问题 I have tried, but am failing, to get a minimum working example. As I do not need to expose much of my fortran code to python, I don't need f2py to wrap large parts of it. Also, due to allocatable arrays being passed and derived types being used, I specifically want f2py to only wrap the interface module I created (in the following example 'main.f90'). But I am having problems to get the other modules which I compile separately to link to my main module. The Code: Note all source files are in

Including a compiled module in module that is wrapped with f2py (Minimum working example)?

邮差的信 提交于 2019-12-28 12:09:14
问题 I have tried, but am failing, to get a minimum working example. As I do not need to expose much of my fortran code to python, I don't need f2py to wrap large parts of it. Also, due to allocatable arrays being passed and derived types being used, I specifically want f2py to only wrap the interface module I created (in the following example 'main.f90'). But I am having problems to get the other modules which I compile separately to link to my main module. The Code: Note all source files are in

Why is the type not accessible?

柔情痞子 提交于 2019-12-28 04:26:39
问题 I'm trying to return a type from a fortran function. This is the code. module somemodule implicit none ! define a simple type type sometype integer :: someint end type sometype ! define an interface interface ! define a function that returns the previously defined type type(sometype) function somefunction() end function somefunction end interface contains end module somemodule In gfortran (4.4 & 4.5) I get the following error: Error: The type for function 'somefunction' at (1) is not

gfortran REAL not accurate to 8 decimal places [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-25 20:00:31
问题 This question already exists : gfortran represents REAL incorrectly [duplicate] Closed 5 years ago . This question has not been previously answered. I am trying to represent a real or any number for that matter in Fortran correctly. What gfortran is doing for me is way off. For example when I declare the variable REAL pi=3.14159 fortran prints pi = 3.14159012 rather than say 3.14159000. See below: PROGRAM Test IMPLICIT NONE REAL:: pi = 3.14159 PRINT *, "PI = ",pi END PROGRAM Test This prints:

How are the types in this COMMON statement specified?

孤者浪人 提交于 2019-12-25 11:01:36
问题 I have an old fortran code that I am attempting to decipher and understand what is going on so I can modify it. Unfortunately I am a bit of a neophyte in fortran so I am having trouble figuring out this statement. C 15/04/97 IBM VERSION ECIS96 CALC-000 SUBROUTINE CALC(W,NW,DW,IDMX) CALC-001 C MAIN SUBROUTINE OF THE PROGRAMME CALC-002 C W,NW,DW ARE THE WORKING SPACE IN EQUIVALENCE BY CALL,STARTING AS CALC-003 C REAL*8. THEY ARE RESPECTIVELY REAL, INTEGER AND DOUBLE PRECISION. CALC-004 C IDMX

Disable vectorized looping in FORTRAN?

风流意气都作罢 提交于 2019-12-25 09:33:58
问题 Is it possible to bypass loop vectorization in FORTRAN? I'm writing to F77 standards for a particular project, but the GNU gfortran compiles up through modern FORTRANs, such as F95. Does anyone know if certain FORTRAN standards avoided loop vectorization or if there are any flags/options in gfortran to turn this off? UPDATE: So, I think the final solution to my specific problem has to "DO" with the FORTRAN DO loops not allowing the updating of the iteration variable. Mention of this can be

Fortran runtime error: Bad real number

烂漫一生 提交于 2019-12-25 06:31:18
问题 I have a code as enclosed below. It is supposed to read a binary file and produce a special format. (This code is a part of siesta code.) However, I receive the following error when I execute the code: At line 127 of file grid2cube.f (unit = 5, file = 'stdin') Fortran runtime error: Bad real number in item 0 of list input The fortran compiler and flags that I have compiled the main code are: FC= /usr/local/bin/mpif90 FFLAGS=-g -O2 FPPFLAGS= -DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT LDFLAGS= This

Fortran runtime error: Bad real number

别来无恙 提交于 2019-12-25 06:30:19
问题 I have a code as enclosed below. It is supposed to read a binary file and produce a special format. (This code is a part of siesta code.) However, I receive the following error when I execute the code: At line 127 of file grid2cube.f (unit = 5, file = 'stdin') Fortran runtime error: Bad real number in item 0 of list input The fortran compiler and flags that I have compiled the main code are: FC= /usr/local/bin/mpif90 FFLAGS=-g -O2 FPPFLAGS= -DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT LDFLAGS= This