Hi @thierry, @Kaii - I got curious while reading this post/replies and played around with at::parallel_for.
The issue as I understand it is that different parallel backends require different compiler arguments and CppExtension does not set them up automatically.
As an experiment I wrote a wrapper for CppExtension that extracts the parallel backend from torch (from torch.config.parallel_info() ) and then adds the required, backed specific compiler arguments (only tested on Ubuntu 18.04 image produced from  pytorch/Dockerfile).
I then used the setup to write a simple test for at::parallel_for to measure the concurrency given a  at::parallel_for range. (Using the backend agnostic ATen/Parallel.h header file)
Code is on: github 20
Example desktop:
>>> import torch
>>> import parallel_extension_cpp
>>> parallel_extension_cpp.concurrency_test(21)
11
>>> parallel_extension_cpp.concurrency_test(128)
16
>>> parallel_extension_cpp.concurrency_test(99)
15
>>> parallel_extension_cpp.concurrency_test(150)
15
>>> parallel_extension_cpp.concurrency_test(151)
16
>>> 

Example laptop:
import torch
>>> import parallel_extension_cpp
>>> parallel_extension_cpp.concurrency_test(10)
5
>>> parallel_extension_cpp.concurrency_test(11)
6
>>> parallel_extension_cpp.concurrency_test(25)
5
>>> parallel_extension_cpp.concurrency_test(1000)
6
>>> parallel_extension_cpp.concurrency_test(8)
4