Issue |
137136
|
Summary |
OpenMP failure: Assertion failure at kmp_affinity.cpp(3523)
|
Labels |
|
Assignees |
|
Reporter |
jbajic
|
## Error
Assertion failure at kmp_affinity.cpp(3523): num_avail == (unsigned)__kmp_avail_proc.
OMP: Error #13: Assertion failure at kmp_affinity.cpp(3523).
OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see https://github.com/llvm/llvm-project/issues/.
## Sources
```c++
#include <iostream>
#include <omp.h>
int main() {
std::cout << "Program starting..." << std::endl;
// Optional: Set the number of threads programmatically
// omp_set_num_threads(4); // Or use OMP_NUM_THREADS environment variable
// This pragma marks the start of a parallel region.
// The code inside the {} block will be executed by multiple threads.
#pragma omp parallel
{
// Get the unique ID of the current thread
int thread_id = omp_get_thread_num();
// Get the total number of threads executing in this parallel region
int num_threads = omp_get_num_threads();
// Each thread will print its own message
// Using std::cout requires careful synchronization in more complex scenarios,
// but for simple prints like this, it's often okay, though output might interleave.
// Using printf might be slightly safer for interleaved output in simple cases.
#pragma omp critical // Ensures only one thread prints at a time to avoid garbled output
{
std::cout << "Hello from thread " << thread_id
<< " out of " << num_threads << " threads." << std::endl;
}
// Example of work done by each thread (optional)
// #pragma omp for // Could add a parallel loop here if needed
// for(int i=0; i < 5; ++i) {
// printf("Thread %d processing item %d\n", thread_id, i);
// }
} // End of the parallel region
std::cout << "Parallel region finished." << std::endl;
std::cout << "Program finished." << std::endl;
return 0;
}
```
command:
```bash
clang++-19 -fopenmp=libomp openmp.cpp -o openmp
./openmp
```
## Enviroment
Now this is a bit more complex. This has started to happen when Circle CI migrated their docker containers to cgroupv2 but only on ARM machines. I am not sure what might be the cause, but here is additional information:
Machine:
```
System information:
Server Version: 5.4.2
Storage Driver: overlay
Backing Filesystem: xfs
Cgroup Driver: systemd
Cgroup Version: 2
Kernel Version: 6.8.0-1024-aws
Operating System: ubuntu
OSType: linux
Architecture: arm64
```
Docker container: cimg/base:2024.0
LLVM version :19
## Additional info
output from `cat /proc/cpuinfo`
```
processor : 0
BogoMIPS : 243.75
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x3
CPU part : 0xd0c
CPU revision : 1
processor : 1
BogoMIPS : 243.75
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x3
CPU part : 0xd0c
CPU revision : 1
```
Output from `lscpu -e`:
```
CPU NODE CLUSTER CORE L1d:L1i:L2:L3 ONLINE
0 0 0 0 0:0:0:0 yes
1 0 0 1 1:1:1:0 yes
2 0 0 2 2:2:2:0 yes
3 0 0 3 3:3:3:0 yes
4 0 0 4 4:4:4:0 yes
5 0 0 5 5:5:5:0 yes
6 0 0 6 6:6:6:0 yes
7 0 0 7 7:7:7:0 yes
8 0 0 8 8:8:8:0 yes
9 0 0 9 9:9:9:0 yes
10 0 0 10 10:10:10:0 yes
11 0 0 11 11:11:11:0 yes
12 0 0 12 12:12:12:0 yes
13 0 0 13 13:13:13:0 yes
14 0 0 14 14:14:14:0 yes
15 0 0 15 15:15:15:0 yes
16 0 0 16 16:16:16:0 yes
17 0 0 17 17:17:17:0 yes
18 0 0 18 18:18:18:0 yes
19 0 0 19 19:19:19:0 yes
20 0 0 20 20:20:20:0 yes
21 0 0 21 21:21:21:0 yes
22 0 0 22 22:22:22:0 yes
23 0 0 23 23:23:23:0 yes
24 0 0 24 24:24:24:0 yes
25 0 0 25 25:25:25:0 yes
26 0 0 26 26:26:26:0 yes
27 0 0 27 27:27:27:0 yes
28 0 0 28 28:28:28:0 yes
29 0 0 29 29:29:29:0 yes
30 0 0 30 30:30:30:0 yes
31 0 0 31 31:31:31:0 yes
```
Output from all cgroupv2 files related to the current process:
```
Run checker:
Check cgroup version
cgroup /sys/fs/cgroup cgroup2 ro,nosuid,nodev,noexec,relatime 0 0
Proc id: 2217
Group name:
--- Contents of: /sys/fs/cgroup/misc.events ---
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.rsvd.current ---
0
--- Contents of: /sys/fs/cgroup/cgroup.events ---
populated 1
frozen 0
--- Contents of: /sys/fs/cgroup/memory.events ---
low 0
high 0
max 0
oom 0
oom_kill 0
oom_group_kill 0
--- Contents of: /sys/fs/cgroup/io.prio.class ---
no-change
--- Contents of: /sys/fs/cgroup/io.pressure ---
some avg10=0.00 avg60=0.00 avg300=0.00 total=9706
full avg10=0.00 avg60=0.00 avg300=0.00 total=9696
--- Contents of: /sys/fs/cgroup/cpuset.cpus.exclusive.effective ---
--- Contents of: /sys/fs/cgroup/cgroup.procs ---
7
13
2214
2217
2225
2233
--- Contents of: /sys/fs/cgroup/memory.events.local ---
low 0
high 0
max 0
oom 0
oom_kill 0
oom_group_kill 0
--- Contents of: /sys/fs/cgroup/memory.swap.peak ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.events ---
max 0
--- Contents of: /sys/fs/cgroup/memory.swap.current ---
0
--- Contents of: /sys/fs/cgroup/misc.current ---
--- Contents of: /sys/fs/cgroup/cpuset.cpus.exclusive ---
--- Contents of: /sys/fs/cgroup/memory.swap.max ---
8589934592
--- Contents of: /sys/fs/cgroup/memory.zswap.current ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.current ---
0
--- Contents of: /sys/fs/cgroup/cpu.weight ---
79
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.events.local ---
max 0
--- Contents of: /sys/fs/cgroup/memory.swap.events ---
high 0
max 0
fail 0
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.max ---
max
--- Contents of: /sys/fs/cgroup/cgroup.max.descendants ---
max
--- Contents of: /sys/fs/cgroup/cpu.stat ---
usage_usec 250427245
user_usec 215996685
system_usec 34430560
core_sched.force_idle_usec 0
nr_periods 1724
nr_throttled 663
throttled_usec 246824737
nr_bursts 0
burst_usec 0
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.max ---
max
--- Contents of: /sys/fs/cgroup/cpu.weight.nice ---
1
--- Contents of: /sys/fs/cgroup/memory.pressure ---
some avg10=0.00 avg60=0.00 avg300=0.00 total=0
full avg10=0.00 avg60=0.00 avg300=0.00 total=0
--- Contents of: /sys/fs/cgroup/memory.current ---
5141155840
--- Contents of: /sys/fs/cgroup/pids.current ---
29
--- Contents of: /sys/fs/cgroup/memory.stat ---
anon 17551360
file 4929355776
kernel 190660608
kernel_stack 458752
pagetables 442368
sec_pagetables 0
percpu 10608
sock 0
vmalloc 24576
shmem 0
zswap 0
zswapped 0
file_mapped 0
file_dirty 707084288
file_writeback 0
swapcached 0
anon_thp 0
file_thp 0
shmem_thp 0
inactive_anon 0
active_anon 17469440
inactive_file 4929355776
active_file 0
unevictable 0
slab_reclaimable 187252584
slab_unreclaimable 784672
slab 188037256
workingset_refault_anon 0
workingset_refault_file 0
workingset_activate_anon 0
workingset_activate_file 0
workingset_restore_anon 0
workingset_restore_file 0
workingset_nodereclaim 0
pgscan 0
pgsteal 0
pgscan_kswapd 0
pgscan_direct 0
pgscan_khugepaged 0
pgsteal_kswapd 0
pgsteal_direct 0
pgsteal_khugepaged 0
pgfault 920599
pgmajfault 0
pgrefill 0
pgactivate 0
pgdeactivate 0
pglazyfree 0
pglazyfreed 0
zswpin 0
zswpout 0
zswpwb 0
thp_fault_alloc 0
thp_collapse_alloc 0
thp_swpout 0
thp_swpout_fallback 0
--- Contents of: /sys/fs/cgroup/pids.events ---
max 0
--- Contents of: /sys/fs/cgroup/memory.low ---
0
--- Contents of: /sys/fs/cgroup/cpu.pressure ---
some avg10=0.87 avg60=12.04 avg300=5.92 total=22384434
full avg10=0.87 avg60=12.04 avg300=5.92 total=22337888
--- Contents of: /sys/fs/cgroup/cgroup.type ---
domain
--- Contents of: /sys/fs/cgroup/cgroup.stat ---
nr_descendants 0
nr_dying_descendants 0
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.rsvd.current ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.events.local ---
max 0
--- Contents of: /sys/fs/cgroup/rdma.current ---
--- Contents of: /sys/fs/cgroup/memory.swap.high ---
max
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.rsvd.max ---
max
--- Contents of: /sys/fs/cgroup/cpu.idle ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.rsvd.max ---
max
--- Contents of: /sys/fs/cgroup/cpu.stat.local ---
throttled_usec 569690384
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.rsvd.current ---
0
--- Contents of: /sys/fs/cgroup/rdma.max ---
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.events ---
max 0
--- Contents of: /sys/fs/cgroup/cgroup.threads ---
7
13
19
20
21
22
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
55
56
2214
2217
2225
2271
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.numa_stat ---
total=0 N0=0
--- Contents of: /sys/fs/cgroup/memory.numa_stat ---
anon N0=17555456
file N0=4929355776
kernel_stack N0=458752
pagetables N0=446464
sec_pagetables N0=0
shmem N0=0
file_mapped N0=0
file_dirty N0=707084288
file_writeback N0=0
swapcached N0=0
anon_thp N0=0
file_thp N0=0
shmem_thp N0=0
inactive_anon N0=0
active_anon N0=17473536
inactive_file N0=4929355776
active_file N0=0
unevictable N0=0
slab_reclaimable N0=187251192
slab_unreclaimable N0=824264
workingset_refault_anon N0=0
workingset_refault_file N0=0
workingset_activate_anon N0=0
workingset_activate_file N0=0
workingset_restore_anon N0=0
workingset_restore_file N0=0
workingset_nodereclaim N0=0
--- Contents of: /sys/fs/cgroup/cgroup.kill ---
cat: /sys/fs/cgroup/cgroup.kill: Permission denied
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.rsvd.max ---
max
--- Contents of: /sys/fs/cgroup/memory.peak ---
5255917568
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.events ---
max 0
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.current ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.numa_stat ---
total=0 N0=0
--- Contents of: /sys/fs/cgroup/cpuset.cpus.partition ---
member
--- Contents of: /sys/fs/cgroup/cpuset.cpus.effective ---
0-31
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.max ---
max
--- Contents of: /sys/fs/cgroup/cgroup.freeze ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.numa_stat ---
total=0 N0=0
--- Contents of: /sys/fs/cgroup/memory.min ---
0
--- Contents of: /sys/fs/cgroup/cpu.max.burst ---
0
--- Contents of: /sys/fs/cgroup/cgroup.controllers ---
cpuset cpu io memory hugetlb pids rdma misc
--- Contents of: /sys/fs/cgroup/cpu.max ---
200000 100000
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.numa_stat ---
total=0 N0=0
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.current ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.events.local ---
max 0
--- Contents of: /sys/fs/cgroup/memory.oom.group ---
0
--- Contents of: /sys/fs/cgroup/memory.zswap.writeback ---
1
--- Contents of: /sys/fs/cgroup/memory.max ---
8589934592
--- Contents of: /sys/fs/cgroup/hugetlb.32MB.events.local ---
max 0
--- Contents of: /sys/fs/cgroup/cpu.uclamp.min ---
0.00
--- Contents of: /sys/fs/cgroup/cpuset.mems ---
--- Contents of: /sys/fs/cgroup/memory.high ---
max
--- Contents of: /sys/fs/cgroup/pids.max ---
260096
--- Contents of: /sys/fs/cgroup/memory.zswap.max ---
max
--- Contents of: /sys/fs/cgroup/misc.max ---
--- Contents of: /sys/fs/cgroup/cpuset.mems.effective ---
0
--- Contents of: /sys/fs/cgroup/cgroup.subtree_control ---
--- Contents of: /sys/fs/cgroup/io.max ---
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.events ---
max 0
--- Contents of: /sys/fs/cgroup/hugetlb.1GB.current ---
0
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.rsvd.current ---
0
--- Contents of: /sys/fs/cgroup/io.weight ---
default 100
--- Contents of: /sys/fs/cgroup/cpuset.cpus ---
--- Contents of: /sys/fs/cgroup/memory.reclaim ---
cat: /sys/fs/cgroup/memory.reclaim: Permission denied
--- Contents of: /sys/fs/cgroup/pids.peak ---
45
--- Contents of: /sys/fs/cgroup/cgroup.max.depth ---
max
--- Contents of: /sys/fs/cgroup/hugetlb.64KB.rsvd.max ---
max
--- Contents of: /sys/fs/cgroup/cgroup.pressure ---
1
--- Contents of: /sys/fs/cgroup/io.stat ---
259:1 rbytes=978944 wbytes=4236407296 rios=25 wios=91897 dbytes=0 dios=0
--- Contents of: /sys/fs/cgroup/cpu.uclamp.max ---
max
--- Contents of: /sys/fs/cgroup/hugetlb.2MB.max ---
max
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs