igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Multi-threading and igraph


From: Gábor Csárdi
Subject: Re: [igraph] Multi-threading and igraph
Date: Sat, 30 Oct 2010 09:32:57 +0200

Thanks Tom, but I think you forgot the web page.

Actually, as a solution, I was thinking about assigning a context to
each thread, and this would store the thread-local data. Then at the
beginning of a thread you would need to call an extra function to
allocate this context, but maybe this is not a big deal.

Locking does not really work, at least it is not that simple, because
the threads really need different copies of the error objects, at
least if we don't want one thread failure break the whole program.

So either the context, or the thread-local variables that Tamas
mentioned, would work. I don't like the gcc-specific aspect of the
thread-local thing, but maybe there is a portable solution as well.

Best,
Gabor

On Sat, Oct 30, 2010 at 12:39 AM, Thomas Gorochowski
<address@hidden> wrote:
> Hi Gabor,
>
> The following webpage outlines the main points you would need to consider. 
> I'm not familiar with how errors are handled in igraph but one work around if 
> static variables crop up is to use locks to ensure that changes become atomic 
> and therefore safe.
>
> I'm not am expert, but will ask some of the developers in our group to see if 
> they have any other suggestions.
>
> All the best,
>
> Tom
>
> On 29 Oct 2010, at 22:03, Gábor Csárdi <address@hidden> wrote:
>
>> Hi Tom,
>>
>> indeed, the error handling is not thread-safe in igraph. I guess it
>> would not be too hard to make it thread-safe, but I am not an expert
>> on this. Could you recommend some good documentation on writing
>> thread-safe libraries?
>>
>> Thanks,
>> Gabor
>>
>> If On Fri, Oct 29, 2010 at 10:22 PM, Thomas Gorochowski
>> <address@hidden> wrote:
>>> Hi there,
>>>
>>> I am attempting to use OpenMP for some statistical sampling. When using 
>>> igraph functions within a parallel block I have noticed errors occur such 
>>> as the following:
>>>
>>> corrupt finally stack, popping 2 elements when only 1 left
>>> Assertion failed: (no>=0), function IGRAPH_FINALLY_REAL, file error.c, line 
>>> 126.
>>> Abort trap
>>>
>>> I'm assuming that igraph has not been written with multi-threading in mind, 
>>> however, was wondering if there are any plans to make the library 
>>> thread-safe in the near future? I'd ideally not like to fork processes as 
>>> some data is required to be shared and passing that via messages is never 
>>> much fun!
>>>
>>> Thank for a great library and keep up the good work.
>>>
>>> Tom.
>>>
>>> --
>>> T.E. Gorochowski
>>> University of Bristol, Centre for Complexity Sciences (BCCS)
>>> http://www.chofski.co.uk, address@hidden
>>>
>>> Try our dynamical network simulator at http://www.netevo.org
>>>
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>
>>
>>
>> --
>> Gabor Csardi <address@hidden>     UNIL DGM
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM



reply via email to

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