added requirements.txt file with newer dependencies (Python 3.11) #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Dear @tgasser ,
I have added a
requirements.txt
to the OSCAR repository to facilitate the installation and management of the project's runtime environment.The Python version specified is 3.11.8, and the versions of the dependencies are up to date as of April 10, 2024. I have tested all files in
run_scripts
and checked all outputs to ensure that OSCAR runs correctly with this Python version and these dependency versions.Additionally, I conducted tests using the environment configuration specified in the
README.md
(Python version 3.9.19, dependency versions as mentioned inREADME.md
). The results indicate that using Python 3.11.8 with newer versions of dependencies approximately doubles the running speed compared to using Python 3.9.19 with the dependency versions listed in the README (the main process execution time of OSCAR is halved).This improvement is likely due to optimizations in Python 3.11 that significantly enhance execution efficiency ("Python 3.11 is between 10-60% faster than Python 3.10. On average, we measured a 1.25x speedup on the standard benchmark suite." See: What’s New In Python 3.11). Moreover, newer versions of dependencies such as xarray, numpy, scipy, and pandas not only add functionalities (potentially including efficiency optimizations) but also fix many bugs. In summary, updating the Python version and dependency versions, while ensuring OSCAR's correct operation, is beneficial for accelerating execution speed.
If you feel more testing is needed to ensure the new version's environment configuration is reliable, I am happy to undertake such work. I am also willing to update the relevant sections about running and environment configuration in the
README.md
.Please feel free to comment and @ me with any questions or needs!
Test Comparison
I conducted related tests on my PC, ensuring that conditions were essentially the same aside from the Python environment.
Running Environment
Results
Note: The total running time refers to the sum of model execution times outputted by OSCAR.
The running time with Python 3.9 is essentially twice that of Python 3.11. Additionally, Python 3.9's CPU usage is lower than Python 3.11's, which indicates that the older version of Python does not utilize the computer's performance as efficiently.
Detailed Outputs
basic_example_1.py
Python 3.9.19 + Dependency Versions from README:
Python 3.11.8 + Newer Dependency Versions:
basic_example_2.py
Python 3.9.19 + Dependency Versions from README:
Python 3.11.8 + Newer Dependency Versions:
basic_example_3.py
Python 3.9.19 + Dependency Versions from README:
Python 3.11.8 + Newer Dependency Versions:
check_LUC_structure.py
Python 3.9.19 + Dependency Versions from README:
Python 3.11.8 + Newer Dependency Versions:
Appendix
requirements.txt
Python 3.9.19
Please note that
xarray == 0.20.1
can only be used withpandas == 1.3.5
, using a higher version of pandas will result in an error.Python 3.11.8
environment.yml
I created two brand-new Python environments using conda to test their differences. Below are the exported environment configurations for Python 3.9.19 and Python 3.11.8, respectively.
Python 3.9.19
Python 3.11.8
Other Notes
Using the new version of xarray when running test files in
run_scripts
produces a DeprecationWarning which does not affect program execution.I am planning to try to further optimize OSCAR's running efficiency by utilizing the numba library, optimizing algorithms, and implementing parallel computing, all while making minimal changes to the existing code. I'd greatly value your opinion on this initiative. Would this effort be of interest to you, or do you believe it might not be necessary?