help-octave
[Top][All Lists]
Advanced

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

Re: OpenMP, OMP_NUM_THREADS and putenv - not working as expected.


From: Rayson Ho
Subject: Re: OpenMP, OMP_NUM_THREADS and putenv - not working as expected.
Date: Tue, 20 Apr 2010 11:38:59 -0500

On Tue, Apr 20, 2010 at 6:02 AM, Guido Walter Pettinari
<address@hidden> wrote:
> I am using gcc-4.2.1 (the one shipped with Mac
> Os X 10.6) and Octave 3.2.3. My oct-files are 32-bit.

Note that most OpenMP implementations cache the threads after creation
(as thread creation is expensive in terms of overhead). Thus you won't
be able to control the number of running threads by using the
$OMP_NUM_THREADS environment variable.

I think you will get the same behavior if you write a small C program
that sets OMP_NUM_THREADS after the OpenMP threads are created.

Rayson



>
> Cheers,
>
> Guido
>
> On Apr 20, 2010, at 1:59 , John W. Eaton wrote:
>
>> On 19-Apr-2010, S ren Hauberg wrote:
>>
>> | man, 19 04 2010 kl. 01:19 -0800, skrev coccoinomane:
>> | > Hi Soren!
>> | >
>> | > Thank you for your answer.
>> | >
>> | > > I hope you realise that Octave itself is not thread-safe.
>> | >
>> | > Does it mean that, in all cases, it is dangerous to run an oct-file with
>> | > OpenMP parallelization?
>> |
>> | No, but it means that we don't even attempt to give you any garanties.
>> | Many operations are probably already thread-safe, but if you want to be
>> | sure, you really need to look at the actual implementation.
>>
>> If your function does some multi-threaded thing that is compltely
>> independent of Octave's internals, I would guess you are OK (assuming
>> the multi-threaded code you call is actually thread safe).  But if you
>> make calls back to the Octave internals, there are no guarantees as
>> the code in the Octave libraries is not thread safe.
>>
>> jwe
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>



reply via email to

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