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

Difficulty Parallelizing with OpenMP #130

Closed
sudomakeinstall opened this issue Dec 1, 2017 · 3 comments
Closed

Difficulty Parallelizing with OpenMP #130

sudomakeinstall opened this issue Dec 1, 2017 · 3 comments

Comments

@sudomakeinstall
Copy link
Contributor

sudomakeinstall commented Dec 1, 2017

All--

Thanks so much to everyone who has worked on this library! I'm having some difficulty parallelizing the code, however, and was hoping someone might be able to point me in the right direction. Here's what I've done so far:

  1. I've compiled fgt with the following options:
BUILD_SHARED_LIBS: ON
CMAKE_CXX_FLAGS: -std=c++14 -fopenmp
WITH_OPENMP: ON
  1. I've compiled cpd with the following options:
BUILD_SHARED_LIBS: ON
CMAKE_CXX_FLAGS: -std=c++14 -fopenmp
WITH_FGT: ON
  1. I've compiled my own project with:
CMAKE_CXX_FLAGS: -std=c++14 -fopenmp
  1. I've set OMP_NUM_THREADS=$(nproc) in my ~/.bashrc.

  2. I've checked (at the top of my test program) that 8 threads are visible to OpenMP:

  #pragma omp parallel
  {
  std::cout << omp_get_num_threads() << std::endl; // prints 8, 8 times
  }

Despite these steps, the program still only appears to be using one core at a time when I run a test program:

cpu-use

Any ideas what I might be doing wrong?

Best, and thanks,

--Davis

P.S. I'm using g++ version 7.2.0 on Ubuntu 16.04.

@gadomski
Copy link
Owner

gadomski commented Jan 5, 2018

cpd doesn't have any OpenMP support itself, all OpenMP stuff is in fgt. Are you sure your test program is using GaussTransformFgt and not GaussTransform?

If you confirm that you are using GaussTransformFgt and are still seeing incorrect behavior, the problem is most likely in the fgt library and not cpd. Let me know what you find.

(and sorry about the delay, thanks for your patience!)

@sudomakeinstall
Copy link
Contributor Author

@gadomski Thanks very much for the response--it looks like I must have missed one of my own steps, because after I deleted, rebuilt, and reinstalled all the packages (FGT, CPD, and my own) it parallelizes as expected. Sorry for the trouble, and thanks again for your work putting this together!

@gadomski
Copy link
Owner

No worries, thank you!

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

No branches or pull requests

2 participants