Skip to content

Conversation

@ilia-cher
Copy link
Contributor

@ilia-cher ilia-cher commented May 6, 2019

Stack from ghstack:

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch
pytest -s -v test/test_jit.py

Differential Revision: D15248708

@jamesr66a
Copy link
Collaborator

Any way to test this?

@ilia-cher
Copy link
Contributor Author

ilia-cher commented May 6, 2019

@jamesr66a I did build PT with PARALLEL_BACKEND=NATIVE to use native thread pool and with USE_EIGEN_THREADPOOL=1 to use Eigen, then ran test_torch.py, a lot of the ops in these tests use parallelism and we also have dedicated parallelization tests there (e.g. test_cpu_parallel)
We don't have a dedicated thread pool test in PT itself, but there's one in Eigen, we could maybe also include it

@ilia-cher
Copy link
Contributor Author

@jamesr66a I also ran test_jit.py to test explicit fork/join parallelism

@ilia-cher ilia-cher requested a review from zheng-xq May 6, 2019 20:52
@jamesr66a
Copy link
Collaborator

Ok. But should we get this tested in CI somehow?

@ilia-cher
Copy link
Contributor Author

Makes sense, I guess we should add a few more builds, not only for Eigen but for native and TBB backends too; I think it's better to send a separate PR, it will require some changes to our CI builds and @kostmo review

@suo suo removed their request for review May 10, 2019 17:06
This was referenced May 13, 2019
@cpuhrsch
Copy link
Contributor

Where will this be needed? For now we wanted to avoid adding Eigen as a dependency. cc @soumith

@ilia-cher
Copy link
Contributor Author

some benchmarking data

./build/bin/at_launch_benchmark
Launching 10000000 tasks using 48 threads
Time to run 10000000 iterations 19.216 s.

(48 - size of the thread pool)

vs. when built with USE_EIGEN_THREADPOOL=0:

./build/bin/at_launch_benchmark
Launching 10000000 tasks using 48 threads
Time to run 10000000 iterations 187.441 s.

when using 50 parallel threads launching tasks instead of a single serial loop

Launching 10000000 tasks using 48 threads
Time to run 10000000 iterations 9.916 s.
vs.
Launching 10000000 tasks using 48 threads
Time to run 10000000 iterations 95.326 s.

ilia-cher added 6 commits May 21, 2019 23:32
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
ilia-cher added 9 commits May 23, 2019 00:11
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
Support for Eigen thread pool

Summary:
Adding support for Eigen thread pool as a replacement
for the current native thread pool

Test Plan:
USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE BLAS=MKL
USE_MKLDNN=1 USE_OPENCV=1 USE_FFMPEG=1 python setup.py develop --cmake
pytest -s -v test/test_torch.py::TestTorch

gh-metadata: pytorch pytorch 20157 gh/ilia-cher/16/head
@ilia-cher ilia-cher closed this Jun 6, 2019
@facebook-github-bot facebook-github-bot deleted the gh/ilia-cher/16/head branch October 28, 2019 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

caffe2 module: build Build system issues module: internals Related to internal abstractions in c10 and ATen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants