Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMP multithreading #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dukecyto
Copy link

Using OpenMP, I multithreaded functions that were major bottlenecks in the optical flow computation.

Good news: Computation time may be reduced by up to 50%.
Bad news: The performance scales poorly with the number of cores. This seems to be because these functions intensively write out to memory, causing false sharing.

In my Linux environment with 32 cores, the best performance was achieved by limiting OpenMP to use just two threads (by setting the environment variable OMP_NUM_THREADS) and then make use of other cores by multiprocessing over frames.

@pathak22 pathak22 mentioned this pull request Feb 22, 2018
@weitian-ding
Copy link

@dukecyto I use pyflow as one map step in tensorflow dataset api. I set the number of parallelism to 10 in tensorflow. However, when computing optic flow, my CPU utilisation is only 100%, (I have 10 cores, so maximum can be 1000%). The CPU utilisation in other steps in my pipeline reaches close to 1000%.
Do you have an explanations for this? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants