-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a better python example. Tweek performance
Signed-off-by: Joshua Hursey <[email protected]>
- Loading branch information
Showing
2 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
#<EG BEGIN ID="pmix_py"> | ||
print("Hello World") | ||
#<EG END ID="pmix_py"> | ||
#!/usr/bin/env python3 | ||
|
||
from pmix import * | ||
|
||
def main(): | ||
#<EG BEGIN ID="pmix_init"> | ||
client_hdl = PMIxClient() | ||
#<EG END ID="pmix_init"> | ||
print("Testing PMIx ", client_hdl.get_version()) | ||
|
||
print("Init") | ||
#<EG BEGIN ID="pmix_init"> | ||
info = [] | ||
(rc,myproc) = client_hdl.init(info) | ||
if 0 != rc: | ||
exit(1) | ||
#<EG END ID="pmix_init"> | ||
|
||
print("Get") | ||
info = [] | ||
rc, get_val = client_hdl.get(myproc, "PMIX_LOCAL_RANK", info) | ||
print("Get result: ", rc) | ||
print("Get value returned: ", get_val) | ||
|
||
print("Finalize") | ||
info = [] | ||
client_hdl.finalize(info) | ||
|
||
if __name__ == '__main__': | ||
main() |