[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mkoctfile and Fortran

From: Thomas D. Dean
Subject: Re: Mkoctfile and Fortran
Date: Tue, 21 Feb 2012 13:06:28 -0800
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120126 Thunderbird/9.0

On 02/21/12 12:32, Przemek Klosowski wrote:
On 02/19/2012 05:25 PM, Thomas D. Dean wrote:
I have a very large fortran applicaton, 17,688 lines, I frequently use
with octave 3.4.3.

I do

fortran-application < infile > tmpfile | perl-script > outfile

I am confused about your intent for redirection of stdout to tempfile:
fort-app > tmpfile will not produce anything on stdout so the
perl-script doesn't get any input data.

This is pseudo code to explain the process. The fortran application prompts the user for the infile name and the outfile name. Then, the fortran application reads infile and creates tmpfile. Then,
cat tmpfile | perl-script > outfile

I was thinking of making the fortran application a subroutine and return the data directly to octave, eliminating the disk i/o, the perl script and the octave load command.

Are your intermediate files large enough so that writing them to disk
and reading back is an issue? If you just want to streamline the process
so that you don't have to go to shell and back to octave and back to
shell again, you can call your programs from octave using the system()
function. You can even capture the stdout of the program :

I am currently controlling this from octave.
  [FID,MSG] = fopen('','w');
  fprintf(FID,"%s\n",fn);  ## input file name
  fprintf(FID,"XX.DAT\n"); ## output file name
  dummy=system("fortran-app < > /dev/null");
  dummy=system("cat XX.DAT | ./ > xx.dat");
  load xx.dat;

I want to do this in a loop, i=1:1000. The file XX.DAT is 10MB Therefore, the desire to eliminate disk i/o.

I can create a memory disk.  Maybe this will speed things up enough.

Tom Dean

reply via email to

[Prev in Thread] Current Thread [Next in Thread]