Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace the
while-loop
in theVPManager::get_end_rank_per_thread
withstd::max
Here, first we check if the
rank_end
is greater than the number of MPI processes (MPI
). If it is the case, we keep decreasingrank_end
by one until either reaching theMPI
orrank_start
, else we do nothing, and we use the initial value of therank_end
.If
rank_start
is greater than theMPI
, thenrank_end
will be also greater thanMPI
. Therefore, by decreasingrank_end
by one, we will first reach the valuerank_start
. Otherwise, whenrank_start
is less thanMPI
, but the value ofrank_end
is greater thanMPI
, then we will first reach the value ofMPI
.Therefore, as long as
rank_end
is greater than theMPI
, the new value ofrank_end
will be the maximum betweenrank_start
andMPI
, and nowhile-loop
will be needed.Replace the
if-else
in theSimulationManager::run
withstd::min
Here, if
end_sim
is larger than the min-delay, thento_step
is set to min-delay, otherwiseto_step
is set toend_sim
. In short,to_step
is set to the minimum betweenend_sim
and the min-delay.