Hi all,
I have a Legion program targeting the Legion C++ API directly, with a top-level task written in C++ and subtasks also written in C++. I would like to partially replace the top-level task with one written in Python, while keeping the C++ subtasks. See minimal example below.
What is the best way to accomplish this? I can use the Python API to call “call_task_1” in the code below. But will the Legion tasks conflict with Pygion, which might expect that the top level task main() is the only task in the application? Or, since the Python code doesn't have anything specific to Legion, is there a better way to accomplish this than using Pygion?
I’d like to have something similar to this:
C++ code:
enum {
TASK_1_ID,
TASK_2_ID,
//...
};
void task_1(const Task *task,
const std::vector<PhysicalRegion> ®ions,
Context ctx, Runtime *runtime) {
// ...
}
void call_task_1(...) {
// ... Setup code ...
IndexTaskLauncher task_1_launcher(...);
task_1_launcher.execute_index_space();
}
void preregister_tasks() {
Runtime::preregister_task_variant<task_1>(...);
}
Python code:
@task
def main():
# application high-level logic ...
c_interface.call_task_1(...)
# ...
if __name__ == '__main__':
c_interface.preregister_tasks()
main()
Thanks for any insights,
Eric
--
You received this message because you are subscribed to the Google Groups "Legion Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to legionusers...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/legionusers/CAPS9aMfyfxB6eAg1TesTOAUhLHLZseL7aQyu-8L70geMK_VNXg%40mail.gmail.com.
$ python $install/share/Legion/python/examples/hello.py
Traceback (most recent call last):
File "/data/eraut/legion/build_cugcc8_python/install/share/Legion/python/examples/hello.py", line 20, in <module>
from pygion import task
File "/data/eraut/legion/build_cugcc8_python/install/lib/python3.10/site-packages/pygion.py", line 75, in <module>
assert _max_dim is not None, 'Unable to detect LEGION_MAX_DIM'
AssertionError: Unable to detect LEGION_MAX_DIM
$ $install/bin/legion_python -ll:py 1
[0 - 7f03e0752800] 0.542676 {6}{python}: python exception occurred within task:
Traceback (most recent call last):
File "/data/eraut/legion/build_cugcc8_python/install/lib/python3.10/site-packages/legion_top.py", line 311, in legion_python_main
c.legion_task_preamble(
File "/usr/lib64/python3.10/site-packages/cffi/api.py", line 912, in __getattr__
make_accessor(name)
File "/usr/lib64/python3.10/site-packages/cffi/api.py", line 908, in make_accessor
accessors[name](name)
File "/usr/lib64/python3.10/site-packages/cffi/api.py", line 838, in accessor_function
value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'legion_task_preamble' not found in library '<None>': ./legion_python: undefined symbol: legion_task_preamble
legion_python: /data/eraut/legion/runtime/realm/python/python_module.cc:978: virtual void Realm::LocalPythonProcessor::execute_task(Realm::Processor::TaskFuncID, const Realm::ByteArrayRef&): Assertion `0' failed.
Aborted (core dumped)
To view this discussion on the web visit https://groups.google.com/d/msgid/legionusers/766c3666-480b-49ef-865a-3b62410e91fdn%40googlegroups.com.