specifying the number of cores

Hi,
I was wondering if there is a way to specify the number of cores that
graph-tool uses for OpenMP algorithms? I couldn't find it looking through
documentation and the mailing list.
It would be nice if you could set n_cores=1 when running graph-tool on a
cluster, for example, and set n_cores=4 when running on a local machine.
Thanks, and sorry if this has been asked before,
Alexey

attachment.html (883 Bytes)

There are a couple of different ways to do this.

For any OpenMP program (not only graph-tool), you can specify the
following environment variable

    OMP_NUM_THREADS=n

before the program is run.

If you want to modify the number of threads during the program, you can
use the the function graph_tool.openmp_set_num_threads().

Best,
Tiago

Great, thanks a lot!