[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optionally make use of 'parallel' in a package
From: |
Olaf Till |
Subject: |
Re: Optionally make use of 'parallel' in a package |
Date: |
Thu, 12 Mar 2015 21:07:54 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Mar 12, 2015 at 01:08:01PM +0100, Daniel Kraft wrote:
> Hi!
>
> In a package (level-set, to be precise) I want to make use of
> 'pararrayfun' of the parallel package to utilise parallel computation.
> However, I do not want to make level-set strongly dependent on parallel.
> Instead, I would like to simply fall back to single threading when the
> parallel package is not installed.
>
> For this, I see two "problems" that I need to solve:
>
> 1) Decide whether or not a particular package (in this case, 'parallel')
> is installed. I think this is possible with both the 'pkg' and 'ver'
> functions. Is there some recommended way to do it?
Package 'optim' currently does it with:
[desc, state] = pkg ("describe", "parallel");
if (! strcmpi (state{1}, "loaded"))
...
But I'd also be interested to see what others have to say to it.
Olaf
> 2) If present, make sure that 'parallel' is loaded when I need it. I
> could use 'pkg load' / 'pkg unload' calls in PKG_ADD / PKG_DEL or the
> called function itself. However, this would mess with the user's
> environment, right? Is there a way to ensure that the package is loaded
> only temporarily during my function without modifying the global
> environment?
>
> Thank you a lot! Yours,
> Daniel
>
> --
> http://www.domob.eu/
> OpenPGP: 1142 850E 6DFF 65BA 63D6 88A8 B249 2AC4 A733 0737
> Namecoin: id/domob -> https://nameid.org/?name=domob
> --
> Done: Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
> To go: Mon-Pri
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature