| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Implement automatic loading of Brian2CUDA-specific preferences from dedicated preference files, avoiding validation errors that occur when external package preferences are added to Brian2's main preference file. Changes: - Added _load_preference_files() function to brian2cuda/__init__.py - Checks ~/.brian2cuda_preferences (user-wide preferences) - Checks ./brian2cuda_preferences (project-specific preferences) - Silently ignores missing files, warns on invalid files - Added 3 unit tests to brian2cuda/tests/test_gpu_detection.py Based on approach suggested by @mstimberg in brian-team/brian2#1340 Fixes brian-team#281
|
Hi @nishantraghuvanshi, thanks for the PR and apologies for taking so long to coming back to it. This looks generally good, but note that in brian-team/brian2#1340 I proposed this as a temporary solution, since we'd have to add basically identical code to brian2cuda, brian2genn, and any other Brian extension package that wants to use preferences. Ideally, we'd come up with a more general solution – either, having some "deferred validation" mechanism, or having code similar to what you propose in a function that is included in brian2 itself, which can be called from within the extension package (e.g. brian2cuda would call brian2.load_preference_file("brian2cuda"), or maybe something that also checks that this file only defines brian2cuda-specific preferences). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Implemented automatic loading of Brian2CUDA-specific preferences from dedicated preference files, avoiding validation errors that occur when external package preferences are added to Brian2's main preference file.
Changes:
Based on approach suggested by @mstimberg in brian-team/brian2#1340
Please do tell me if there are any problems with this or any changes required.
@denisalevi
Fixes #281