gfortran

Run a code in fortran multiple times with different input parameters

牧云@^-^@ 提交于 2019-12-24 04:08:23
问题 I would like to run a fortran 77 program multiple times with different set of input parameters; I already made sure that output file names change for different input parameters I use, but I am not sure how I can run a program with different set of input parameters without having to go to the code each time to change the parameters. To illustrate my question, here is a simple code. PROGRAM CODE IMPLICIT DOUBLE PRECISION (A-H, J-Z) COMMON / param / radius radius = 2 write(*,*) 'radius = ',

Can not compile fortran because dyld: Library not loaded

谁说我不能喝 提交于 2019-12-24 03:07:32
问题 ~$ gfortran hello.f dyld: Library not loaded: /usr/local/lib/libcloog-isl.4.dylib Referenced from: /usr/local/Cellar/gcc/4.9.2/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/f951 Reason: image not found gfortran: internal compiler error: Trace/BPT trap: 5 (program f951) Abort trap: 6 I just installed gcc using by brew and according to the error message how to solve this problem? 回答1: Sorry, I have to answer my question because i just figured out my problem by just reinstall cloog Commmand: brew

Fortran Syntax error in OPEN statement

和自甴很熟 提交于 2019-12-24 02:35:08
问题 I couldn't figure out what's wrong with the following Fortran OPEN statement: filename = 'state_save.txt' OPEN(FILE=TRIM(dir)//TRIM(filename),UNIT=ffunit,STATUS='old',FORM='formatted', IOSTAT=ios, readonly) [I added CR for clarity] Compiled under gfortran (from gcc-4.8.1), the above gives the following error: (dir)//TRIM(filename),UNIT=ffunit,STATUS='old',FORM='formatted',IOSTAT=ios, rea 1 Error: Syntax error in OPEN statement at (1) The code might compile OK with ifort (but I don't have

gfortran warn on floating point exception

▼魔方 西西 提交于 2019-12-24 01:00:53
问题 I'm using gfortran for some code. For a while now, I've been compiling with -ffpe-trap=zero,overflow,invalid in an attempt to hunt down some bugs. This causes my program to cease execution immediately. There are some cases where the FPE might be OK and so a flag like: -ffpe-warn=zero,overflow,invalid would be very useful. Does gfortran (or any other compiler) provide anything like this? If not, are there any workarounds? My current thought is to create a C function to register a signal

Unable to install fortran based packages in R - “gfortran -m32:not found”

人走茶凉 提交于 2019-12-24 00:58:19
问题 I am writing an R package that has Fortran source code. In short, my problem is when I try to install the package I get the error "gfortran -m32: not found" however, I am able compile my code using gfortran -m32 when I'm not installing the package. Detailed Version: I have installed the newest version of R(3.1.1) along with the newest version of Rtools(31) and renamed my path variables accordingly (C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Program Files\R\R-3.1.1\bin\x64;C:\msys;C:\Program

Variable format statement when porting from Intel to GNU gfortran

半城伤御伤魂 提交于 2019-12-24 00:39:18
问题 Suppose I'm trying to write out a CSV file header that looks like this: STRING1 2001, 2002, 2003, 2004, And some variable-format Fortran90 code that does this is INTEGER X<Y X=2001 Y=2004 WRITE(6,'(A,(999(5X,I4,",")))') ' STRING1',(y,y=X,Y) The "999" repeats the (5X,I4,",") format structure as many times as it needs to (up to 999 times, at least) to complete. Assume X and Y are subject to change and therefore the number of loop iterations may also change. But if I want the header to look like

Automatic dependency detection not working in GFortran

房东的猫 提交于 2019-12-23 20:39:21
问题 I the GCC Wiki it is stated that support for auto-detection of dependencies has been available since version 4.6: Support the generation of Makefile dependencies via the -M... flags of GCC; you may need to specify additionally the -cpp option. The dependencies take modules, Fortran's include, and CPP's #include into account. Note: Using -M for the module path is no longer supported, use -J instead. In my program I have two Fortran files: module_1.f08 and main.f08 , where main uses module_1 .

Solving quadratic equation but getting weird errors

岁酱吖の 提交于 2019-12-23 15:50:30
问题 I'm attempting my first program in Fortran, trying to solve a quadratic equation. I have double and triple checked my code and don't see anything wrong. I keep getting "Invalid character in name at (1)" and "Unclassifiable statement at (1)" at various locations. What is wrong with the code? ! This program solves quadratic equations ! of the form ax^2 + bx + c = 0. ! Record: ! Name: Date: Notes: ! Damon Robles 4/3/10 Original Code PROGRAM quad_solv IMPLICIT NONE ! Variables REAL :: a, b, c

installation of compiler gfortran in centos 6

ぐ巨炮叔叔 提交于 2019-12-23 09:36:45
问题 I try to install some compilers. I use Centos 6 in my laptop. I have installed the gcc, the "GNU" C Compiler. I need to install also gfortran, but when I type yum install gfortran , I get the message no package gfortran available . Do you know how can I install the fortran compiler? 回答1: Try yum install gcc-gfortran You can use yum search gfortran , to view relevant packages 来源: https://stackoverflow.com/questions/30489208/installation-of-compiler-gfortran-in-centos-6

Convert logical type to double in Fortran

我的未来我决定 提交于 2019-12-23 09:03:27
问题 I'm looking for a bulletproof way of converting logical type variables to real type that will work in both ifort and gfortran. The following works in ifort, but not in gfortran: logical :: a real :: b a = .true. b = dble(a) The error thrown in gfortran is b = dble(a) 1 Error: 'a' argument of 'dble' intrinsic at (1) must be a numeric type Obviously, .true. should map to 1.d0, and .false. to 0.d0. What's the best way of doing this? 回答1: I am not sure if there is an intrinsic tool that does this