![]() |
User Guide
|
Visitor to convert top level LOCAL variables to ASSIGNED variables. More...
Visitor to convert top level LOCAL variables to ASSIGNED variables.
Some of the existing mod file include declaration of LOCAL variables in the top level of the mod file. Those variables are normally written in the INITIAL block which is executed potentially by multiple threads. This results into race condition in case of CoreNEURON. To avoid this, such variables are converted to ASSIGNED variables which by default are handled as RANGE.
For example:
In the above example, qt
is used as temporary variable to pass value from INITIAL block to PROCEDURE. This works fine in case of serial execution but in parallel execution we end up in race condition. To avoid this, we convert qt to ASSIGNED variable.
Definition at line 65 of file local_to_assigned_visitor.hpp.
#include <local_to_assigned_visitor.hpp>
|
default |
Default constructor.
|
overridevirtual |
Visit ast::Program node to transform top level LOCAL variables to ASSIGNED if they are written in the mod file.
save pointer to assigned block to add new variables (only one block)
only process local_list statements otherwise continue
check if local variable is being updated in the mod file
remove local variables being converted to assigned
if all local variables are converted to assigned, keep track for removal
remove empty local statements if empty
if no assigned block found add one to the node otherwise emplace back new assigned variables
Implements nmodl::visitor::Visitor.
Definition at line 21 of file local_to_assigned_visitor.cpp.