Import of torch breaks standard multiprocessing
Labels: module: dependency bug, module: multiprocessing, triaged, module: openmp

### 🐛 Describe the bug

## Instructions To Reproduce the Issue:

When importing torch on my laptop, multiprocessing breaks for some reason. I can not reproduce this issue on another device, so it may be in combination with OS or hardware. But when this import is included, all spun up processes run on CPU cores 0 and 1. When this import is removed all CPU cores are used again. I first noticed this issues when training became extremely slow due to data not loading.

Minimal install:
```
conda create -n test pip tqdm
conda activate test
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
```

Minimal code for multiprocessing:
```py
import os
from multiprocessing import Pool
import random
from tqdm import tqdm

import torch

def heavy(x):
    return [random.randint(1, 100) * x for _ in range(10000000)]
with Pool(os.cpu_count()) as pool:
    _ = list(tqdm(pool.imap_unordered(heavy, list(range(100))), total=100))
```

When running the above code with the import the following command gives these outputs with and without the import:
```
ps -C python -o %cpu,%mem,cmd,psr
```

with:
```
%CPU %MEM CMD                         PSR
 0.0  0.0 /home/stefan/.mambaforge/en   0
 0.0  0.0 /home/stefan/.mambaforge/en  14
 7.1  0.5 python test.py                6
11.0  0.3 python test.py                1
10.7  0.3 python test.py                1
10.7  0.3 python test.py                1
10.7  0.3 python test.py                1
10.6  0.3 python test.py                1
10.8  0.3 python test.py                1
10.6  0.3 python test.py                0
10.6  0.3 python test.py                0
10.7  0.3 python test.py                1
10.7  0.3 python test.py                1
10.7  0.3 python test.py                1
10.6  0.3 python test.py                0
10.5  0.3 python test.py                0
10.6  0.3 python test.py                1
10.6  0.3 python test.py                0
10.6  0.3 python test.py                0
10.6  0.3 python test.py                0
10.5  0.3 python test.py                0
10.7  0.3 python test.py                0
10.5  0.3 python test.py                0
```
without:
```
%CPU %MEM CMD                         PSR
 0.0  0.0 /home/stefan/.mambaforge/en   0
 0.0  0.0 /home/stefan/.mambaforge/en  14
64.5  9.9 python test.py               11
78.8  0.3 python test.py               18
88.7  0.5 python test.py               16
90.4  0.5 python test.py               12
87.7  0.4 python test.py               15
81.2  0.5 python test.py                6
83.0  0.4 python test.py               17
74.1  0.6 python test.py               10
76.5  0.0 python test.py               14
89.7  0.6 python test.py               14
80.8  0.1 python test.py                7
72.4  0.6 python test.py               11
85.7  0.1 python test.py                5
82.8  0.6 python test.py               13
72.2  0.1 python test.py               13
86.0  0.5 python test.py                4
80.6  0.5 python test.py                2
78.3  0.4 python test.py                8
74.5  0.3 python test.py               10
76.4  0.4 python test.py                0
71.2  0.1 python test.py               19
```
If it's an interaction with the OS, please let me know what other logs I need to provide.

## Expected behavior:
I would expect the import to have no effect on multiprocessing. Especially since nothing is done using torch. I would expect it to act the same as on my other devices that don't have this issue. Mainly trying to find what difference in setup/architecture is causing this weird behavior.

Thanks in advance for any help

Possible duplicate of: https://github.com/pytorch/pytorch/issues/101850, but also breaks normal multiprocessing


### Versions
```
$ python collect_env.py
Collecting environment information...
PyTorch version: 2.0.1
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
Clang version: Could not collect
CMake version: version 3.22.1
Libc version: glibc-2.35

Python version: 3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 08:57:19) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-5.19.0-42-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3080 Ti Laptop GPU
Nvidia driver version: 525.105.17
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   46 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          20
On-line CPU(s) list:             0-19
Vendor ID:                       GenuineIntel
Model name:                      12th Gen Intel(R) Core(TM) i9-12900H
CPU family:                      6
Model:                           154
Thread(s) per core:              2
Core(s) per socket:              14
Socket(s):                       1
Stepping:                        3
CPU max MHz:                     5000,0000
CPU min MHz:                     400,0000
BogoMIPS:                        5836.80
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l2 invpcid_single cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities
Virtualization:                  VT-x
L1d cache:                       544 KiB (14 instances)
L1i cache:                       704 KiB (14 instances)
L2 cache:                        11,5 MiB (8 instances)
L3 cache:                        24 MiB (1 instance)
NUMA node(s):                    1
NUMA node0 CPU(s):               0-19
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.24.3
[pip3] torch==2.0.1
[pip3] torchaudio==2.0.2
[pip3] torchvision==0.15.2
[pip3] triton==2.0.0
[conda] blas                      2.116                       mkl    conda-forge
[conda] blas-devel                3.9.0            16_linux64_mkl    conda-forge
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] libblas                   3.9.0            16_linux64_mkl    conda-forge
[conda] libcblas                  3.9.0            16_linux64_mkl    conda-forge
[conda] liblapack                 3.9.0            16_linux64_mkl    conda-forge
[conda] liblapacke                3.9.0            16_linux64_mkl    conda-forge
[conda] mkl                       2022.1.0           h84fe81f_915    conda-forge
[conda] mkl-devel                 2022.1.0           ha770c72_916    conda-forge
[conda] mkl-include               2022.1.0           h84fe81f_915    conda-forge
[conda] numpy                     1.24.3          py311h64a7726_0    conda-forge
[conda] pytorch                   2.0.1           py3.11_cuda11.7_cudnn8.5.0_0    pytorch
[conda] pytorch-cuda              11.7                 h778d358_5    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchaudio                2.0.2               py311_cu117    pytorch
[conda] torchtriton               2.0.0                     py311    pytorch
[conda] torchvision               0.15.2              py311_cu117    pytorch
```


cc @VitalyFedyunin