[Top][All Lists]

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

Re: .oct function vs external program and text file exchange

From: Przemek Klosowski
Subject: Re: .oct function vs external program and text file exchange
Date: Fri, 14 Jan 2011 11:22:12 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.7

On 01/14/2011 07:38 AM, Daniel Arteaga wrote:
Hi all,

I have an octave program which needs the results of external C++
program, in Linux. For the moment the program is called from inside
Octave with the 'system' function, and the communication is done via the
exchange of text files. Everything works well.

I'd like to be able to estimate the overhead of the external program
call (and writing text files), vs the possible reconversion of the
external program to an oct function.

Before starting with the hassle of converting the program to an oct
function (my C++ skills are very limited), I'd like to know whether I
will get a significant gain.

Your workflow goes through five phases:

- writing of parameters in Octave,
- system() overhead of starting your executable,
- reading of data in your C++ code,
- calculation,
- output in C++ and input in Octave.

The actual amount of time spent in each one depends on your particular case, e.g. how much data is involved. Doing it in an .oct function would essentially reduce it to the calculation, and you can find out exactly how much time it takes by modifying your C++ to calculate and print the time from after reading the data to just before writing it out. Then, wrap your Octave code to write the params, call system() and read the results in the tic/toc pair, and subtract the C++ time from the
toc() value---it'll be your overhead.

reply via email to

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