Open ilumsden opened 2 months ago
Great work, thanks @ilumsden! In addition to the documentation it would be great to add an example like the c/cxx/fortran-example apps in the examples/apps directory for the Python annotations. A unit test would also be great. The Caliper unit tests are actually run through Python already so it shouldn't be too difficult to add; check out the tests/ci_app_tests directory. I'm happy to help if needed.
Outstanding work:
@daboehme this PR is now ready for review.
Hi @ilumsden, I added a few fixes in a PR to your branch.
I can't run the tests via make test
because the pycaliper module is not found. Did you ever get that to work?
It works for me when I add the installed location to PYTHONPATH
and run the ci_test_py_ann
program or py-example
directly. It still doesn't work through the test_python_api.py
script, even with PYTHONPATH
set.
I got a type mismatch error with the config_preset
call, I had to comment that out in the test. Doesn't seem to like the lambda.
I'd also like to move the sources to src/interface/
, where the Fortran/C bindings already are.
@daboehme thanks for the feedback. I've moved the bindings to src/interface
, and I've fixed the tests so that PYTHONPATH
will be set correctly. Only problem right now is that my way of setting the path uses configure_file
, meaning the Python test files will not be automatically updated by make
.
I also fixed a few bugs in the test file where I was not using the Python API correctly. The test should now work. I'm currently messing with the GitHub Actions runner to see if I can get that to work.
This PR adds initial Python bindings to Caliper using the pybind11 library. The resulting Python library (named
pycaliper
) contains bindings for the following Caliper APIs:cali::ConfigManager
cali::Variant
cali::Annotation
cali_attribute
functionscali_begin_*
functionscali_set_*
functionscali_end
functioncali_*_byname
functionscali_[begin | end]_region
functionscali_[begin | end]_comm_region
functionscali_[begin | end]_phase
functionscali_set_global_*_byname
functionscali_make_loop_iteration_attribute
cali_init
cali_is_initialized
cali_attr_type
enumcali_attr_properties
enumThese bindings have been tested using the annotations added to Hatchet and Thicket in LLNL/hatchet#142 and LLNL/thicket#195.
Remaining Work:
These bindings are complete and could be merged as-is. However, it would be ideal if I added docstrings to the Python module before merge.