SmileiPIC / Smilei

Particle-in-cell code for plasma simulation
https://smileipic.github.io/Smilei
335 stars 119 forks source link

Segmentation fault #705

Closed soxzofia closed 6 months ago

soxzofia commented 6 months ago

Hi,

Recently I installed Smilei(v5.0) on our group server, after installation, I ran my old 3D-simulation but segmentation fault occurred after few seconds of runtime. Simulation can successfully run only after I set "export OMP_THREADS=1". And I have tried my old 2D-simulation, no fault occurred. Is this because I didn't set the dependencies of Smilei properly?

Segmentation fault:' Stack trace (most recent call last) in thread 343401:

8 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in

7 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7ff1b1126bbb, in

6 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7ff1b10a645b, in

5 Object "/lib/x86_64-linux-gnu/libgomp.so.1", at 0x7ff1b1eedbdd, in

4 Object "smilei", at 0x55ca40510feb, in

3 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7ff1b18c71de, in PyImport_AddModule

2 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7ff1b1839a9c, in

1 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7ff1b1817994, in PyUnicode_New

0 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7ff1b17df860, in

Segmentation fault (Address not mapped to object [0x10]) Segmentation fault '

mccoys commented 6 months ago

This is probably not a bug, but a wrong installation. Please provide more info on your setup

soxzofia commented 6 months ago

Sorry, I really don‘t know how to present more info ,all I can do is using code 'make env'. Here is the result: ’make env VERSION : ??-?? SMILEICXX : mpicxx OPENMP_FLAG : -fopenmp -D_OMP HDF5_ROOT_DIR : /usr/local/hdf5 FFTW3_LIB_DIR : SITEDIR : /home/wangsy/.local/lib/python3.12/site-packages PYTHONEXE : python3 PY_CXXFLAGS : -I/usr/include/python3.12 -I/usr/include/python3.12 -I/opt/python_venv/lib/python3.12/site-packages/numpy/core/include -DSMILEI_USE_NUMPY -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION PY_LDFLAGS : -L/usr/lib/x86_64-linux-gnu -lpython3.12 -ldl -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions CXXFLAGS : -Wno-reorder -D__VERSION=\"??-??\" -DOMPI_SKIP_MPICXX -std=c++11 -Wall -Wextra -I/usr/local/hdf5/include -Isrc -Isrc/ElectroMagn -Isrc/Merging -Isrc/MovWindow -Isrc/Collisions -Isrc/Checkpoint -Isrc/MultiphotonBreitWheeler -Isrc/Patch -Isrc/Ionization -Isrc/ParticleBC -Isrc/SmileiMPI -Isrc/ElectroMagnSolver -Isrc/Species -Isrc/PartCompTime -Isrc/Profiles -Isrc/Field -Isrc/Projector -Isrc/ElectroMagnBC -Isrc/Diagnostic -Isrc/ParticleInjector -Isrc/Pusher -Isrc/Python -Isrc/Interpolator -Isrc/Particles -Isrc/DomainDecomposition -Isrc/Radiation -Isrc/picsar_interface -Isrc/Tools -Isrc/Params -Ibuild/src/Python -I/usr/include/python3.12 -I/usr/include/python3.12 -I/opt/python_venv/lib/python3.12/site-packages/numpy/core/include -DSMILEI_USE_NUMPY -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -O3 -g -fopenmp -D_OMP LDFLAGS : -L/usr/local/hdf5/lib -lhdf5 -L/usr/lib/x86_64-linux-gnu -lpython3.12 -ldl -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lm -fopenmp -D_OMP COMPILER_INFO : g++ ‘

mccoys commented 6 months ago

Can you try to run some benchmarks to see if it's the installation or the input file?

soxzofia commented 6 months ago

No fault occurred when running tst1d and tst2d, but same segmentation fault occurred when running tst3d.

mccoys commented 6 months ago

Can you provide exactly how it was run? Threads, mpis, which benchmarks, stdout. Thanks

soxzofia commented 6 months ago

Treads =2 , mpi =1 ,benchmarks:"tst1d_00_em_propagation.py, tst2d_00_em_propagation.py, tst3d_01_thermal_plasma.py" smilei qs1

When running "tst3d_01_thermal_plasma.py" fault: Stack trace (most recent call last) in thread 444282:

8 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in

7 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6132326bbb, in

6 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f61322a645b, in

5 Object "/lib/x86_64-linux-gnu/libgomp.so.1", at 0x7f61327ccbdd, in

4 Object "smilei", at 0x56044010cfeb, in

3 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7f6132ac71de, in PyImport_AddModule

2 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7f6132a39a9c, in

1 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7f6132a17994, in PyUnicode_New

0 Object "/lib/x86_64-linux-gnu/libpython3.12.so.1.0", at 0x7f61329df860, in

Segmentation fault (Address not mapped to object [0x10]) Segmentation fault

mccoys commented 6 months ago

I can see that a bunch of Unicode functions have been removed in python 3.12. I only tested 3.11 for now so there might be a new incompatibility that would need fixing. I have to run some tests

soxzofia commented 6 months ago

thank you!

soxzofia commented 6 months ago

I‘ve changed my python3.12 to python3.11, same fault occurred when I running 3d-simulation.

mccoys commented 6 months ago

I just reproduced the bug with 3.12.0, not with 3.11.6

mccoys commented 6 months ago

Ok I believe it is an error introduced by Python3.12. I have asked the python guys to find out. In the meantime, I think I have found a workaround, but maybe you can try to use 3.11 as well. Remember to make clean and recompile.

mccoys commented 6 months ago

So it turns out it is not a bug in python, but something not very well made in Smilei that was kind of permitted in python 3.11, but more strict in 3.12. I will try to fix this soon

soxzofia commented 6 months ago

OK, I will run with 3.11

soxzofia commented 6 months ago

Bravo! It seems no more segmentation fault occurred when running simulation with python3.11, thank you very much!

mccoys commented 6 months ago

Should be fixed here: c1d7a32

soxzofia commented 6 months ago

thank you very much!