fortran

Converting Integers to strings in Fortran.

I have a program in Fortran that saves the results to a file. At the moment I open the file using OPEN (1, FILE = 'Output.TXT') However, I now want to run a loop, and save the results of each iteration to the files 'Output1.TXT', 'Output2.TXT', 'Output3.txt', ... Is there an easy way in Fortran to constuct filenames from the loop co...

Fortran debugger for Mac OS X

Can anyone recommend a good Fortran debugger for the mac (other than installing gdb, etc, via fink or macports)? ...

Fortran technical query

I have the following function signature in Fortran. I am new to the Fortran language - what is meant by 0. in the function below? ANTY(IAN,NA,0.,0.) ...

Increasing Speed

A broad question I know but: Does anyone have general tips on increasing execution speed in Fortran programs? ...

Mixed language statically linking with gfortran and gcc

Hi, I have some code written in C and Fortran that I want to compile into a statically-linked executable. If I compile the code dynamically (using the -fno-underscoring option for gfortran), it all works fine. However, I want to link it into a .so file, statically linking most of the needed libraries, and then link dynamically to libkrb5...

How does BLAS get such extreme performance?

Out of curiosity I decided to benchmark my own matrix multiplication function versus the BLAS implementation... I was to say the least surprised at the result: Custom Implementation, 10 trials of 1000x1000 matrix multiplication: Took: 15.76542 seconds. BLAS Implementation, 10 trials of 1000x1000 matrix multiplication: Too...

Where can I learn Modern Fortran

I'm looking to do some physics computation and I'm kind of interested in exploring the fabled numerical powers of FORTRAN, but I'm not really wanting to dig through piles and piles of pages all about FORTRAN 70. Is there a good, clean, modern reference? Thanks in advance! ...

Fortran structures and pointers

Hi, I have a function in C. I want to call this function from Fortran. This function contains 2 structures passed by pointer. How do I do this in Fortran? Ex: struct a { int x; float y; }; struct b { int p; float q; }; In C: fun(*a,*b); How do I call this from Fortran? Here a is the input structure and b is the ...

Fortran runtime error "fixed" by writing output

Hi! I've having trouble with some old code used for research that I would like to compile using the Intel Fortran compiler. In a particular subroutine, I get segmentation faults unless I add in a write statement that just outputs the value of the loop index. do j=1,ne SOME STUFF write(*,*) 'j=', j end What could be causing my erro...

Fortran functions and return values

Hi, How can I write a function in Fortran which takes both input and output as arguments? For example: fun(integer input,integer output) I want to make use of the output value. I have tried something like this but the output variable is not holding the value. Specifically, I am calling a C function from Fortran which takes input and...

Fortran as a Good Choice

Is there any good reason to develop a new software project with Fortran anymore? ...

passing c# string argument to fortran 77 dll

Need help , in passing passing C# string to FORTRAN 77 dll as argument. FORTRAN 77 code: *$pragma aux CHARIN "CHARIN" export parm(value) SUBROUTINE CHARIN(FCHAR) C Declarations CHARACTER*(*) FCHAR C PRINT*,FCHAR C RETURN END C# code: using System; using System.Collections.Generic; using System.Text; us...

How do I format a PRINT or WRITE statement to overwrite the current line on the console screen?

I want to display the progress of a calculation done with a DO-loop, on the console screen. I can print out the progress variable to the terminal like this: PROGRAM TextOverWrite_WithLoop IMPLICIT NONE INTEGER :: Number, Maximum = 10 DO Number = 1, MAXIMUM WRITE(*, 100, ADVANCE='NO') REAL(Number)/REAL(Maximum)*100 100 FORMA...

Why do I get a StackOverflowException when I specify the size of an INTEGER array to be 200,000,000?

200,000,000 is much less than the maximum 32-bit INTEGER, 2,147,483,647. ...

Multi threaded FFTW 3.1.2 on a shared memory computer

I use FFTW 3.1.2 with Fortran to perform real to complex and complex to real FFTs. It works perfectly on one thread. Unfortunately I have some problems when I use the multi-threaded FFTW on a 32 CPU shared memory computer. I have two plans, one for 9 real to complex FFT and one for 9 complex to real FFT (size of each real field: 512*512...

Non-trivial private data in Fortran90 OpenMP

I have a section of a Fortran90 program that should be parallelized with OpenMP. !$omp parallel num_threads(8) & !$omp private(j, s, prop_states) & !$omp firstprivate(targets, pulses) ! ... modify something in pulses. targets(s)%ham contains pointers to ! elements of pulses ... do s = 1, n_systems prop_states(s) = targets(s)%...

Tentative definitions in C99 and linking

Consider the C program composed of two files, f1.c: int x; f2.c: int x=2; My reading of paragraph 6.9.2 of the C99 standard is that this program should be rejected. In my interpretation of 6.9.2, variable x is tentatively defined in f1.c, but this tentative definition becomes an actual definition at the end of the translation unit...

Writing and calling pure subroutines in Fortran 90 using gfortran

When writing and calling pure subroutines in Fortran 90 using gfortran, how do I find out why the compiler emits this error? Error: Subroutine call to XXXX at (1) is not PURE I'll try to pose my question as specifically as I can while at the same time being general enough to be useful to others, so I'll avoid pasting in my actual code...

fortran compiler 4 vs 11

Hi, I am porting an application from fortran older version (4.0) to new version (11.0). While porting I am facing some problems with real*4 variables: real*4 a,b,c a=0.9876875 b=0.6754345 c=a*b value for c in old compiler 0.667118, which is correct value. But with new compiler I am getting a small variation from the output(c variab...

Double precision in Fortran

Hi, I am using the Fortran 11 compiler in Visual Studio from Windows. How can I set real values to double precision from project properties? For example, in Fortran Powerstation (4.0) we have the menu option settings->code generation->default real kind (here we can set the type of the real data type). Similarly, how can we set double pr...