fortran

How to write a Fortran program that supports both static and dynamic memory management?

Hello, I'm working on a public release if a model using Fortran 9x and I'd like to design the code to support both static or dynamic memory management. I've only seen one example of a code that supports something like this. It is implemented using preprocessors that look something like this: The code would include some memory manageme...

Why doesn't this fortran code work?

Hey, I wrote this (fortran) with the aim of finding the minimum spanning tree of a bunch of points (syscount of them). I know for a fact that this approach works, since i wrote it in javascript earlier today. js is slow though, and i wanted to see how much faster fortran would be!! only problem is it's not working, i'm getting an annoyin...

What is causing one Vista machine to be 10 times faster than another machine?

We run a Fortran console program we have run for years. Recently we purchased identical new HP server class machines (4 processors, 8 gig ram, 4 hard drives) for everyone in the office. We configured them identically as nearly as we know. We can compile the Fortran program on one machine, pass the executable to the different machines,...

Problem using f2py

I have some routines written in fortran that I'd like to use in my python code. A quick websearch informed me about f2py, and I gave it a try. Using f2py -c numericalMethods.f -m numericalMethods it seems to work for a while until a lot of errors are spawn during the conversion. Any idea of why the following bit of code fails to work...

Stack output concept

Dear, I am new FORTRAN user. I want to write the output in stack way without deleting the previous one. Suppose we have three outputs A,B,C for one one one "ELECTRON1". When we run the code for another "ELECTRON2" then all previous outputs are over written. So I want to write in a stack way with one blank line. Please suggest me how I c...

MPI_RECV receives 0 value when a variable is used as the source, but recieves proper value when the source number is hard coded

I am trying to receive a variable from multiple processed as part of a DO loop. However, the value of the variable is 0 after the operation if I use a variable to represent the processor number. It works fine if I put the processor number in directly. Oddly enough, the exact same code works fine earlier in the program. Any thoughts o...

A profiler for Fortran on a mac?

I've got a scientific code running on my mac (I'm running snow leopard) , a code written in Fortran. I've been trying to get a profile of the run time of the code, but am having little success. It appears that gprof doesn't return any actual timings, just a count on how many times a subroutine was called. I looked around, this appears...

How can I ensure that my Fortran FORALL construct is being parallelized?

I've been given a 2D matrix representing temperature points on the surface of a metal plate. The edges of the matrix (plate) are held constant at 20 degrees C and there is a constant heat source of 100 degrees C at one pre-defined point. All other grid points are initially set to 50 degrees C. My goal is to take all interior grid points...

Executing fortran code doesn't work under geany in windows 7

I'm having trouble getting a simple piece of fortran90 code to work. Here is the code for helloworld.f90: PROGRAM hello IMPLICIT NONE PRINT *,"Hello world!" END PROGRAM hello When I compile and build, there are no errors. But as soon as I click on execute, this error appears in the command prompt: '"./helloworld"' is not recogniz...

Bash stderr and stdout redirection failing

I have a FORTRAN program output I want to redirect to file. I've done this before and use $myprog.out>>out.txt 2>&1 and for some reason this is not working. I test it with a another simple test program $myprog.test>>out.txt 2>&1 and it works I run myprog.out and the output goes to screen as usual but redirecting it seems to fail! ...

How to get a fortran90 code migrated to eclipse(photran) on windows?

I have been given a new project. I need to get a fortran code from a linux system working on windows. I'd like to be able to use Eclipse (photran) as my editor. What do I need to do to move things over? I've tried just dumping the source into a new eclipse project and it didn't work. Make had issues. What changes will I need to apply to ...

What flags do you set for your GFORTRAN debugger/compiler to catch faulty code ?

Hey you guys, i think i wont find that in any textbook, because answering this takes experience. i am currently in the stage of testing/validating my code / hunting bugs to get it into production state and any errors would lead to many people suffering e.g. the dark side. What kind of flags do you set when you compile your program fo...

Is it safe to pass "too many" arguments to a external function?

This situation can only occur without name mangling (I believe), so the below code is C. Say there is a function A defined in A.c as void A(int x, int y){ //Do stuff } Now there is also a separate file B.c: extern "C"{ void A(int x, int y, int z); } void B(){ A(1, 2, 3); } A is initially declared to have only 2 argumen...

Fortran 90: unclassifiable statement at (1)

I've been going through a textbook to learn fortran 90. At the moment I'm learning about dummy arguments and local variables in functions. One of the exercises is to write a program which asks the user for their first name and last name, then joins the names together and prints the full name. Here's the code: PROGRAM name_test IMPL...

Debugging DLL From Release EXE

Hello.I'm trying to debug a DLL called from a release executable, in Compaq Visual Fortran. I have created a Dynamic link library project and I have compiled the source files. When I run the mainly program (Build => Start Debug => Go) but the breakpoints are ignored in the dll, so the executab le doesn't stop and I don't get the value va...

Transpose in BLAS or do it myself first?

Hi there. I'm putting together some scientific code in Fortran 77, and I am having a debate on what would be faster. Basically, I have an MxN matrix, let's call it A. M is larger than N. Later on in the code, I need to multiply transpose(A) by a bunch of vectors. My question is, would it be faster to take A, transpose it on my o...

How to initialize two-dimensional arrays in Fortran

In C you can easily initialize an array using the curly braces syntax, if I remember correctly: int* a = new int[] { 1, 2, 3, 4 }; How can you do the same in Fortran for two-dimensional arrays when you wish to initialize a matrix with specific test values for mathematical purposes? (Without having to doubly index every element on sepa...

Suggestions for unit testing

Hello another question concerning debugging : Automatically generating test cases when i know the parameterset. And doing it all at once, instead during development (could kick myself) i have a set of parameters for my software that i wish to test. (~ 12 parameters only). However of course these parameters are often integers, so for eve...

Can this be optimized?

I have a program that is running slower than I'd like it to. I've done some profiling, and I've found the section that is taking up the vast majority of processing time DO K = 0, K_MAX WRITE(EIGENVALUES_IO, *) K * 0.001 * PI, (W_UP(J), J=1, ATOM_COUNT) DCMPLXW_UP(:) = DCMPLX(W_UP(:)) DO E = ...

Unit testing with datastructures

Hello everybody, i want to undertake some unit tests and a few functional tests on a working system. However i have a datastructure that mostly consists of a few arrays in an object (well its fortran, so not a real object, but you get the idea.) How would an example look like to unit test a datastructure? all examples i have seen so fa...