Closed yashizhang closed 3 months ago
I forgot that Python versions < 3.10 do not support type | type
, so my type hint int | str
needs to be modified. Added from typing import Union
and changed to Union[int, str]
LGTM thank you for the PR.
Just going to put the timing information here on your system for reference.
Num. Threads: 1, Time: 14.23s Num. Threads: 2, Time: 7.58s Num. Threads: 4, Time: 10.67s Num. Threads: 8, Time: 16.80s Num. Threads: 16, Time: 23.88s Num. Threads: 32, Time: 42.76s Num. Threads: 64, Time: 108.10s
What does this PR do?
This PR adds support for OpenMP multithreading via the
OTPlanSampler
on initialization formethod == "exact"
. Here's the link for Python OT's documentation of the pot.emd method.On my HPC (AMD EPYC 7742 CPU, A100 GPU), running
num_threads=2
ornum_threads=4
gave up to 2x speedups. This is hardware dependent so the default value will benum_threads=1
, as it has been.If you would like to test threading performance yourself, here's the code that I used:
Before submitting
pytest
command?pre-commit run -a
command?