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

Add OpenMP support to forward modeling modules in gravmag. #106

Merged
merged 9 commits into from Jul 3, 2014

Conversation

Projects
None yet
3 participants
@leouieda
Member

leouieda commented Jun 6, 2014

Giving decent speedups in my linux laptop and has no problem with multiprocessing.

Seems there might be some issues building the extension modules on Windows. Anaconda doesn't include OpenMP in its MinGW. See this discussion and the instructions here for a possible solution.

This is an addon for PR #105

  • Docstrings
  • Make tests for new code
  • All tests pass
  • Can be merged
  • Changelog entry
  • Benchmark
    • prism
    • polyprism
    • sphere
  • Include new dependencies in Windows install docs

leouieda added some commits Jun 6, 2014

Multithreaded gravmag.sphere with OpenMP
Using Cython prange function in gravmag.sphere yields a 2x speedup in my
i5 processor with 4 threads on a (200x200) grid. On smaller grids
(20x20) it is at worse the same speed.

Had to separate the kernel Cython functions because I couldn't do
"elif field ==" without the GIL.

Putting the gz kernel on a cdef inline function actually made it much
faster.
@coveralls

This comment has been minimized.

coveralls commented Jun 6, 2014

Coverage Status

Coverage remained the same when pulling 9287564 on kernel-openmp into 3c6a98b on kernel-functions.

OpenMP support for gravmag.prism
Had to change the coordinate system shift (x[0] = x2 - xp[l]) to use
dx = x[i] - xp[l] inside the integration loops because I can't alter the
x array in parallel.

Benchmarks show 2x speedup in an i5 processor with 4 threads.
harvester doesn't seem to be much faster though.
@coveralls

This comment has been minimized.

coveralls commented Jun 6, 2014

Coverage Status

Coverage remained the same when pulling 3c5300e on kernel-openmp into 3c6a98b on kernel-functions.

@leouieda

This comment has been minimized.

Member

leouieda commented Jun 10, 2014

Installing on Windows gets a bit trickier because the MinGW that comes with Anaconda doesn't include OpenMP support. As discussed in the Anaconda mailing list, a workaround in to install TDM-GCC. I tried this on a Windows box and it works perfectly. Don't forget to select the openmp option in the installer.

@birocoles

This comment has been minimized.

Member

birocoles commented Jun 10, 2014

@leouieda, after cloning your repo, I compiled the Fatiando with python setup.py build_ext --inplace. Is it enough or should I run python setup.py build_ext --inplace --cython too?

@leouieda

This comment has been minimized.

Member

leouieda commented Jun 10, 2014

No, just the normal build.

On Tue, Jun 10, 2014 at 5:42 PM, Vanderlei C Oliveira Jr <
notifications@github.com> wrote:

@leouieda https://github.com/leouieda, after cloning your repo, I
compiled the Fatiando with python setup.py build_ext --inplace. Is it
enough or should I run python setup.py build_ext --inplace --cython too?


Reply to this email directly or view it on GitHub
#106 (comment).

Merge branch 'kernel-functions' into kernel-openmp
Conflicts:
	setup.py

Changed the setup for building extension modules. Getting a list of
module names plus extra compile args.
@coveralls

This comment has been minimized.

coveralls commented Jul 3, 2014

Coverage Status

Coverage remained the same when pulling 69e87e3 on kernel-openmp into 1f94881 on kernel-functions.

@leouieda leouieda added this to the 0.3 milestone Jul 3, 2014

leouieda added some commits Jul 3, 2014

OpenMP for gravmag.polyprism
Benchmarks are very good! Sometimes more than 2x speedup over numpy
version.
Moved the vertices loop out of kernels to avoid segfaults.
Had to change the way PolygonalPrism makes .x and .y attributes so that
they are C contiguous arrays.
@coveralls

This comment has been minimized.

coveralls commented Jul 3, 2014

Coverage Status

Coverage decreased (-0.01%) when pulling 5db1796 on kernel-openmp into 9a736fd on kernel-functions.

@coveralls

This comment has been minimized.

coveralls commented Jul 3, 2014

Coverage Status

Coverage decreased (-0.01%) when pulling 2e3791a on kernel-openmp into 9a736fd on kernel-functions.

leouieda added a commit that referenced this pull request Jul 3, 2014

Merge pull request #106 from leouieda/kernel-openmp
Add OpenMP support to forward modeling modules in gravmag.

@leouieda leouieda merged commit 1cab148 into kernel-functions Jul 3, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@leouieda leouieda deleted the kernel-openmp branch Jul 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment