New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up logging upon calls to Simulate #269
Conversation
Setting nodes_vec_network_size_ to 0 forces the nodes_vec to be resized to the current number of threads. If this is omitted, calibration reaches behind the nodes_vec and causes a segfault.
* Removed unuseful messages * Added number of threads and number of processes to output * Reformatted logging message into a table
@apeyser, @heplesser, would you please review? Thanks! |
nest::SimulationManager::prepare_simulation_() | ||
{ | ||
if ( to_do_ == 0 ) | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could never be reached, as the calling function already has a check for t != 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it should have an assert and a comment on the invariant
@@ -298,7 +298,7 @@ nest::SimulationManager::simulate( Time const& t ) | |||
to_do_ += t.get_steps(); | |||
to_do_total_ = to_do_; | |||
|
|||
prepare_simulation_(); | |||
size_t num_active_nodes = prepare_simulation_(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a const, correct?
I've added an assert and constness as suggested by @apeyser and disabled clang-format for some lines as suggested by @tammoippen. Many thanks for the thorough review. |
Time t = Time::ms( time ); | ||
|
||
kernel().simulation_manager.simulate( t ); | ||
kernel().simulation_manager.simulate( Time::ms( time ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging may lead to a conflict with #265, but that should be easy to handle.
@heplesser: I've merged in your changes and removed the const-ness for |
#endif | ||
#else // clang-format off | ||
for ( index t = 0; t < kernel().vp_manager.get_num_threads(); ++t ) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This for
-loop start should be indented one more level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it shouldn't. Depending on the definition of _OPENMP
, the compiler either sees
#pragma omp parallel
{
or
for (...)
{
The for
statement in line in (new) line 727 is not inside the #pragma omp parallel
block, but replaces it conditionally. So the indentation level of the opening curly brace in line 724 and (new) line 728 have to match.
As clang-format
does apparently not take conditional compilation into account, I had to disable it to get the correct indentation.
Maybe we should also include the MPI rank in the status message or limit the status message to rank 0? |
Only printing on rank 0 seems strange to me, as the number of local nodes might differ and this message might be very useful for debugging. But I agree that rank information would be useful. However, I think it would be better if that was added globally to the |
Missed the indentation. 👍 for this PR. (merging) I think, both rank and thread would be useful information for |
The output upon calls to
Simulate
has previously been spread out over multiple messages and cluttered by useless messages. This was hard to read by humans and hard to parse by machines. This PR cleans and compacts logging messages and adds the number of threads and processes to the output in order to prevent problems like seen in #238.The old output looked like this:
The new output for the same script looks like this:
If NEST was compiled without support for OpenMP, the third line of the table will read
If NEST was compiled without support for MPI, the fourth line of the table will read
While testing with 0 nodes, I found a segfault, which I then also fixed in this PR for convenience reasons.