help-octave
[Top][All Lists]
Advanced

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

OpenMP, OMP_NUM_THREADS and putenv - not working as expected.


From: coccoinomane
Subject: OpenMP, OMP_NUM_THREADS and putenv - not working as expected.
Date: Wed, 14 Apr 2010 05:38:09 -0800 (PST)

Hello world!

I do not know if this is a bug or if I am missing something obvious.

I am successfully using Octave to run a parallel C++ code trough the
oct-file interface. I implemented the parallellism at the C++ level with
OpenMP and its #pragma directives.

I control the number of threads used by my program through the environment
variable OMP_NUM_THREADS. When I launch Octave from a shell where
OMP_NUM_THREADS is correctly exported, my program correctly uses the
specified number of threads.

However, when I try to change the environment variable from within Octave
with putenv - for example putenv ("OMP_NUM_THREADS", "1") - and then re-run
the oct-file function, the latter keeps using the initial number of threads
(i.e. the one specified prior to launching Octave at the shell level). It is
like my  "putenv" command was ignored. However, "getenv ("OMP_NUM_THREADS")"
correctly returns the modified value, i.e. "1".

Right now, as a workaround, every time I want to change the number of
threads I close and relaunch Octave. This is not very practical. I would be
grateful if somebody could give me a hint.

Thank you!

Cheers,

Guido




-- 
View this message in context: 
http://n4.nabble.com/OpenMP-OMP-NUM-THREADS-and-putenv-not-working-as-expected-tp1839801p1839801.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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