help-octave
[Top][All Lists]
Advanced

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

Re: Passing variables between octave processes on the same machine


From: Olaf Till
Subject: Re: Passing variables between octave processes on the same machine
Date: Sun, 20 Jan 2019 19:30:45 +0100
User-agent: NeoMutt/20170113 (1.7.2)

On Sun, Jan 20, 2019 at 05:42:40PM +0000, Sergei Steshenko wrote:
>  
> 
>     On Sunday, January 20, 2019, 7:36:25 PM GMT+2, Pavel Hofman 
> <address@hidden> wrote:  
>  
>  Hi,
> 
> Please does anyone have any experience with passing complete variables 
> between two independent octave processes (not parent/child via popen)?
> 
> The transport channel is easy - sockets, zeromq etc. I assume for 
> serialization I could use the 'save' function:
> 
> bitstream = save('-', 'variable')
> 
> 
> But I was not able to find a simple way to deserialize contents of the 
> 'bitstream' variable back to 'variable'. The 'load' function does not 
> accept input from a variable (as far as I understand the documentation), 
> only from a real file.
> 
> Actually, I would love to use a sequence of plain files but several 
> messages must be sent every second and SSD drives do not like this 
> constant create/delete file load. Creating a RAM drive would work but I 
> need a multiplatform solution (linux, windows) and creating the 
> platform-specific RAM drive would overcomplicate the project deployment.
> 
> Thank you in advance for any suggestions, experience, etc.
> 
> Best regards,
> 
> Pavel.
> 
> ================================================
> Start from named pipes "Introduction to Named Pipes" - Introduction to Named 
> Pipes | Linux Journal 
> 
> 
> | 
> | 
> | 
> |  |  |
> 
>  |
> 
>  |
> | 
> |  | 
> Introduction to Named Pipes | Linux Journal
> 
> 
>  |
> 
>  |
> 
>  |
> 
> 
> .
> Using named pipes you can save Octave variables using 'save' in one process 
> and load Octave variables in another process using 'load'. And/or maybe 
> 'fwrite' and 'fread' preceded by 'fopen'.
> Named pipes also exist in Windows.
> --Sergei.

For processes within the same non-windows-machine, once you have a
channel with an Octave file number, an efficient way is with 'fsave'
and 'fload' from the 'parallel' package.

For data exchange between different machines, you could look at
'var2bytea' and 'bytea2var' from the 'database' package. 'var2bytea'
returns a binary string for each input variable, similarly to save
('-', ...). This string has to be sent over and given as input to
'bytea2var' at the other side.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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