galsci / pysm

PySM 3: Sky emission simulations for Cosmic Microwave Background experiments
https://pysm3.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
36 stars 23 forks source link

Encountering segmentation fault while running PySM #161

Closed erussier closed 1 year ago

erussier commented 1 year ago

I am having issues generating dust models (d10 and d12) with the PySM. In the following code “dust_bandpass.ipynb” which I run on NERSC Perlmutter through Jupyter, when I run the ### d9 cell it works fine. However, when I run the ###d10 cell or ###d12 cell, I get a segmentation fault.

This same code works for d10 and d12 when used by @1cosmologist, with the same version of the “pysm3” module so I don’t think the problem comes directly from the pysm.

I know that it appears when I execute this line: dustmap_10 = dust_10.get_emission(nus_in_GHz * u.GHz, transmission). But I cannot see what directly causes this segmentation fault, even with logging. When I don’t do the band integration (by removing “transmission” in the previous line), I still get the same segmentation fault.

I have tried to uninstall my conda environment and anaconda several times but I am still getting this segmentation fault.

These are the different ways I have been trying to install pysm on NERSC:

1) Installing the pysm and my conda environment as said here and then doing a pip install to get the 3.4.0b8 version.

2) Installing my conda environment and then installing pysm3 directly through pip

I am using python 3.9.16, numba 0.56.4, pip 23.0.1.

Do you have an idea of what could be generating this segmentation error?

1cosmologist commented 1 year ago

I can confirm that I too encounter a segmentation fault while running pysm3 get_emission for dust model d12 on NERSC Perlmutter, for the same code that runs on my Macbook. The versions installed on Perlmutter: numba = 0.56.4 and pysm = 3.4.0b8.

zonca commented 1 year ago

It is probably an issue with numba. Try to disable threading with numba. That is a environmental variable to set. You can find it in the documentation of numba or maybe pysm itself.

zonca commented 1 year ago

Also try to install numba with conda instead of pip

Here is how I setup my own conda environments:

https://www.zonca.dev/posts/2022-11-08-python-nersc-conda

On Wed, May 24, 2023, 13:51 Shamik Ghosh @.***> wrote:

I can confirm that I too encounter a segmentation fault while running pysm3 get_emission for dust model d12 on NERSC Perlmutter, for the same code that runs on my Macbook. The versions installed on Perlmutter: numba = 0.56.4 and pysm = 3.4.0b8.

— Reply to this email directly, view it on GitHub https://github.com/galsci/pysm/issues/161#issuecomment-1561909646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC5Q4QKXJI6RKZEI5WQERTXHZYGFANCNFSM6AAAAAAYMRQMYU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

erussier commented 1 year ago

Thank you very much, I disabled threading with numba and it worked. Then, I created a new conda environment as shown in your post and I don't get a segmentation fault anymore. I'll close this issue.