Skip to content

Commit

Permalink
Initial code generation for NEURON (#1078)
Browse files Browse the repository at this point in the history
* Renamed CodegenCppVisitor to CodegenCoreneuronCppVisitor

* Added NEURON code generator (CodegenNeuronCppVisitor) with comments and scaffold of the needed functions

* Created abstract class CodegenCppVisitor for common functionality between CodegenNeuronCppVisitor and CodegenCoreneuronCppVisitor

* Rearrange functions in CodegenCoreneuronCppVisitor to match CodegenNeuronCppVisitor and CodegenCppVisitor

* Added unit test for the code generated for NEURON at the moment

* Introduce CLI options for NEURON code generation and removed the references to C
  • Loading branch information
iomaganaris authored Nov 29, 2023
1 parent 11ec824 commit 2c4c8e2
Show file tree
Hide file tree
Showing 16 changed files with 7,733 additions and 5,381 deletions.
2 changes: 2 additions & 0 deletions src/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ add_library(
codegen STATIC
codegen_acc_visitor.cpp
codegen_transform_visitor.cpp
codegen_coreneuron_cpp_visitor.cpp
codegen_neuron_cpp_visitor.cpp
codegen_cpp_visitor.cpp
codegen_compatibility_visitor.cpp
codegen_helper_visitor.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/codegen_acc_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ std::string CodegenAccVisitor::backend_name() const {
void CodegenAccVisitor::print_memory_allocation_routine() const {
// memory for artificial cells should be allocated on CPU
if (info.artificial_cell) {
CodegenCppVisitor::print_memory_allocation_routine();
CodegenCoreneuronCppVisitor::print_memory_allocation_routine();
return;
}
printer->add_newline(2);
Expand Down
8 changes: 4 additions & 4 deletions src/codegen/codegen_acc_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* \brief \copybrief nmodl::codegen::CodegenAccVisitor
*/

#include "codegen/codegen_cpp_visitor.hpp"
#include "codegen/codegen_coreneuron_cpp_visitor.hpp"


namespace nmodl {
Expand All @@ -27,7 +27,7 @@ namespace codegen {
* \class CodegenAccVisitor
* \brief %Visitor for printing C++ code with OpenACC backend
*/
class CodegenAccVisitor: public CodegenCppVisitor {
class CodegenAccVisitor: public CodegenCoreneuronCppVisitor {
protected:
/// name of the code generation backend
std::string backend_name() const override;
Expand Down Expand Up @@ -140,13 +140,13 @@ class CodegenAccVisitor: public CodegenCppVisitor {
const std::string& output_dir,
const std::string& float_type,
bool optimize_ionvar_copies)
: CodegenCppVisitor(mod_file, output_dir, float_type, optimize_ionvar_copies) {}
: CodegenCoreneuronCppVisitor(mod_file, output_dir, float_type, optimize_ionvar_copies) {}

CodegenAccVisitor(const std::string& mod_file,
std::ostream& stream,
const std::string& float_type,
bool optimize_ionvar_copies)
: CodegenCppVisitor(mod_file, stream, float_type, optimize_ionvar_copies) {}
: CodegenCoreneuronCppVisitor(mod_file, stream, float_type, optimize_ionvar_copies) {}
};

/** \} */ // end of codegen_backends
Expand Down
Loading

0 comments on commit 2c4c8e2

Please sign in to comment.