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

Replace recursion by a stack and divide only the necessary dimensions #21

Merged
merged 30 commits into from Feb 28, 2015

Conversation

Projects
None yet
1 participant
@leouieda
Copy link
Owner

leouieda commented Aug 11, 2014

Check if the distance is greater than each dimension and divide only the ones that are too big.

TODO:

  • Update the results figure of simple_tess recipe. The model file was wrong.

Checklist:

  • Tests for new code
  • Benchmark
  • All tests pass
  • Changelog entry
  • Can be merged

leouieda added some commits Aug 8, 2014

Dividing only the necessary dimensions
Check if the distance is greater than each dimension and divide only the
ones that are too big. Seems to save a lot of time. Need a benchmark.
Merge branch 'master' into division
Conflicts:
	src/lib/grav_tess.c
Model in simple_tess was wrong
west and east were switched. This caused a weird bug that only happened
when I started calculating the size differently.
Calculate size of the tesseroid with a greatcircle
The method used before is Ok for the equator but for the poles it is
very wrong! I'm using the Vicenty formula from
http://en.wikipedia.org/wiki/Great-circle_distance
A queue implementation of adaptive discretization
Need more tests to verify results. Benchmarks show improved performance
when dividing a lot.
Compute size with simple cossine rule
Makes no difference and is a bit faster than the complicated Vincenty
formula.
Replace the name queue with the more accurate "stack".
Use distance from center, not top
Doesn't make much of a difference but gives slightly better results at
the pole. Probably more pronounced if calculating on the side of a
tesseroid.
Added known issue of computing ggt too close
The error increases quite fast for ggt components. So recommend not
calculating too close
Moved copyright message to separate func
This is called from the print_help functions of each command-line
program.
Updated the website links. They pointed to fatiando.org and Google code.

--version now prints only the version number. Can be used to embed the
version number.
Use version number in the bench result file
This will help identify the commit that generated those results
Merge branch 'master' into division
Conflicts:
	bench/Makefile
@leouieda

This comment has been minimized.

Copy link
Owner

leouieda commented Feb 28, 2015

Benchmark

Here is the result from the master branch:

Computer specs
model name : Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
MemTotal: 3950820 kB
Tesseroids version
tessgz (Tesseroids project) 1.1.1-52-gbc07a60
Model size: 1686 model.txt
Grid size: 2656 grid.txt
Time spent on potential:
1.41user 0.00system 0:01.42elapsed 99%CPU (0avgtext+0avgdata 996maxresident)k
0inputs+192outputs (0major+317minor)pagefaults 0swaps
Time spent on gz:
6.75user 0.00system 0:06.76elapsed 99%CPU (0avgtext+0avgdata 1068maxresident)k
0inputs+192outputs (0major+343minor)pagefaults 0swaps
Time spent on gzz:
49.22user 0.00system 0:49.27elapsed 99%CPU (0avgtext+0avgdata 1064maxresident)k
0inputs+192outputs (0major+341minor)pagefaults 0swaps

and here the current result from this branch:

Computer specs
model name : Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
MemTotal: 3950820 kB
Tesseroids version
1.1.1-81-g8a89aee
Model size: 1686 model.txt
Grid size: 2656 grid.txt
Time spent on potential:
2.43user 0.00system 0:02.44elapsed 99%CPU (0avgtext+0avgdata 996maxresident)k
0inputs+192outputs (0major+324minor)pagefaults 0swaps
Time spent on gz:
5.37user 0.00system 0:05.38elapsed 99%CPU (0avgtext+0avgdata 1088maxresident)k
0inputs+192outputs (0major+347minor)pagefaults 0swaps
Time spent on gzz:
37.90user 0.00system 0:37.94elapsed 99%CPU (0avgtext+0avgdata 1088maxresident)k
0inputs+192outputs (0major+347minor)pagefaults 0swaps

  • potential is slower, which might be attributed to the increase of the distance-size ratio from 0.5 to 1. This might out weight the benefit of using a stack vs recursion.
  • gz and gzz are faster even though the distance-size ration increased (1 to 1.5 for gz, 2.5 to 8 for gzz).

Seems that when there are a lot of divisions happening, the advantage of a stack becomes more pronounced.

@leouieda leouieda changed the title Divide only the necessary dimensions Replace recursion by a stack and divide only the necessary dimensions Feb 28, 2015

leouieda added a commit that referenced this pull request Feb 28, 2015

Merge pull request #21 from leouieda/division
Replace recursion by a stack and divide only the necessary dimensions

@leouieda leouieda merged commit 6d254e1 into master Feb 28, 2015

2 checks passed

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

@leouieda leouieda deleted the division branch Feb 28, 2015

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