Commit fc05585
Fix Python 3.12 deprecation warning about os.fork() (#1070)
In Python 3.12, on Linux at least,
`src/openfermion/testing/performance_benchmarks_test.py` produces the
following warnings:
```
~/.pyenv/versions/3.12.5/lib/python3.12/multiprocessing/popen_fork.py:66: RuntimeWarning:
os.fork() was called. os.fork() is incompatible with multithreaded code, and JAX is
multithreaded, so this will likely lead to a deadlock.
self.pid = os.fork()
src/openfermion/testing/performance_benchmarks_test.py::test_run_linear_qop
src/openfermion/testing/performance_benchmarks_test.py::test_run_linear_qop
src/openfermion/testing/performance_benchmarks_test.py::test_run_linear_qop
src/openfermion/testing/performance_benchmarks_test.py::test_run_linear_qop
src/openfermion/testing/performance_benchmarks_test.py::test_run_linear_qop
~/.pyenv/versions/3.12.5/lib/python3.12/multiprocessing/popen_fork.py:66:
DeprecationWarning: This process (pid=3069778) is multi-threaded, use of fork()
may lead to deadlocks in the child. self.pid = os.fork()
```
This can be resolved by calling `multiprocessing.set_start_method()` in
`__init__` of the `ParallelLinearQuibitOperator` class.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent a221db7 commit fc05585
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
165 | 171 | | |
166 | 172 | | |
167 | 173 | | |
| |||
0 commit comments