PsyNeuLink icon indicating copy to clipboard operation
PsyNeuLink copied to clipboard

Documentation for Running Composition in Compiled Mode

Open tylergiallanza opened this issue 4 years ago • 1 comments

The documentation for running a composition in compiled mode, using the Composition.run method, currently lists that you can set execution_mode=True to try different LLVM computation modes in order. This appears to be broken with my setup:

python version=3.9.6 PNL version=0.9.1.1

model.run(execution_mode=True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/l9/n0qk_l6x4sn6slfbc9mfpkym0000gn/T/ipykernel_55572/1284304973.py in <module>
----> 1 model.run(execution_mode=True)

/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/psyneulink/core/globals/context.py in wrapper(context, *args, **kwargs)
    739                     not in str(e)
    740                 ):
--> 741                     raise e
    742 
    743             return func(*args, **kwargs)

/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/psyneulink/core/globals/context.py in wrapper(context, *args, **kwargs)
    732 
    733             try:
--> 734                 return func(*args, context=context, **kwargs)
    735             except TypeError as e:
    736                 # context parameter may be passed as a positional arg

/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/psyneulink/core/compositions/composition.py in run(self, inputs, num_trials, initialize_cycle_values, reset_stateful_functions_to, reset_stateful_functions_when, skip_initialization, clamp_input, runtime_params, call_before_time_step, call_after_time_step, call_before_pass, call_after_pass, call_before_trial, call_after_trial, termination_processing, skip_analyze_graph, report_output, report_params, report_progress, report_simulations, report_to_devices, animate, log, scheduler, scheduling_mode, execution_mode, default_absolute_time_unit, context, base_context)
   8443                          ContextFlags.SIMULATION_MODE in context.runmode)
   8444 
-> 8445         if execution_mode & pnlvm.ExecutionMode._Run:
   8446             # There's no mode to run simulations.
   8447             # Simulations are run as part of the controller node wrapper.

TypeError: unsupported operand type(s) for &: 'bool' and 'ExecutionMode'

This is fixed when running model.run(execution_mode=pnl.ExecutionMode.LLVMRun). As a quick side-note, it is not clarified in the documentation for Composition.run which enum to use for specifying the execution_mode parameter: the documentation currently reads enum.Enum[Auto|LLVM|LLVMexec|LLVMRun|Python|PTXExec|PTXRun] rather than specifying the use of pnl.ExecutionMode.

tylergiallanza avatar Nov 10 '21 15:11 tylergiallanza

Right, this needs to be updated. pnl.ExectionMode.Auto is the replacement for execution_mode=True

jvesely avatar Nov 16 '21 20:11 jvesely