Skip to content

Segmentation fault in find_clumps during contour linking (Parthenon AMR dataset) #5457

Description

@OtelloPoletti

Hi, I am encountering a reproducible segmentation fault when running find_clumps on a Parthenon AMR dataset. The crash happens specifically during the contour linking phase. The exact same analysis works perfectly after regridding the data to a uniform grid (ds.arbitrary_grid)

import yt
from yt.data_objects.level_sets.api import Clump, find_clumps
import numpy as np
import faulthandler
faulthandler.enable()

ds = yt.load("parthenon.restart.00180.rhdf")
rho_field = ("gas", "density")
center = ds.domain_center
half_width = ds.quan(0.1, "kpc")
ad = ds.box(center - ds.arr([half_width]*3), center + ds.arr([half_width]*3))
rho = ad[rho_field].d
rho = rho[np.isfinite(rho) & (rho > 0)]
c_min = np.percentile(rho, 95.0)
c_max = np.percentile(rho, 99.9)
master = Clump(ad, rho_field)
master.add_validator("min_cells", 20)
# The segfault happens here
find_clumps(master, c_min, c_max, 5.0)

Output:

Finding clumps: min: 6.060523e-23, max: 1.309785e-19, step: 5.000000
Linking node (893) contours.
Fatal Python error: Segmentation fault
Current thread ...
File ".../yt/data_objects/level_sets/contour_finder.py", line 48, in identify_contours
File ".../yt/data_objects/level_sets/clump_handling.py", line 152, in find_children
File ".../yt/data_objects/level_sets/clump_handling.py", line 416, in find_clumps

The dataset used to reproduce this parthenon.restart.00180.rhdf is approximately 0.9 GB. I can share it if needed.
Environment details: python 3.12.3; yt version 4.4.1; OS Ubuntu 24.04.4 LTS; NumPy version 2.3.3

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions