Skip to content

Commit

Permalink
spinnaker updates
Browse files Browse the repository at this point in the history
  • Loading branch information
clinssen committed Aug 10, 2023
1 parent cd25853 commit 78b6b5d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 38 deletions.
41 changes: 16 additions & 25 deletions pynestml/codegeneration/spinnaker_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,16 @@ def build(self) -> None:
shell=shell,
cwd=str(os.path.join(target_path)))
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')

pass

for fn in generated_file_names_neuron_h:
try:
subprocess.check_call(["cp", fn, os.path.join(install_path, "c_models", "src", "my_models", "implementations")],
stderr=subprocess.STDOUT,
shell=shell,
cwd=str(os.path.join(target_path)))
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# copy python files from target to install directory

Expand All @@ -146,15 +144,16 @@ def build(self) -> None:
except (FileExistsError, FileNotFoundError):
pass

target_path = os.path.join(install_path, "python_models8", "neuron", "builds")
for fn in generated_file_names_neuron_py:
try:
subprocess.check_call(["cp", fn, os.path.join(install_path, "python_models8", "neuron", "builds")],
print("Copying \"" + fn + "\" to " + target_path)
subprocess.check_call(["cp", fn, target_path],
stderr=subprocess.STDOUT,
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# Copy the pyNN implementation file
try:
Expand All @@ -169,9 +168,8 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')

pass # no problem if file is already there and gets overwritten

# Copy the example files
try:
os.mkdir(os.path.join(install_path, "examples"))
Expand All @@ -185,8 +183,7 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass # no problem if file is already there and gets overwritten

# copy makefiles
try:
Expand All @@ -206,17 +203,15 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

try:
subprocess.check_call(["cp", "Makefile_models", os.path.join(install_path, "c_models", "makefiles", "Makefile")],
stderr=subprocess.STDOUT,
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# Copy the extra.mk file
try:
Expand All @@ -225,8 +220,7 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# Copy the extra_neuron.mk file
try:
Expand All @@ -235,8 +229,7 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# Copy the model Makefile
for fn in generated_file_names_makefiles:
Expand All @@ -258,8 +251,7 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# Copy the .h files of the neuron model
try:
Expand All @@ -274,8 +266,7 @@ def build(self) -> None:
shell=shell,
cwd=target_path)
except subprocess.CalledProcessError:
raise GeneratedCodeBuildException(
'Error occurred during install! More detailed error messages can be found in stdout.')
pass

# call make clean
try:
Expand Down
26 changes: 13 additions & 13 deletions pynestml/codegeneration/spinnaker_code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,20 @@ def __init__(self, options: Optional[Mapping[str, Any]] = None):
self.codegen_py._target = "SpiNNaker"

def generate_code(self, models: Sequence[Union[ASTNeuron, ASTSynapse]]) -> None:
self.codegen_cpp.generate_code(models)
# self.codegen_cpp.generate_code(models)

# cloned_models = []
# for model in models:
# cloned_model = model.clone()
# cloned_model.accept(ASTSymbolTableVisitor())
# cloned_models.append(cloned_model)
cloned_models = []
for model in models:
cloned_model = model.clone()
cloned_model.accept(ASTSymbolTableVisitor())
cloned_models.append(cloned_model)

# self.codegen_cpp.generate_code(cloned_models)
self.codegen_cpp.generate_code(cloned_models)

# cloned_models = []
# for model in models:
# cloned_model = model.clone()
# cloned_model.accept(ASTSymbolTableVisitor())
# cloned_models.append(cloned_model)
cloned_models = []
for model in models:
cloned_model = model.clone()
cloned_model.accept(ASTSymbolTableVisitor())
cloned_models.append(cloned_model)

# self.codegen_py.generate_code(cloned_models)
self.codegen_py.generate_code(cloned_models)

0 comments on commit 78b6b5d

Please sign in to comment.