Leaner code & active max h collection
A series of updates:
- Free foreign particles and the mesh before i/o operations.
- Free foreign particles before exchanging the proxy cells.
- Hide the unnecessary fields into anonymous unions inside the cell sub-structures to save memory.
- Collect the max active h of each cell.
The first three updates are currently in use in the Sibelius-dark run. The last change is not used yet for performance improvement but will be used in a future push that focuses solely on using the quantity to speed-up loops. At the risk of confusing things, I added it here already as I was making substantial changes to the cell structure organisation.
Merge request reports
Activity
added cleanup code health enhancement memory usage labels
378 378 e->force_checks_snapshot_flag = 1; 379 379 #endif 380 380 381 /* Free the mesh memory to get some breathing space */ 382 if ((e->policy & engine_policy_self_gravity) && e->s->periodic) 383 pm_mesh_free(e->mesh); 384 I was pondering this as well. FOF does only allocate a small amount of extra memory. The main problem really is the following snapshot writing call. If we are not writing all the particles (e.g. we have DM and background DM types or we have just 1 inhibited particle) then we duplicate the particles to write. That can be a huge jump in memory.
In the longer run, we (I) should really rewrite the i/o code to fish out the particles to write without duplication.
So the handling of stars has changed. when I configure with-hydro=none and run:
../../swift --self-gravity --stars --threads=4 -n 16 -y 1 eagle_6.yml
it crashes:
ASAN:DEADLYSIGNAL ================================================================= ==24255==ERROR: AddressSanitizer: SEGV on unknown address 0x154100000011 (pc 0x55fe61281585 bp 0x7ffc5a03c580 sp 0x7ffc5a03bc80 T0) ==24255==The signal is caused by a READ memory access. ASAN:DEADLYSIGNAL ==24255==AddressSanitizer: while reporting a bug found another one. Ignoring. ASAN:DEADLYSIGNAL ==24255==AddressSanitizer: while reporting a bug found another one. Ignoring. ASAN:DEADLYSIGNAL ==24255==AddressSanitizer: while reporting a bug found another one. Ignoring. #0 0x55fe61281584 in space_split_recursive /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/space_split.c:142 #1 0x55fe61288cdb in space_split_mapper /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/space_split.c:715 #2 0x55fe6123a08a in threadpool_chomp /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/threadpool.c:164 #3 0x55fe6123a986 in threadpool_map /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/threadpool.c:339 #4 0x55fe61288de7 in space_split /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/space_split.c:741 #5 0x55fe6126ccd5 in space_rebuild /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/space_rebuild.c:975 #6 0x55fe6116fd48 in engine_rebuild /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/engine.c:1174 #7 0x55fe61173944 in engine_init_particles /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/engine.c:1722 #8 0x55fe611350c6 in main /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/examples/main.c:1418 #9 0x154174bd9bf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6) #10 0x55fe61127b19 in _start (/loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/examples/swift+0x4db19) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /loc/pwda/pdraper/scratch/swift-tests/swiftsim-spare2/src/space_split.c:142 in space_split_recursive
Guessing this is because I don't have a stars model set, but we have stars loaded anyway. Need to stop allowing these to be loaded without a model, or go back to the old behaviour.
mentioned in commit a6e51aa9