octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #64813] pararrayfun of the parallel package do


From: Umberto
Subject: [Octave-bug-tracker] [bug #64813] pararrayfun of the parallel package does not work when using the official example
Date: Wed, 25 Oct 2023 09:11:45 -0400 (EDT)

Follow-up Comment #1, bug #64813 (project octave):

I figured out what was the problem but I don't know how to close this issue.

Thanks to
[https://octave.discourse.group/t/can-someone-help-with-implementing-pararrayfun-in-my-program/2031/4?u=umbe1987
this post] in the GNU Octave discourse group, I understood that:

> The way the “parallel” package works in Octave is that it spawns various
“independent” instances of Octave and runs the given code in all of those.
For this to work correctly, all necessary functions must be accessible in all
of those instances. If I understand your code correctly, you define myFun
inline. That way it will only be defined in the “main” instance. Move that
function to a dedicated file and store it in a place that is in the load path
of all instances. (Maybe use .octaverc to add it to your default load path.)

So basically I had to move my function definition in a separate file "myfun.m"
(as also suggested by user Cris Luengo in the comments to my question), and
move this file in a folder which is in Octave load path.

To do this, I have create a new dedicated folder ("~/octave/custom_funcs"),
and added this to the load path with addpath("~/octave/custom_funcs").

Hope this will be helpful for anybody.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64813>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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