gfortran

Which gfortran compiler flag is associated with the warning “Illegal preprocessor directive”?

喜夏-厌秋 提交于 2019-12-11 02:53:54
问题 When using pFUnit (3.2.9) to test my Fortran code, I get many "Illegal preprocessor directive" warnings, e.g. Warning: Illegal preprocessor directive /path/to/my/file/test.f90:37:2: #line 26 "/path/to/my/file/test.f90" 1 The code compiles and runs fine, so I would like to turn off these warnings, while still seeing other compiler warnings. Which gfortran compiler flag turns this specific warning off? I am working with gfortran 7.3.1. 回答1: This is not the kind of warning that one should turn

ifort's no-wrap-margin works only partially

喜你入骨 提交于 2019-12-11 02:52:52
问题 for some unfortunate reasons I have to use ifort, the "problem" is that ifort truncates long (>80 characters) write(*,*) lines by default (this doesn't happen in gfortran). There's an option called -no-wrap-margin that supposedly recovers the gfortran behavior, which is to write lines as long as I want in a single line. However this only works for lines with less than 8184 characters. A line longer than that, as for example the one obtained with program main implicit none integer :: i write(*

multiple definition link error in fortran (ifort - gfortran)

不羁的心 提交于 2019-12-11 02:49:23
问题 Well, I've this problem (the description is long, but I think it is easy to solve) . I've three files: nrtype.f90 , which have some stupid definitions, but it is used by the following files: module nrtype integer, parameter :: I4B = SELECTED_INT_KIND(9) integer, parameter :: I2B = SELECTED_INT_KIND(4) integer, parameter :: I1B = SELECTED_INT_KIND(2) integer, parameter :: SP = KIND(1.0) integer, parameter :: DP = KIND(1.0D0) endmodule nrtype LUd.f90 , which makes part of the work: module

Cannot find -lgfortran though gfortran is installed [duplicate]

心已入冬 提交于 2019-12-11 02:21:35
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: lgfortran not found I must admit that my question can be considered to be very similar to lgfortran not found, but as I am a newbie in Linux I need more help and I couldn't find what I am looking for in the above post. I have a fresh linux mint Debian edition installed and I am trying to make a lapack binding for Ada to work. If I check for gfortran, I get: gfortran-4.6 -v Using built-in specs. COLLECT_GCC

Fortran: pipe to program

北战南征 提交于 2019-12-11 01:28:10
问题 Is there any possibility to launch an external program from Fortran and write something to this programs standard input? I know e.g. of gfortran's SYSTEM but there is no such option. 回答1: Firstly, if you're using a relatively recent compiler you should be able to use execute_command_line (part of the f2008 spec) instead of system (compiler extension). This launches a command using the C library's system call which uses the sh shell on nix and cmd.exe on Windows (see here). As such you can use

MSMPI in-place MPI_Allreduce not working with MinGW-w64 gfortran

浪尽此生 提交于 2019-12-11 01:07:56
问题 I am trying to use the in-place MPI_Allreduce with the combination of MinGW-w64 gfortran (version 9.2 provided by MSYS64) and Microsoft MPI (version 10), call MPI_Allreduce(MPI_IN_PLACE, srcdst, n, MPI_REAL8, MPI_SUM, MPI_COMM_WORLD, ierr) The standard MPI_Allreduce (with distinct source and destination) works well, as does the in-place variant when I use C instead of Fortran. The complete test program test_allreduce.f90 is program test_allreduce use iso_fortran_env, only: real64 use mpi

OpenMP for dependent variables

你说的曾经没有我的故事 提交于 2019-12-11 00:30:17
问题 This is the first time I am using OpenMP, and I apply it for Fortran. I happened to have a problem adjusting the loop where there is a variable that requires update from its previous value. I tried using PRIVATE clause but the result is far from those resulted by serial computation (without OpenMP). I looked somewhere in OpenMP website and I found one solution using !$OMP PARALLEL DO ORDERED which finally works (produce the same result with the serial one). But it seems that by using this,

Fortran function returning unallocated array causes segmentation fault

邮差的信 提交于 2019-12-11 00:29:08
问题 I'm struggling with some Modern Fortran wrappers to some MPI scatter/gather routines. I am trying to have a wrapper interface that only has an array on input and returns the MPI-operated result on output, for several derived types, doing something like this: type(mytype), allocatable :: chunk(:),whole(:) ! [...] chunk descends from previous parts of the code ! Get global array whole = gatherv(array=chunk,receiver_node=cpuid) I'm doing this using functions that return allocatable arrays.

Do loop skipping even number

谁说胖子不能爱 提交于 2019-12-10 23:16:37
问题 I represents the global variable i.e the name I represents same variable inside and outside the function. Fact is first called when I = 1, which is the first value written. This value is passed to the function's dummy argument N. The same I is now given the initial value 2 by the DO loop inside Fact, but since it is greater than N, the DO loop is not executed, so I still has the value 2 when Fact returns to be printed in the main program. However, I is now incremented to 3 in the DO loop in

Syntax for openmp long directive list fortran77

随声附和 提交于 2019-12-10 22:58:34
问题 PROBLEM : Long list of directives openmp fortran77 c$omp parallel default(shared) private(i,k,i1,i2,i3,i4,i5, $ i6,x0,y0,z0,vnx0,vny0,vnz0,qs0) c$omp do Task to be performed c$omp end do c$omp end parallel I'm trying to compile the above program using ifort and it works fine. I have checked with the serial version and I get the same result ifort -openmp -parallel -o ./solve But when I try to compile using gfortran it doesn't work. gfortran -fopenmp I get the following error quinckedrop.f:2341