-
Notifications
You must be signed in to change notification settings - Fork 63
Fix for Issue 77 #78
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
Fix for Issue 77 #78
Conversation
…de of legion_python
legate/core/__init__.py
Outdated
| using_legion_python = False | ||
| if not using_legion_python: | ||
| raise RuntimeError( | ||
| 'All Legate programs must be run with a legion_python interperter. We recommend that you use the Legate driver script "bin/legate" found in the installation directory to launch Legate programs as it provides easy-to-use flags for invoking legion_python. You can see options for using the driver script with "bin/legate --help". You can also invoke legion_python directly. Use "bin/legate --verbose ..." to see some examples of how to call legion_python directly.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our pre-commit hooks didn't complain about this long string! @marcinz @magnatelee you guys wrote the pre-commit config, can you check if it can be made to catch this?
|
I changed the check. The original check wasn't actually working: Now we get: |
legate/core/__init__.py
Outdated
| except ModuleNotFoundError: | ||
| using_legion_python = False | ||
| if not using_legion_python: | ||
| if "LEGATE_MAX_DIM" not in os.environ: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is sound. This depends on an environment variable which can be set manually by the user, even if legion_python is not being used. My original check was working. I even tested it. What were you seeing when it "wasn't working".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing for the presence of module legion_cffi will only catch the case where the user tries to use legate directly from the source tree without installing. If the user runs the install script (or uses a pre-compiled package) then legion_cffi will be present and found by both the legion_python interpreter and the regular python interpreter. You can see above that running python examples/gemm.py with the legate install dir added to PYTHONPATH (which I think is what a user is likely to do) bypasses the original check and asserts inside legate/core/legion.py.
This depends on an environment variable which can be set manually by the user, even if legion_python is not being used.
This is true, but I find it very unlikely that a user would have this particular variable set in their environment before ever running Legate. The most likely way that they will learn about this variable is if they try to run a Legate script and they get an error, and with this check we made sure that they don't just see an assertion failure like before, but a detailed error message on what to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll find a different way, but we're not going to rely on an environment variable for the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you prefer. IMHO we don't need to go crazy on this, it's not critical that we catch every edge case.
…n python interpreter
|
I've pushed another attempt at addressing this. |
1 similar comment
|
I've pushed another attempt at addressing this. |
|
Now I get |
|
@manopapad You need to rebuild with the most recent control replication. |
|
I nuked everything and rebuilt under latest control replication (commit |
|
I think |
|
An |
|
@lightsighter well, legion_cffi only dlopens the current process (https://github.com/StanfordLegion/legion/blob/control_replication/bindings/python/legion_cffi.py.in#L30) and does not load the binding library by itself, so unless the process has already loaded the binding library, the interpreter won't be able to find that symbol. In other words, it's perfectly fine for any python interpreter to |
|
The symbol is in the header file and the |
|
Pull and try again. |
|
Works now! |
|
@lightsighter @manopapad I'd like to merge this PR, unless you have any other comments. |
|
As far as I'm concerned it is ready when you guys are. |
|
No issues from me |
Add support for a nice error message when users try to use legate outside of
legion_python