Skip to content

Commit 0fa8fc6

Browse files
author
abacus_fixer
committed
fix(parallel): compile create_partition and divide_mpi_groups in non-MPI builds
create_partition and divide_mpi_groups were swallowed by an outer #ifdef __MPI block, so the serial fallback branch never compiled and non-MPI linking failed with undefined reference to create_partition. Close the guard after divide_pools and keep both functions outside; divide_mpi_groups is pure arithmetic and is called unconditionally by Parallel_K2D. Also refresh the stale availability note in the header.
1 parent ef5e970 commit 0fa8fc6

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

source/source_base/parallel_global.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ void Parallel_Global::divide_pools(const int& NPROC,
282282
}
283283
return;
284284
}
285+
#endif
285286

286287
ParallelPartition Parallel_Global::create_partition(int world_nproc,
287288
int my_rank,
@@ -427,5 +428,3 @@ void Parallel_Global::divide_mpi_groups(const int& procs,
427428
rank_in_group = (rank - extra_procs) % procs_in_group;
428429
}
429430
}
430-
431-
#endif

source/source_base/parallel_global.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ void read_pal_param(int argc, char** argv, int& NPROC, int& NTHREAD_PER_PROC, in
3838
* expected to fill them in from the appropriate view before passing the
3939
* partition down.
4040
*
41-
* Note: The factory is only available under __MPI. The non-MPI build path
42-
* uses the default ParallelPartition constructor which already produces the
43-
* single-process trivial partition.
41+
* Note: Under __MPI the factory splits the real communicators as described
42+
* below. The non-MPI build path returns the default ParallelPartition
43+
* object, which already represents the single-process trivial partition.
4444
*
4545
* @param[in] world_nproc Size of MPI_COMM_WORLD
4646
* @param[in] my_rank Rank in MPI_COMM_WORLD

0 commit comments

Comments
 (0)