pelahi / VELOCIraptor-STF

Galaxy/(sub)Halo finder for N-body simulations
MIT License
19 stars 26 forks source link

OpenMP crash in non-MPI code (as SWIFT library) #57

Closed MatthieuSchaller closed 4 years ago

MatthieuSchaller commented 4 years ago

When compiling the latest master with

cmake . -DVR_USE_SWIFT_INTERFACE=ON -DVR_ZOOM_SIM=ON -DCMAKE_CXX_FLAGS="-fPIC" -DVR_MPI=OFF

and then linking the library into SWIFT's latest master via

./configure --with-tbbmalloc --enable-ipo --with-velociraptor=/wherever/VR/is/src/

we crash on the first VR call that contains any FOF halo with the message

VELOCIraptor/STF running with MPI. Number of mpi threads: 1
VELOCIraptor/STF running with OpenMP. Number of openmp threads: 28
Copying particle data...
Finished copying particle data.
TIME::0 took 0.065655 to copy 1912889 particles from SWIFT to a local format. Out of 1912889
0 There are 1912889 particles and have allocated enough memory for 2104177 requiring 0.297869GB of memory 
0 will also require additional memory for FOF algorithms and substructure search. Largest mem needed for preliminary FOF search. Rough estimate is 0.0570085GB of memory
Begin FOF search  of entire particle data set ... 
First build tree ... 
Done
0 Search particles using 3DFOF in physical space
0 Parameters used are : ellphys=0.0266742 Lunits (ell^2=0.000711515 and likely 0.2 in interparticle spacing
Total number of groups found is 798
0: finished FOF search in total time of 2.43161
0 Going to build tree 
0: Get local velocity density
0: finished calculation in 0.049736
TIME::0 took 4.50188 to search 1912889 with 28
Searching subset
0 Beginning substructure search 
OMP: Error #34: System unable to allocate necessary resources for OMP thread:
OMP: System error #11: Resource temporarily unavailable
OMP: Hint: Try decreasing the value of OMP_NUM_THREADS.

The code is running with 28 threads that are passed from SWIFT.

I have had not time to debug this besides noting that this all works with version ce010b644345f52da025063b084a4969b524c8e2 of the code.

pelahi commented 4 years ago

This nested parallelism openmp bug should be fixed. I am testing the development branch which has the fix.

MatthieuSchaller commented 4 years ago

Yes, all works. Thanks!