From 52646bbf7bd405bc8aeaada6e9f5344c42084db6 Mon Sep 17 00:00:00 2001 From: Weilei Zeng at qlab01 Date: Fri, 26 Apr 2024 17:54:02 +0800 Subject: [PATCH] add test --- pymatching/test.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 pymatching/test.py diff --git a/pymatching/test.py b/pymatching/test.py new file mode 100644 index 0000000..5031579 --- /dev/null +++ b/pymatching/test.py @@ -0,0 +1,31 @@ +from multiprocessing import Pool + + +def fun(i): + print(i) + for j in range(i*10,i*10+10): + pass + return +# print(j,end=',') + print() + +def test_pool(): + with Pool(5) as pool: + pool.map(fun, range(20)) + +test_pool() + +#result, use pool.map_async() instead +# see https://stackoverflow.com/questions/33447055/python-multiprocess-pool-how-to-exit-the-script-when-one-of-the-worker-process + + +def main(): + foo() +def foo(): + print('foo') + bar() + +def bar(): + print('bar') + +main()