OpenMP and more C++

The leap-frog integrator has been implemented and it yields exactly the same behavior as discussed in the GADGET-2 paper; It’s more reliable than second order Runge-Kutta even though they are both second order methods.  I’ve modified the code so that it initializes particles according to a simple distribution function. The images below are IFrIT plots of  3, 10, and 100 randomly oriented orbits in a simple \Phi \propto r^{-1} potential, as well as a plot of 25,000 initial positions.

3-orbits10-orbits100-orbits25000-points

The main focus of the last few days has been C++ programming and building the individual pieces that will be needed for the N-body code later this month.  I’ve been able to use OpenMP to parallelize the main for-loop.  It’s surprisingly easy.  There is  noticeable speed increase on my dual processor system ( Note: I have not yet benchmarked the program to measure the actual speed-up factor).  The CPU utilization now reaches 100% rather than the previous 50%.  I’m currently working out the bugs with the shared memory system.  Writing a code for parallel execution requires me to modify my way of thinking a bit.  I am also trying to figure out how to handle large amounts of memory in C++.  Once these issues are resolved, I will try to implement a data visualization library so the program can plot output automatically.  This will be important for the next project because I want to be able to make animations of the N-body simulations.

In terms of reading, I just started reading Bruno’s  paper dealing with continuous stellar mass-loss in N-body models.

One Response to “OpenMP and more C++”

  1. Across the Universe » Blog Archive » Research day Says:

    [...] I spent most of today doing research.  I leaned a good bit and got some things accomplished toward my summer research goals. The details of what I did today, including pictures, are here: http://www.idius.net/openmp-and-more-c/ [...]

Leave a Reply