Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Running Composition in Compiled Mode #2197

Open
tylergiallanza opened this issue Nov 10, 2021 · 1 comment
Open

Documentation for Running Composition in Compiled Mode #2197

tylergiallanza opened this issue Nov 10, 2021 · 1 comment

Comments

@tylergiallanza
Copy link

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.

@jvesely
Copy link
Collaborator

jvesely commented Nov 16, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants