Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

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

Merged
leouieda merged 9 commits intokernel-functionsfrom
kernel-openmp
Jul 3, 2014
Merged

Add OpenMP support to forward modeling modules in gravmag.#106
leouieda merged 9 commits intokernel-functionsfrom
kernel-openmp

Conversation

@leouieda
Copy link
Copy Markdown
Member

@leouieda 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 2 commits June 6, 2014 16:08
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
Copy link
Copy Markdown

Coverage Status

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

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
Copy link
Copy Markdown

Coverage Status

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

@leouieda
Copy link
Copy Markdown
Member Author

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
Copy link
Copy Markdown
Member

@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
Copy link
Copy Markdown
Member Author

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
https://github.com/leouieda/fatiando/pull/106#issuecomment-45668764.

Conflicts:
	setup.py

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

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 3 commits July 3, 2014 10:56
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
Copy link
Copy Markdown

Coverage Status

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

@coveralls
Copy link
Copy Markdown

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
Add OpenMP support to forward modeling modules in gravmag.
@leouieda leouieda merged commit 1cab148 into kernel-functions Jul 3, 2014
@leouieda leouieda deleted the kernel-openmp branch July 4, 2014 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants