NVIDIA / modulus-sym

Framework providing pythonic APIs, algorithms and utilities to be used with Modulus core to physics inform model training as well as higher level abstraction for domain experts
https://developer.nvidia.com/modulus
Apache License 2.0
138 stars 56 forks source link

🐛[BUG]: Function `sample_boundary` produces segmentation fault in version `1.3.0` / Container version 23.11 #91

Closed vigneshmanick closed 4 months ago

vigneshmanick commented 7 months ago

Version

1.3.0

On which installation method(s) does this occur?

Docker

Describe the issue

the function sample_boundary fails with the following error when using STL files. This is not the case when using version 1.0.0 (version modulus:2305 container)

The test was done via podman rootless containers. The version modulus:23.11 produces the segmentation fault. The same code works without issue in modulus:23.05 container. (The pyvista part doesn't since it's not available in the 23.05 container, but the reading and sample_boundary does work)

Any suggestions on how to resolve this?

Thanks in advance!

Minimum reproducible example

import pyvista
from modulus.sym.geometry.primitives_3d import Sphere
from modulus.sym.geometry.tessellation import Tessellation

nr_pts = 1000

sphere_pyvista = pyvista.Sphere(1.0)
sphere_pyvista.save('pyvista_sphere.stl')

geo = Sphere(radius=1.0, center=(0, 0, 0))
geo.sample_boundary(nr_pts)

geo_stl = Tessellation.from_stl('pyvista_sphere.stl')
geo_stl.sample_boundary(nr_pts)

Relevant log output

python modulus_error.py 
/usr/local/lib/python3.10/dist-packages/modulus/sym/geometry/tessellation.py:104: RuntimeWarning: divide by zero encountered in divide
  np.full(x.shape, triangle_areas[index] / x.shape[0])
Using BVH_GEQUEL
NUM Triangles: [0f88988517fa:28601:0:28601] Caught signal 11 (Segmentation fault: address not mapped to object at address (nil))
==== backtrace (tid:  28601) ====
 0 0x0000000000042520 __sigaction()  ???:0
=================================
Segmentation fault (core dumped)

Environment details

Podman Rootless version 4.6.2

Pull was done with the following command `podman pull nvcr.io/nvidia/modulus/modulus:23.11` and 

run command is 

`podman run --rm --device nvidia.com/gpu=all --security-opt=label=disable -it nvidia/modulus/modulus:23.11 bash`

Other/Misc.

No response

ktangsali commented 5 months ago

@vigneshmanick, I tested your minimal example using docker run and it ran fine on my end. To help debug better, can you provide additional details on the system you are running this on? It might be also worthwhile to test the run command with the following flags added --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864.