mikegrudic / pytreegrav

Fast N-body gravitational force and potential in Python
MIT License
63 stars 9 forks source link

Large Memory Use Resulting in Crash #2

Closed herkesg closed 5 years ago

herkesg commented 5 years ago

Hi,

I've been running into problems with large memory use. The code works well for a test case which I ran where 10 million particles within a unit cube and random masses were used:

image

Interestingly, the code crashes when I pass in particle positions and masses for approximately 8.6 million particles.

image

It produces the following error:

image

The server I am running on has approximately 129Gbs of ram. The thread memory use grows gradually until it has filled up the ram at which point it crashes. I am unsure why this is the case when the problem does not occur with the 10 million particle simulation. I initially thought the problem was to do with the particles not lying within a unit cube, and the particle masses not being between 0 and 1, but even after rescaling them so that this is the case, the error is still produced.

Any tips/suggestions would be greatly appreciated. If there is any important information I have missed don't hesitate to let me know!

Thanks in advance, Geoff

mikegrudic commented 5 years ago

Hi Geoff,

Thanks for reporting this. Are the particle positions in the failed test case unique? I have killed the code in the past with particle datasets that contain two at the same position, something I should eventually fix...

herkesg commented 5 years ago

Hi Mike,

That's an excellent point. I assumed that they were unique but upon checking found that there were actually quite a few (around 20,000) that were not, which took me quite by surprise! I imagine that is what is causing the problem. I shall try removing them and see if that fixes it. Thanks for the tip.

Geoff

herkesg commented 5 years ago

Hi Mike,

Just confirming that the cause of the problem was that there were multiple particles with the same position. Removing them fixed the problem. Thanks for your help :)

Geoff