From caa4802c12873b0ecf777829e230bc9dbcee921e Mon Sep 17 00:00:00 2001 From: Jan Vesely Date: Tue, 11 Jul 2023 00:55:15 -0400 Subject: [PATCH 1/3] llvm/execution: Use "state" instead of context/CTX in debug print The term "context" was replaced by "state" long time ago. Signed-off-by: Jan Vesely --- psyneulink/core/llvm/execution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psyneulink/core/llvm/execution.py b/psyneulink/core/llvm/execution.py index 29dee8ff05e..f62d32a2f07 100644 --- a/psyneulink/core/llvm/execution.py +++ b/psyneulink/core/llvm/execution.py @@ -573,7 +573,7 @@ def execute_node(self, node, inputs=None, context=None): inputs, self.__frozen_vals, self._data_struct) if "comp_node_debug" in self._debug_env: - print("RAN: {}. CTX: {}".format(node, self.extract_node_state(node))) + print("RAN: {}. State: {}".format(node, self.extract_node_state(node))) print("RAN: {}. Params: {}".format(node, self.extract_node_params(node))) print("RAN: {}. Results: {}".format(node, self.extract_node_output(node))) From 66124db44e8c1661c398f16302a3fb514ab4865f Mon Sep 17 00:00:00 2001 From: Jan Vesely Date: Tue, 11 Jul 2023 00:56:17 -0400 Subject: [PATCH 2/3] llvm/execution: Print information about composition input struct if enabled Signed-off-by: Jan Vesely --- psyneulink/core/llvm/execution.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/psyneulink/core/llvm/execution.py b/psyneulink/core/llvm/execution.py index f62d32a2f07..15e76b090b1 100644 --- a/psyneulink/core/llvm/execution.py +++ b/psyneulink/core/llvm/execution.py @@ -635,7 +635,13 @@ def _get_run_input_struct(self, inputs, num_input_sets, arg=3): assert len(inputs) == len(self._execution_contexts) # Extract input for each trial and execution id run_inputs = ((([x] for x in self._composition._build_variable_for_input_CIM({k:v[i] for k,v in inp.items()})) for i in range(num_input_sets)) for inp in inputs) - return c_input(*_tupleize(run_inputs)) + c_inputs = c_input(*_tupleize(run_inputs)) + if "stat" in self._debug_env: + print("Instantiated struct: input ( size:" , + _pretty_size(ctypes.sizeof(c_inputs)), ")", + "for", self._obj.name) + + return c_inputs def _get_generator_run_input_struct(self, inputs, runs): assert len(self._execution_contexts) == 1 From 3265c9b515c7317c733bf8ee0bfceadfada4e2dc Mon Sep 17 00:00:00 2001 From: Jan Vesely Date: Tue, 11 Jul 2023 02:02:55 -0400 Subject: [PATCH 3/3] llvm/execution: Print information about "evaluate" output structure if enabled Signed-off-by: Jan Vesely --- psyneulink/core/llvm/execution.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/psyneulink/core/llvm/execution.py b/psyneulink/core/llvm/execution.py index 15e76b090b1..84e9387d2c2 100644 --- a/psyneulink/core/llvm/execution.py +++ b/psyneulink/core/llvm/execution.py @@ -778,6 +778,11 @@ def _prepare_evaluate(self, inputs, num_input_sets, num_evaluations, all_results out_ty = out_el_ty * num_evaluations ct_num_inputs = bin_func.byref_arg_types[7](num_input_sets) + if "stat" in self._debug_env: + print("Evaluate result struct type size:", + _pretty_size(ctypes.sizeof(out_ty)), + "( evaluations:", num_evaluations, "element size:", ctypes.sizeof(out_el_ty), ")", + "for", self._obj.name) # return variable as numpy array. pycuda can use it directly return ct_comp_param, ct_comp_state, ct_comp_data, ct_inputs, out_ty, ct_num_inputs