File: threading.xxml

package info (click to toggle)
igraph 0.10.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 16,176 kB
  • sloc: ansic: 121,500; cpp: 21,699; xml: 2,734; python: 411; makefile: 147; javascript: 20; sh: 9
file content (45 lines) | stat: -rw-r--r-- 1,942 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?xml version="1.0"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY igraph "igraph">
]>

<section id="using-igraph-in-multi-threaded-programs"><title>Using igraph in multi-threaded programs</title>
<para>
  The igraph library is considered thread-safe if it has been compiled
  with thread-local storage enabled, i.e. the <literal>IGRAPH_ENABLE_TLS</literal>
  setting was toggled to <literal>ON</literal> and the current platform
  supports this feature. To check whether an igraph build is thread-safe, use the
  <link linkend="IGRAPH_THREAD_SAFE">
    <function>IGRAPH_THREAD_SAFE</function>
  </link>
  macro. When linking to external versions of igraph's dependencies, it is
  the responsibility of the user to check that these dependencies were also
  compiled to be thread-safe.
</para>

<!-- doxrox-include IGRAPH_THREAD_SAFE -->

<section id="thread-safe-arpack-library"><title>Thread-safe ARPACK library</title>
<para>
Note that igraph is only thread-safe if it was built with the internal
ARPACK library, i.e. the one that comes with igraph. The standard
ARPACK library is not thread-safe.
</para>
</section>

<section id="thread-safe-rng"><title>Thread-safety of random number generators</title>
<para>
The default random number generator that igraph uses is <emphasis>not</emphasis>
guaranteed to be thread-safe. You need to set a different random number generator
instance for every thread that you want to use igraph from. This is especially
important if you set the seed of the random number generator to ensure
reproducibility; sharing a random number generator between threads would break
reproducibility as the order in which the various threads are scheduled is
random, and therefore they would still receive random numbers in an unpredictable
order from the shared random number generator.
</para>
</section>


</section>