On 26.08.2015 23:26, ostrokach wrote:
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.
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 -- Tiago de Paula Peixoto <tiago@skewed.de>