help-octave
[Top][All Lists]
Advanced

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

Re: Mkoctfile and Fortran


From: Przemek Klosowski
Subject: Re: Mkoctfile and Fortran
Date: Wed, 22 Feb 2012 11:45:19 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120131 Thunderbird/10.0

On 02/21/2012 04:06 PM, Thomas D. Dean wrote:

    dummy=system("fortran-app<  xx.in>  /dev/null");
    dummy=system("cat XX.DAT | ./output.pl>  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.

Wrapping the fortran app so that it would return the results directly into Octave variables is of course the fastest way, but I would first recommend a simpler mod: change the fortran app to write the data to stdout and the comments (which you currently redirect to /dev/null, so maybe you don't need that at all) to stderr (*), and then run it as:

[status,output]=system("fortran-app < xx.in | ./output.pl");

See, no files (although still slower than full wrapping of course)


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

That probably won't help you much. On Linux the buffering of filesystems is typically pretty good so reasonably-sized files end up in disk buffers anyway and there's not much advantage to ramdisks.

p



(*) writing to stderr is not standard in Fortran AFAIK; depending on which compiler you use, something like this might work:

Open (Unit=3, File="/dev/stderr") ! Open Standard Error on Unit 3


reply via email to

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