stammler / dustpy

Python Package for Modelling Dust Evolution in Protoplanetary Disks.
GNU General Public License v3.0
20 stars 11 forks source link

[BUG] segmentation fault with sim.initialize() #10

Closed agdturner closed 3 weeks ago

agdturner commented 3 weeks ago

Describe the bug segmentation fault when running: sim.initialize()

To Reproduce Create a new conda environment with python 3.13 and install dependencies: conda create -n "myenv" python=3.13 conda activate myenv pip install simframe pip install DustPy

Run python: $ python Python 3.13.0 | packaged by Anaconda, Inc. | (main, Oct 7 2024, 21:29:38) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

from dustpy import Simulation sim = Simulation() sim DustPy

dust : Group (Dust quantities) gas : Group (Gas quantities) grid : Group (Grid quantities) star : Group (Stellar quantities)

t : NoneType

Integrator : not specified Writer : not specified

sim.gas Group (Gas quantities)

boundary : Group (Boundary conditions) S : Group (Source terms) v : Group (Velocities)

alpha : NoneType cs : NoneType eta : NoneType Fi : NoneType gamma : NoneType Hp : NoneType mfp : NoneType mu : NoneType n : NoneType nu : NoneType P : NoneType rho : NoneType Sigma : NoneType SigmaFloor : NoneType T : NoneType

sim.initialize() Segmentation fault

Expected behavior I am not expecting a Segmentation fault at this step.

Software versions Package Version


certifi 2024.8.30 charset-normalizer 3.3.2 contourpy 1.3.0 cycler 0.12.1 dill 0.3.9 dustpy 1.0.6 fonttools 4.54.1 h5py 3.12.1 idna 3.10 kiwisolver 1.4.7 matplotlib 3.9.2 numpy 2.1.2 packaging 24.1 pillow 10.4.0 pip 24.2 pyparsing 3.1.4 python-dateutil 2.9.0.post0 requests 2.32.3 scipy 1.14.1 simframe 1.0.5 six 1.16.0 urllib3 2.2.3

Additional context This is being run on an old HPC platform running RHEL 7.

birnstiel commented 3 weeks ago

How big is your setup (grid.Nr, grid.Nm)? Usually this only happens if you run out of stack or memory. Perhaps increase the stack size before the run?

agdturner commented 3 weeks ago

How big is your setup (grid.Nr, grid.Nm)? Usually this only happens if you run out of stack or memory. Perhaps increase the stack size before the run?

The issue surfaces in the initialisation step of a default set up. I will look for information about default memory requirements and how to increase the stack size. I am a software engineer helping a researcher and am new to DustPy.

agdturner commented 3 weeks ago

To test, I am running commands on a login node rather than submit jobs via the HPC scheduler to standard compute nodes.

The login node memory bandwidth per core is 800MHz. It has 40 cores and 192GB of available memory, but only a fraction of this should be used in testing... The standard compute nodes are the same, but all the memory can be used on them for any tests...

agdturner commented 3 weeks ago

I tried:

from dustpy import Simulation import sys sys.setrecursionlimit(100_000) sim = Simulation() sim DustPy

dust : Group (Dust quantities) gas : Group (Gas quantities) grid : Group (Grid quantities) star : Group (Stellar quantities)

t : NoneType

Integrator : not specified Writer : not specified

sim.gas Group (Gas quantities)

boundary : Group (Boundary conditions) S : Group (Source terms) v : Group (Velocities)

alpha : NoneType cs : NoneType eta : NoneType Fi : NoneType gamma : NoneType Hp : NoneType mfp : NoneType mu : NoneType n : NoneType nu : NoneType P : NoneType rho : NoneType Sigma : NoneType SigmaFloor : NoneType T : NoneType

sim.initialize() Segmentation fault

stammler commented 3 weeks ago

Is Python 3.13 necessary or would 3.12 work as well for you? I have not tested it on 3.13 yet. It may be that there are some new unknown compatibility issues with 3.13.

DustPy needs a Fortran compiler. So far, we tested it extensively with gfortran. There may be unknown issues with other compilers.

birnstiel commented 3 weeks ago
agdturner commented 3 weeks ago

Is Python 3.13 necessary or would 3.12 work as well for you? I have not tested it on 3.13 yet. It may be that there are some new unknown compatibility issues with 3.13.

DustPy needs a Fortran compiler. So far, we tested it extensively with gfortran. There may be unknown issues with other compilers.

I created a new environment with python 3.12 and switched the system default Intel compiler for GNU Fortran (GCC) 12.3.0.

I'm not sure which of these things fixed the issue, but sim.initialize() now works:

sim.initialize() sim.gas Group (Gas quantities)

boundary : Group (Boundary conditions) S : Group (Source terms) v : Group (Velocities)

alpha : Field (Turbulent alpha parameter) cs : Field (Sound speed [cm/s]) eta : Field (Pressure gradient parameter) Fi : Field (Gas flux interfaces [g/cm/s]) gamma : Field (Adiabatic index) Hp : Field (Pressure scale height [cm]) mfp : Field (Midplane mean free path [cm]) mu : Field (Mean molecular weight [g]) n : Field (Miplane number density [1/cm³]) nu : Field (Kinematic viscosity [cm²/s]) P : Field (Midplane pressure [g/cm/s²]) rho : Field (Miplane mass density [g/cm³]) Sigma : Field (Surface density [g/cm²]) SigmaFloor : Field (Floor value of surface density [g/cm²]) T : Field (Temperature [K])

Thanks very much for your help.

stammler commented 3 weeks ago

Thanks for reporting!

I checked it with 3.12 and Intel compilers which seemed to work. So as of now I assume there may be some compatibility issue with respect to Python 3.13, but I cannot reproduce it right now. I'll keep an eye on this.