User Guide
|
Visitor to convert GLOBAL variables to RANGE variables. More...
Visitor to convert GLOBAL variables to RANGE variables.
Some of the existing mod files have GLOBAL variables that are updated in BREAKPOINT or DERIVATIVE blocks. These variables have a single copy and works well when they are read only. If such variables are written as well, they result into race condition. For example,
In above example, x will be simultaneously updated in case of vectorization. In NEURON, such race condition is avoided by promoting these variables to thread variable (i.e. separate copy per thread). In case of CoreNEURON, this is not sufficient because of vectorisation or GPU execution. To address this issue, this visitor converts GLOBAL variables to RANGE variables when they are assigned / updated in compute functions.
Definition at line 61 of file global_var_visitor.hpp.
#include <global_var_visitor.hpp>
Private Attributes | |
const ast::Program & | ast |
ast::Ast* node More... | |
|
delete |
Default constructor.
|
inlineexplicit |
Constructor that takes as parameter the AST.
Definition at line 74 of file global_var_visitor.hpp.
|
overridevirtual |
Visit ast::NeuronBlock nodes to check if there is any GLOBAL variables defined in them that are written in any part of the code.
This is checked by reading the write_count member of the variable in the symtab::SymbolTable. If it's written it removes the variable from the ast::Global node and adds it to the ast::Range node of the ast::NeuronBlock
only process global statements
check if global variable is being updated in the mod file
remove offending global variables
add empty global statements to global_statements_to_remove
remove offending global statements if empty
insert new range variables replacing global ones
Implements nmodl::visitor::Visitor.
Definition at line 23 of file global_var_visitor.cpp.
|
private |
ast::Ast* node
Definition at line 64 of file global_var_visitor.hpp.