Closed xjules closed 1 day ago
Async generators seem to be slower
https://en.lewoniewski.info/2023/python-3-11-vs-python-3-12-performance-testing/
Some performance comparison when testing on RHEL8 python 3.12 and Python 3.11:
Python 3.12
tests/ert/ui_tests/cli/test_field_parameter.py::test_field_param_update_using_heat_equation PASSED
tests/ert/ui_tests/cli/test_field_parameter.py::test_parameter_update_with_inactive_cells_xtgeo_grdecl PASSED
tests/ert/ui_tests/cli/test_field_parameter.py::test_field_param_update_using_heat_equation_zero_var_params_and_adaptive_loc PASSED
tests/ert/ui_tests/cli/test_field_parameter.py::test_foward_init_false PASSED
=========================================================================================================================================================================================================== warnings summary ============================================================================================================================================================================================================
tests/ert/ui_tests/cli/test_field_parameter.py: 430 warnings
/private/jparu/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/subprocess.py:1885: RuntimeWarning: Using fork() can cause Polars to deadlock in the child process.
In addition, using fork() with Python in general is a recipe for mysterious
deadlocks and crashes.
The most likely reason you are seeing this error is because you are using the
multiprocessing module on Linux, which uses fork() by default. This will be
fixed in Python 3.14. Until then, you want to use the "spawn" context instead.
See https://docs.pola.rs/user-guide/misc/multiprocessing/ for details.
self.pid = _fork_exec(
tests/ert/ui_tests/cli/test_field_parameter.py: 394 warnings
/data/env/py312-ert/lib/python3.12/site-packages/pydantic/main.py:212: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================================================================================================== 4 passed, 824 warnings in 136.33s (0:02:16)
Python 3.11
tests/ert/ui_tests/cli/test_field_parameter.py::test_field_param_update_using_heat_equation PASSED
tests/ert/ui_tests/cli/test_field_parameter.py::test_parameter_update_with_inactive_cells_xtgeo_grdecl PASSED
tests/ert/ui_tests/cli/test_field_parameter.py::test_field_param_update_using_heat_equation_zero_var_params_and_adaptive_loc PASSED
tests/ert/ui_tests/cli/test_field_parameter.py::test_foward_init_false PASSED
=========================================================================================================================================================================================================== warnings summary ============================================================================================================================================================================================================
tests/ert/ui_tests/cli/test_field_parameter.py: 394 warnings
/data/env/py311-zmq/lib64/python3.11/site-packages/pydantic/main.py:212: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================================================================================================== 4 passed, 394 warnings in 120.61s (0:02:00) =
There is no longer such a big difference after https://github.com/equinor/ert/commit/9566c97b34b78a1119f67c1fe5ab380431132570
It seems indeed that the discrepancy was caused by using parallelization in tests. Closing this one.
It is apparent that Python 3.12 is much slower than Python 3.11 when it comes running the all tests. We should find out what's the main source of this slowness. Unit tests: Py311 is 3-4 minutes faster Cli tests: Py311 is 4-5 minutes faster Check here for more info https://github.com/equinor/ert/actions/runs/11971902477/job/33377669575