Created
June 5, 2024 21:04
-
-
Save malfet/256da1ae0f35c837953e779de1213e82 to your computer and use it in GitHub Desktop.
Print shared libraries loaded by PyTorch on MacOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import cdll, c_char_p, c_uint32 | |
libdyld = cdll.LoadLibrary("libSystem.dylib") | |
libdyld._dyld_image_count.restype = c_uint32 | |
libdyld._dyld_get_image_name.restype = c_char_p | |
libdyld._dyld_get_image_name.argtypes = [c_uint32] | |
before_torch = {libdyld._dyld_get_image_name(i).decode("ascii") for i in range(libdyld._dyld_image_count())} | |
import torch | |
after_torch = {libdyld._dyld_get_image_name(i).decode("ascii") for i in range(libdyld._dyld_image_count())} | |
for lib in after_torch.difference(before_torch): | |
print(lib) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment