YUNTA88 commited on
Commit
9bbaaf8
·
verified ·
1 Parent(s): af23746

Upload root_scripts/diag_abi.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. root_scripts/diag_abi.sh +37 -0
root_scripts/diag_abi.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ python3 << 'PYEOF'
3
+ import torch
4
+ print(f"torch version: {torch.__version__}")
5
+ print(f"CXX11_ABI: {torch._C._GLIBCXX_USE_CXX11_ABI}")
6
+
7
+ # Check what symbols torch provides
8
+ import subprocess
9
+ # Check the symbol in torch
10
+ result = subprocess.run(
11
+ ["nm", "-D", torch.__file__.replace("__init__.py", "_C.cpython-311-x86_64-linux-gnu.so")],
12
+ capture_output=True, text=True
13
+ )
14
+ # Look for c10_cuda_check
15
+ matches = [l for l in result.stdout.split("\n") if "c10_cuda_check" in l]
16
+ print(f"torch c10_cuda_check symbols: {len(matches)}")
17
+ for m in matches[:5]:
18
+ print(f" {m}")
19
+
20
+ # Check flash_attn .so
21
+ import os
22
+ so_path = "/opt/conda/lib/python3.11/site-packages/flash_attn_2_cuda.cpython-311-x86_64-linux-gnu.so"
23
+ if os.path.exists(so_path):
24
+ result2 = subprocess.run(["nm", "-D", so_path], capture_output=True, text=True)
25
+ undef = [l for l in result2.stdout.split("\n") if "c10_cuda_check" in l]
26
+ print(f"\nflash_attn .so c10_cuda_check symbols: {len(undef)}")
27
+ for m in undef[:5]:
28
+ print(f" {m}")
29
+
30
+ # Check CXX11 ABI indicator in the .so
31
+ abi_check = subprocess.run(["strings", so_path], capture_output=True, text=True)
32
+ # Look for ABI tag
33
+ for line in abi_check.stdout.split("\n"):
34
+ if "cxx11abi" in line.lower() or "GLIBCXX" in line:
35
+ print(f"SO ABI marker: {line}")
36
+ PYEOF
37
+