Skip to content

Commit

Permalink
llvm, Composition: Don't execute Python output_CIM in _LLVMPerNode mode
Browse files Browse the repository at this point in the history
Move compiled execution of output_CIM to the same place as Python
execution.
Do not report end of trial twice in _LLVMPerNode execution mode.

Signed-off-by: Jan Vesely <[email protected]>
  • Loading branch information
jvesely committed Jan 31, 2025
1 parent dbfa7b3 commit f1f8d46
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions psyneulink/core/compositions/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -12527,8 +12527,7 @@ def execute(
else:
nested_execution_mode = execution_mode

ret = node.execute(context=context,
execution_mode=nested_execution_mode)
ret = node.execute(context=context, execution_mode=nested_execution_mode)

# Get output info from nested execution
if execution_mode.is_compiled():
Expand Down Expand Up @@ -12632,7 +12631,17 @@ def execute(

# Reset context flags
context.execution_phase = ContextFlags.PROCESSING
self.output_CIM.execute(context=context)

if execution_mode.is_compiled():
assert execution_mode & pnlvm.ExecutionMode._PerNode
assert execution_mode.is_cpu_compiled()

_comp_ex.freeze_values()
_comp_ex.execute_node(self.output_CIM)

else:
self.output_CIM.execute(context=context)

context.execution_phase = ContextFlags.IDLE

# Animate output_CIM
Expand Down Expand Up @@ -12676,25 +12685,19 @@ def execute(
content='execute_end',
context=context)

# UPDATE TIME and RETURN ***********************************************************************************

execution_scheduler.get_clock(context)._increment_time(TimeScale.TRIAL)

# Extract result here
if execution_mode.is_compiled():
assert execution_mode & pnlvm.ExecutionMode._PerNode
assert execution_mode.is_cpu_compiled()

_comp_ex.freeze_values()
_comp_ex.execute_node(self.output_CIM)
report(self,
PROGRESS_REPORT,
report_num=report_num,
content='trial_end',
context=context)
return _comp_ex.extract_node_output(self.output_CIM)

# UPDATE TIME and RETURN ***********************************************************************************

execution_scheduler.get_clock(context)._increment_time(TimeScale.TRIAL)

return self.get_output_values(context)
else:
return self.get_output_values(context)

def __call__(self, *args, **kwargs):
"""Execute Composition if any args are provided; else simply return results of last execution.
Expand Down

0 comments on commit f1f8d46

Please sign in to comment.