Skip to content

Threaded timers break GetConnections() #3468

Closed
@heplesser

Description

@heplesser

A NEST built with -Dwith-detailed-timers=ON -Dwith-threaded-timers=ON will trigger a failing assertion upon the following:

python -c "import nest ; nest.local_num_threads = 2 ; nest.GetConnections()"   

The assertion is triggered by the call to is_source_table_cleared() here:

if ( is_source_table_cleared() )
, which is called in a serial context. With a few intermediate steps, this calls PerThreadBoolIndicator::all_true() here:
PerThreadBoolIndicator::all_true() const
, which in turn starts a stopwatch.

This all happens in a serial context. But threaded timers require that they be started and stopped in a thread-parallel context, see

kernel().vp_manager.assert_thread_parallel();
.

The idea behind the assertion was that threaded timers would only be started/stopped from parallel contexts. But the all/any_true/false() methods may be called from serial and parallel contexts, and then the timers in them need to support this.

So I think we should remove the assertions from the start() and stop() methods, as well as from is_running() and elapsed(). If called from a serial context, the time would be for thread 0.

For print() I am uncertain what would be the best choice and implementation, but thread-parallel writing to an ostream does not seem optimal.

Metadata

Metadata

Assignees

Labels

I: Behavior changesIntroduces changes that produce different results for some usersS: HighShould be handled nextT: BugWrong statements in the code or documentation

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions