Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Python eBPF profiler initialization failed #361

Open
baohongmin opened this issue May 8, 2022 · 13 comments
Open

Why Python eBPF profiler initialization failed #361

baohongmin opened this issue May 8, 2022 · 13 comments
Labels

Comments

@baohongmin
Copy link

[16:44:49] Running gprofiler (version 1.2.20), commandline: '--perf-mode=smart --python-mode=pyperf --profiling-frequency=30 --profiling-duration=30 -c -o gtest'
[16:44:49] gProfiler Python version: 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
[16:44:49] gProfiler deployment mode: standalone_executable
[16:44:49] Kernel uname release: 4.18.0-305.12.1.el8_4.x86_64
[16:44:49] Kernel uname version: #1 SMP Wed Aug 11 01:59:55 UTC 2021
[16:44:49] Total CPUs: 128
[16:44:49] Total RAM: 251.32 GB
[16:44:49] Linux distribution: CentOS Linux | 8 | n/a
[16:44:49] libc version: glibc-2.28
[16:44:49] Hostname: icx08
[16:44:55] Initialized JavaProfiler (frequency: 30hz, duration: 30s)
[16:44:56] Initialized SystemProfiler (frequency: 30hz, duration: 30s)
[16:44:56] Initialized PythonEbpfProfiler (frequency: 30hz, duration: 30s)
[16:44:56] Python eBPF profiler initialization failed

@Jongy
Copy link
Contributor

Jongy commented May 8, 2022

Hi @baohongmin , can you please run gProfiler again with -v (for verbose)? This will show the inner exception.

@baohongmin
Copy link
Author

[2022-05-08 17:20:25,541] INFO: gprofiler: Running gprofiler (version 1.2.20), commandline: '--perf-mode=smart --python-mode=pyperf --profiling-frequency=30 --profiling-duration=30 -v -c -o gtest'
[2022-05-08 17:20:25,562] DEBUG: gprofiler.utils: Running command: (ldd --version)
[2022-05-08 17:20:25,565] DEBUG: gprofiler.utils: (['ldd', '--version']) exit code: 0
[2022-05-08 17:20:25,569] INFO: gprofiler: gProfiler Python version: 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
[2022-05-08 17:20:25,569] INFO: gprofiler: gProfiler deployment mode: standalone_executable
[2022-05-08 17:20:25,569] INFO: gprofiler: Kernel uname release: 4.18.0-305.12.1.el8_4.x86_64
[2022-05-08 17:20:25,569] INFO: gprofiler: Kernel uname version: #1 SMP Wed Aug 11 01:59:55 UTC 2021
[2022-05-08 17:20:25,569] INFO: gprofiler: Total CPUs: 128
[2022-05-08 17:20:25,569] INFO: gprofiler: Total RAM: 251.32 GB
[2022-05-08 17:20:25,569] INFO: gprofiler: Linux distribution: CentOS Linux | 8 | n/a
[2022-05-08 17:20:25,569] INFO: gprofiler: libc version: glibc-2.28
[2022-05-08 17:20:25,569] INFO: gprofiler: Hostname: icx08
[2022-05-08 17:20:25,570] DEBUG: gprofiler.utils: Running command: (ldd --version)
[2022-05-08 17:20:25,573] DEBUG: gprofiler.utils: (['ldd', '--version']) exit code: 0
[2022-05-08 17:20:31,598] DEBUG: gprofiler.metadata.metadata_collector: Could not get any cloud instance metadata because of the following exceptions: (none). The most likely reason is that we're not installed on a an AWS, GCP or Azure instance.
[2022-05-08 17:20:31,599] INFO: gprofiler.profilers.profiler_base: Initialized JavaProfiler (frequency: 30hz, duration: 30s)
[2022-05-08 17:20:31,600] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf record -o /dev/null -- /bin/true)
[2022-05-08 17:20:32,740] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf', 'record', '-o', '/dev/null', '--', '/bin/true']) exit code: 0
[2022-05-08 17:20:32,740] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf', 'record', '-o', '/dev/null', '--', '/bin/true']) stderr: '[ perf record: Woken up 1 times to write data ]\n[ perf record: Captured and wrote 0.000 MB /dev/null ]\n'
[2022-05-08 17:20:32,740] DEBUG: gprofiler.profilers.java: Auto selected AP mode (ap_mode=cpu)
[2022-05-08 17:20:32,740] DEBUG: gprofiler.profilers.java: Java safemode enabled (safemode=['profiled-oom', 'profiled-signaled', 'hserr'])
[2022-05-08 17:20:32,740] INFO: gprofiler.profilers.profiler_base: Initialized SystemProfiler (frequency: 30hz, duration: 30s)
[2022-05-08 17:20:32,740] INFO: gprofiler.profilers.profiler_base: Initialized PythonEbpfProfiler (frequency: 30hz, duration: 30s)
[2022-05-08 17:20:32,742] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_fs_offset)
[2022-05-08 17:20:32,769] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_fs_offset']) exit code: 0
[2022-05-08 17:20:32,769] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_fs_offset']) stdout: '5032\n'
[2022-05-08 17:20:32,770] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_stack_offset)
[2022-05-08 17:20:32,793] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_stack_offset']) exit code: 1
[2022-05-08 17:20:32,793] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_stack_offset']) stderr: 'stack not found, searched for 16384 bytes into task_struct\n'
[2022-05-08 17:20:32,793] DEBUG: gprofiler.profilers.python: eBPF profiler error: Command '['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_stack_offset']' returned non-zero exit status 1.
stdout: b''
stderr: b'stack not found, searched for 16384 bytes into task_struct\n'
[2022-05-08 17:20:32,793] INFO: gprofiler.profilers.python: Python eBPF profiler initialization failed
[2022-05-08 17:20:32,793] INFO: gprofiler.profilers.profiler_base: Initialized RbSpyProfiler (frequency: 30hz, duration: 30s)
[2022-05-08 17:20:32,808] INFO: gprofiler.containers_client: Discovered container runtimes: ['docker']
[2022-05-08 17:20:32,809] INFO: gprofiler: gProfiler initialized and ready to start profiling
[2022-05-08 17:20:32,810] INFO: gprofiler.profilers.perf: Starting perf (fp mode)
[2022-05-08 17:20:32,810] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf record -F 30 -a -g -o /tmp/gprofiler_tmp/tmpitkzm90a/perf.fp --switch-output=signal -m 129)
[2022-05-08 17:20:32,913] INFO: gprofiler.profilers.perf: Started perf (fp mode)
[2022-05-08 17:20:32,913] INFO: gprofiler.profilers.perf: Starting perf (dwarf mode)
[2022-05-08 17:20:32,913] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf record -F 30 -a -g -o /tmp/gprofiler_tmp/tmpitkzm90a/perf.dwarf --switch-output=signal -m 257 --call-graph dwarf,8192)
[2022-05-08 17:20:33,016] INFO: gprofiler.profilers.perf: Started perf (dwarf mode)
[2022-05-08 17:20:33,017] DEBUG: gprofiler.utils: Running command: (grep -lP '^.+/libjvm.so' /proc//maps)
[2022-05-08 17:20:33,019] DEBUG: gprofiler.utils: Running command: (grep -lP '(?:^.+/ruby[^/]
$)' /proc//maps)
[2022-05-08 17:20:33,022] ERROR: gprofiler: Python profiling failed
Traceback (most recent call last):
File "gprofiler/main.py", line 267, in _snapshot
File "concurrent/futures/_base.py", line 425, in result
File "concurrent/futures/_base.py", line 384, in __get_result
File "concurrent/futures/thread.py", line 56, in run
File "gprofiler/profilers/python.py", line 581, in snapshot
AssertionError
[2022-05-08 17:20:33,038] DEBUG: gprofiler.utils: (["grep -lP '(?:^.+/ruby[^/]
$)' /proc//maps"]) exit code: 1
[2022-05-08 17:20:33,038] DEBUG: gprofiler.utils: (["grep -lP '^.+/libjvm\.so' /proc/
/maps"]) exit code: 1
[2022-05-08 17:21:03,123] DEBUG: gprofiler.profilers.perf: perf stderr: b'rounding mmap pages size to 1024K (256 pages)\n[ perf record: dump data: Woken up 1 times ]\n[ perf record: Dump /tmp/gprofiler_tmp/tmpitkzm90a/perf.fp.2022050817210310 ]\n'
[2022-05-08 17:21:03,123] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf script -F +pid -i /tmp/gprofiler_tmp/tmpitkzm90a/perf.fp.2022050817210310)
[2022-05-08 17:21:03,352] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf', 'script', '-F', '+pid', '-i', '/tmp/gprofiler_tmp/tmpitkzm90a/perf.fp.2022050817210310']) exit code: 0
[2022-05-08 17:21:03,353] DEBUG: gprofiler.profilers.perf: perf stderr: b'rounding mmap pages size to 2M (512 pages)\n[ perf record: dump data: Woken up 1 times ]\n[ perf record: Dump /tmp/gprofiler_tmp/tmpitkzm90a/perf.dwarf.2022050817210310 ]\n'
[2022-05-08 17:21:03,353] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf script -F +pid -i /tmp/gprofiler_tmp/tmpitkzm90a/perf.dwarf.2022050817210310)
[2022-05-08 17:21:03,604] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/perf', 'script', '-F', '+pid', '-i', '/tmp/gprofiler_tmp/tmpitkzm90a/perf.dwarf.2022050817210310']) exit code: 0
[2022-05-08 17:21:03,646] DEBUG: gprofiler.merge: Total FP samples: 747; Total DWARF samples: 770; FP to DWARF ratio: 0.9701298701298702; Total merged samples: 1239
[2022-05-08 17:21:03,705] INFO: gprofiler: Saved collapsed stacks to gtest/profile_2022-05-08T09:20:33.col
[2022-05-08 17:21:03,705] DEBUG: gprofiler.utils: Running command: (/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/burn convert --type=folded)
[2022-05-08 17:21:03,716] DEBUG: gprofiler.utils: (['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/burn', 'convert', '--type=folded']) exit code: 0
[2022-05-08 17:21:03,716] INFO: gprofiler: Saved flamegraph to gtest/profile_2022-05-08T09:20:33.html
[2022-05-08 17:21:03,717] DEBUG: gprofiler.utils: Running command: (grep -lP '^.+/libjvm.so' /proc//maps)
[2022-05-08 17:21:03,718] DEBUG: gprofiler.utils: Running command: (grep -lP '(?:^.+/ruby[^/]
$)' /proc//maps)
[2022-05-08 17:21:03,721] ERROR: gprofiler: Python profiling failed
Traceback (most recent call last):
File "gprofiler/main.py", line 267, in _snapshot
File "concurrent/futures/_base.py", line 425, in result
File "concurrent/futures/_base.py", line 384, in __get_result
File "concurrent/futures/thread.py", line 56, in run
File "gprofiler/profilers/python.py", line 581, in snapshot
AssertionError
[2022-05-08 17:21:03,736] DEBUG: gprofiler.utils: (["grep -lP '(?:^.+/ruby[^/]
$)' /proc//maps"]) exit code: 1
[2022-05-08 17:21:03,737] DEBUG: gprofiler.utils: (["grep -lP '^.+/libjvm\.so' /proc/
/maps"]) exit code: 1

@Jongy
Copy link
Contributor

Jongy commented May 8, 2022

Okay, I see the error here:

(['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_stack_offset']) stderr: 'stack not found, searched for 16384 bytes into task_struct\n'
[2022-05-08 17:20:32,793] DEBUG: gprofiler.profilers.python: eBPF profiler error: Command '['/proc/self/cwd/_MEI0qSxv3/gprofiler/resources/python/pyperf/get_stack_offset']' returned non-zero exit status 1.
stdout: b''
stderr: b'stack not found, searched for 16384 bytes into task_struct\n'

We use a small BPF program (see here). It scans kernel objects in runtime to find offsets needed for PyPerf to run, and it fails.

I will try running it on a kernel matching yours and fix it. Will update here on progress :)

Meanwhile, another bug that I see is that this assert self._pyspy_profiler is not None assert fails, and it should not, _pyspy_profiler should have been initialized after PyPerf fails. Will solve that as well.

If you want to continue profiling with py-spy meanwhile, you can use --python-mode pyspy.

@baohongmin
Copy link
Author

baohongmin commented May 8, 2022

Thanks, Jongy.
Looking forward to your fixing. I want to profile native python extensions written in languages like C/C++ or Cython, when I use --python-mode pyspy, pyspy can't profile native python extensions because of running without --native flag.

@Jongy
Copy link
Contributor

Jongy commented May 8, 2022

Yeah I recall your issue from benfred/py-spy#490, I will look into that as well since it is also weird.

Anyway PyPerf works great for native extensions so I hope we get PyPerf working for ya :)

@Jongy
Copy link
Contributor

Jongy commented May 8, 2022

Hmm..

centos@ip-172-31-23-179:~$ uname -r
4.18.0-305.12.1.el8_4.x86_64
centos@ip-172-31-23-179:~$ sudo ./get_stack_offset 
24
centos@ip-172-31-23-179:~$ 

Maybe it's related to the instance size? Structs may change with the number of CPUs you have. Trying again with 128 cores.

@Jongy
Copy link
Contributor

Jongy commented May 8, 2022

Very weird..

root@ip-172-31-23-179:/home/centos$ nproc
128
root@ip-172-31-23-179:/home/centos$ uname -r
4.18.0-305.12.1.el8_4.x86_64
root@ip-172-31-23-179:/home/centos$ ./get_stack_offset 
24
root@ip-172-31-23-179:/home/centos$ 

@Jongy
Copy link
Contributor

Jongy commented May 8, 2022

[2022-05-08 16:55:55,044] INFO: gprofiler: Running gprofiler (version 1.2.20), commandline: '-d 3 -o xxx -v'
...
[2022-05-08 16:55:55,055] INFO: gprofiler: Kernel uname release: 4.18.0-305.12.1.el8_4.x86_64
[2022-05-08 16:55:55,055] INFO: gprofiler: Kernel uname version: #1 SMP Wed Aug 11 01:59:55 UTC 2021
...
[2022-05-08 16:55:55,055] INFO: gprofiler: Total CPUs: 128
[2022-05-08 16:55:55,055] INFO: gprofiler: Total RAM: 247.65 GB
[2022-05-08 16:55:55,055] INFO: gprofiler: Linux distribution: CentOS Linux | 8 | Core
...
[2022-05-08 16:55:56,328] DEBUG: gprofiler.utils: Running command: (/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_fs_offset)
[2022-05-08 16:55:56,352] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_fs_offset']) exit code: 0
[2022-05-08 16:55:56,353] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_fs_offset']) stdout: '5032\n'
[2022-05-08 16:55:56,353] DEBUG: gprofiler.utils: Running command: (/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_stack_offset)
[2022-05-08 16:55:56,379] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_stack_offset']) exit code: 0
[2022-05-08 16:55:56,380] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_stack_offset']) stdout: '24\n'

@baohongmin , can you provide me with more details on the instance + operating system, so I can replicate your environment more carefully?

@baohongmin
Copy link
Author

baohongmin commented May 9, 2022

[2022-05-08 16:55:55,044] INFO: gprofiler: Running gprofiler (version 1.2.20), commandline: '-d 3 -o xxx -v'
...
[2022-05-08 16:55:55,055] INFO: gprofiler: Kernel uname release: 4.18.0-305.12.1.el8_4.x86_64
[2022-05-08 16:55:55,055] INFO: gprofiler: Kernel uname version: #1 SMP Wed Aug 11 01:59:55 UTC 2021
...
[2022-05-08 16:55:55,055] INFO: gprofiler: Total CPUs: 128
[2022-05-08 16:55:55,055] INFO: gprofiler: Total RAM: 247.65 GB
[2022-05-08 16:55:55,055] INFO: gprofiler: Linux distribution: CentOS Linux | 8 | Core
...
[2022-05-08 16:55:56,328] DEBUG: gprofiler.utils: Running command: (/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_fs_offset)
[2022-05-08 16:55:56,352] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_fs_offset']) exit code: 0
[2022-05-08 16:55:56,353] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_fs_offset']) stdout: '5032\n'
[2022-05-08 16:55:56,353] DEBUG: gprofiler.utils: Running command: (/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_stack_offset)
[2022-05-08 16:55:56,379] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_stack_offset']) exit code: 0
[2022-05-08 16:55:56,380] DEBUG: gprofiler.utils: (['/tmp/_MEIujg8ql/gprofiler/resources/python/pyperf/get_stack_offset']) stdout: '24\n'

@baohongmin , can you provide me with more details on the instance + operating system, so I can replicate your environment more carefully?

processor : 127
vendor_id : GenuineIntel
cpu family : 6
model : 106
model name : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz
stepping : 6
microcode : 0xd0002a0
cpu MHz : 1597.083
cache size : 49152 KB
physical id : 1
siblings : 64
core id : 31
cpu cores : 32
apicid : 191
initial apicid : 191
fpu : yes
fpu_exception : yes
cpuid level : 27
wp : yes
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 pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities
bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs
bogomips : 5828.73
clflush size : 64
cache_alignment : 64
address sizes : 52 bits physical, 57 bits virtual
power management:

[root@icx08]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
128 Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz
[root@icx08]# cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
2
[root@icx08]# cat /proc/cpuinfo |grep "processor"|wc -l
128
[root@icx08]# cat /proc/cpuinfo |grep "cores"|uniq
cpu cores : 32

[root@icx08]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.4.2105
Release: 8.4.2105
Codename: n/a

[root@icx08]# cat /proc/version
Linux version 4.18.0-305.12.1.el8_4.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)) #1 SMP Wed Aug 11 01:59:55 UTC 2021

[root@icx08]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-10) (GCC)

[root@icx08]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
BIOS Vendor ID: Intel(R) Corporation
CPU family: 6
Model: 106
Model name: Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz
BIOS Model name: Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz
Stepping: 6
CPU MHz: 800.113
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 5800.00
Virtualization: VT-x
L1d cache: 48K
L1i cache: 32K
L2 cache: 1280K
L3 cache: 49152K
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
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 pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities

[root@icx08 pyperf]# ./get_stack_offset
stack not found, searched for 16384 bytes into task_struct

Hi, Jongy, Is there any other information I need to provide?

@Jongy
Copy link
Contributor

Jongy commented May 9, 2022

Just verifying - per the profiler logs I understand that this isn't a cloud machine but a physical one, is that correct?

If you know to direct me where can I find this exact OS installation, I shall try to install it on a cloud machine. Otherwise I'll just search for it online.

@baohongmin
Copy link
Author

Yes, It is a physical machine.
Another physical machine run pyperf well, it's AMD.

[15:40:54] Running gprofiler (version 1.2.20), commandline: '--perf-mode=smart --python-mode=pyperf --profiling-frequency=99 --profiling-duration=30 -c -o gtest'
[15:40:54] gProfiler Python version: 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
[15:40:54] gProfiler deployment mode: standalone_executable
[15:40:54] Kernel uname release: 4.18.0-305.el8.x86_64
[15:40:54] Kernel uname version: #1 SMP Thu Apr 29 08:54:30 EDT 2021
[15:40:54] Total CPUs: 128
[15:40:54] Total RAM: 503.49 GB
[15:40:54] Linux distribution: Red Hat Enterprise Linux | 8.4 | Ootpa
[15:40:54] libc version: glibc-2.28
[15:40:54] Hostname: milan01
[15:41:00] Initialized JavaProfiler (frequency: 99hz, duration: 30s)
[15:41:01] Initialized SystemProfiler (frequency: 99hz, duration: 30s)
[15:41:01] Initialized PythonEbpfProfiler (frequency: 99hz, duration: 30s)
[15:41:03] Initialized RbSpyProfiler (frequency: 99hz, duration: 30s)
[15:41:03] Could not find a Docker daemon or CRI-compatible daemon, profiling data will not include the container names. If you do have a containers runtime and it's not supported, please open a new issue here: https://github.com/Granulate/gprofiler/issues/new
[15:41:03] gProfiler initialized and ready to start profiling
[15:41:03] Starting profiling of Python processes with PyPerf
[15:41:04] Starting perf (fp mode)
[15:41:04] Started perf (fp mode)
[15:41:04] Starting perf (dwarf mode)
[15:41:04] Started perf (dwarf mode)

[root@milan01 ]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)
[root@milan01 ]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 2
Core(s) per socket: 64
Socket(s): 1
NUMA node(s): 8
Vendor ID: AuthenticAMD
BIOS Vendor ID: Advanced Micro Devices, Inc.
CPU family: 25
Model: 1
Model name: AMD EPYC 7763 64-Core Processor
BIOS Model name: AMD EPYC 7763 64-Core Processor
Stepping: 1
CPU MHz: 2156.322
CPU max MHz: 2450.0000
CPU min MHz: 1500.0000
BogoMIPS: 4899.79
Virtualization: AMD-V
L1d cache: 32K
L1i cache: 32K
L2 cache: 512K
L3 cache: 32768K
NUMA node0 CPU(s): 0-7,64-71
NUMA node1 CPU(s): 8-15,72-79
NUMA node2 CPU(s): 16-23,80-87
NUMA node3 CPU(s): 24-31,88-95
NUMA node4 CPU(s): 32-39,96-103
NUMA node5 CPU(s): 40-47,104-111
NUMA node6 CPU(s): 48-55,112-119
NUMA node7 CPU(s): 56-63,120-127

@baohongmin
Copy link
Author

image
Hi, Jongy
I can run profiling of Python processes with PyPerf on another AMD physical machine, but gprofiler can't get the native stack of libtensorflow_framework.so. I start gprofiler on host and profile a running process running inside the docker container.

@Jongy
Copy link
Contributor

Jongy commented Jun 4, 2022

Hi @baohongmin , sorry for the long delay in responding, I lost this thread.

In this case, I am not sure if it's PyPerf or perf. PyPerf is used for Python processes, but in this case since I don't see any other Python stacks, it leads me to think that PyPerf is not being used. Native frames emitted by PyPerf should have a _[pn] suffix, and the frames you display here don't here it.

So, one problem is PyPerf not being used. Most likely, PyPerf fails to profile those processes, and thus the perf stacks for those PIDs are taken. Please provide the log of gProfiler and I'll be able to further debug it.

As for perf failing to retrieve symbols - please try running gProfiler with --perf-mode=smart. It runs perf also in DWARF mode, which might contain additional debugging & symbolication info.

@Jongy Jongy added the question label Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants