| python3 << 'PYEOF' | |
| import torch | |
| print(f"torch version: {torch.__version__}") | |
| print(f"CXX11_ABI: {torch._C._GLIBCXX_USE_CXX11_ABI}") | |
| # Check what symbols torch provides | |
| import subprocess | |
| # Check the symbol in torch | |
| result = subprocess.run( | |
| ["nm", "-D", torch.__file__.replace("__init__.py", "_C.cpython-311-x86_64-linux-gnu.so")], | |
| capture_output=True, text=True | |
| ) | |
| # Look for c10_cuda_check | |
| matches = [l for l in result.stdout.split("\n") if "c10_cuda_check" in l] | |
| print(f"torch c10_cuda_check symbols: {len(matches)}") | |
| for m in matches[:5]: | |
| print(f" {m}") | |
| # Check flash_attn .so | |
| import os | |
| so_path = "/opt/conda/lib/python3.11/site-packages/flash_attn_2_cuda.cpython-311-x86_64-linux-gnu.so" | |
| if os.path.exists(so_path): | |
| result2 = subprocess.run(["nm", "-D", so_path], capture_output=True, text=True) | |
| undef = [l for l in result2.stdout.split("\n") if "c10_cuda_check" in l] | |
| print(f"\nflash_attn .so c10_cuda_check symbols: {len(undef)}") | |
| for m in undef[:5]: | |
| print(f" {m}") | |
| # Check CXX11 ABI indicator in the .so | |
| abi_check = subprocess.run(["strings", so_path], capture_output=True, text=True) | |
| # Look for ABI tag | |
| for line in abi_check.stdout.split("\n"): | |
| if "cxx11abi" in line.lower() or "GLIBCXX" in line: | |
| print(f"SO ABI marker: {line}") | |
| PYEOF | |