From 005577ed59e74777bc65dc475a65b085009808d6 Mon Sep 17 00:00:00 2001 From: Fernando Pereira Date: Tue, 29 Oct 2024 13:06:10 +0100 Subject: [PATCH 1/2] Intoduce a sentinel value to allow loading rebalanced files --- src/coreneuron/io/nrn_setup.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreneuron/io/nrn_setup.cpp b/src/coreneuron/io/nrn_setup.cpp index 285c19034a..f198662615 100644 --- a/src/coreneuron/io/nrn_setup.cpp +++ b/src/coreneuron/io/nrn_setup.cpp @@ -216,6 +216,10 @@ void nrn_read_filesdat(int& ngrp, int*& grp, const char* filesdat) { nrn_assert(fscanf(fp, "%d\n", &iFile) == 1); if ((iNum % nrnmpi_numprocs) == nrnmpi_myid) { + if (iFile == -1) { + // Sentinel value, we are done for this rank + break; + } grp[ngrp] = iFile; ngrp++; } From 5a9d014a27f6a47167084710167d98edbfc7d88b Mon Sep 17 00:00:00 2001 From: Fernando Pereira Date: Tue, 19 Nov 2024 15:33:37 +0100 Subject: [PATCH 2/2] Improved message --- src/coreneuron/io/nrn_setup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreneuron/io/nrn_setup.cpp b/src/coreneuron/io/nrn_setup.cpp index f198662615..1f6a955b6c 100644 --- a/src/coreneuron/io/nrn_setup.cpp +++ b/src/coreneuron/io/nrn_setup.cpp @@ -216,8 +216,10 @@ void nrn_read_filesdat(int& ngrp, int*& grp, const char* filesdat) { nrn_assert(fscanf(fp, "%d\n", &iFile) == 1); if ((iNum % nrnmpi_numprocs) == nrnmpi_myid) { + // A "-1" entry means that this rank should not be assigned further gid groups. + // It is a way to create files.dat files which deterministically assign gid groups to + // ranks, particularly useful for very large simulations which required load balancing. if (iFile == -1) { - // Sentinel value, we are done for this rank break; } grp[ngrp] = iFile;