1

I am using python graph-tool for this algorithm in order to find min-cut in a large graph. My algorithm needs several calls to this function, and it seems to be the bottleneck. So I want to ensure if it is being run as efficiently as it could be i.e. using OpenMP.

However, on changing number of threads using openmp_set_num_threads(n), I get the same time for different number of threads viz. 2, 24 and 128.

Is there a way to check if OpenMP is being used by the graph-tool? I have checked the number of threads using openmp_get_num_threads and it is correct. Also how to enable OpenMP in case it is not being used by the graph-tool?

Alternatively, is there a way to check if some particular function of graph-tool, boykov_kolmogorov_max_flow in our case, uses OpenMP?

7
  • How do you use openMP with Python? There is no direct support, see here Commented Jul 29, 2018 at 10:34
  • @Imontigny I am using the python library graph-tool which is implemented in C++, and thus can use OpenMP. At least this is what they claim they do. Commented Jul 29, 2018 at 14:08
  • Ok, can you print the output of graph_tool.openmp_enabled() and graph_tool.openmp_get_num_threads()? Commented Jul 29, 2018 at 17:18
  • True and correct number of threads respectively. The problem is that the function call to boykov_kolmogorov_max_flow takes the same time for different num_threads. Commented Jul 29, 2018 at 17:44
  • 1
    Ok, in the graph-tool source code they include <boost/graph/boykov_kolmogorov_max_flow.hpp> and I don't see any openMP pragma in the corresponding file here. It seems that this algorithm is not implemented in parallel. Only a part of graph-tool is parallelized using openMP, I found some omp pragma for pagerank for example. (You can do "grep -wr omp *" in the source folder of graph-tool) Commented Jul 29, 2018 at 20:45

1 Answer 1

0

Meanwhile there is a function for that:

> import graph_tool as gt
> gt.openmp_enabled()
True

Return True if OpenMP was enabled during compilation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.