Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Jul 17, 2024
1 parent d613d6b commit 40c8c1c
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,25 @@

PACKAGE_NAME = "torchvision"

print("Torchvision build configuration:")
print(f"{FORCE_CUDA = }")
print(f"{FORCE_MPS = }")
print(f"{DEBUG = }")
print(f"{USE_PNG = }")
print(f"{USE_JPEG = }")
print(f"{USE_WEBP = }")
print(f"{USE_NVJPEG = }")
print(f"{NVCC_FLAGS = }")
print(f"{USE_FFMPEG = }")
print(f"{USE_VIDEO_CODEC = }")
print(f"{TORCHVISION_INCLUDE = }")
print(f"{TORCHVISION_LIBRARY = }")
print(f"{IS_ROCM = }")
print(f"{BUILD_CUDA_SOURCES = }")
def print_build_config():
# This is a function called a bunch of times in relevant places. Calling it
# just once at the top of the file isn't enough because setup.py is invoked
# multiple times even during a single build, with different entry points.
print("Torchvision build configuration:")
print(f"{FORCE_CUDA = }")
print(f"{FORCE_MPS = }")
print(f"{DEBUG = }")
print(f"{USE_PNG = }")
print(f"{USE_JPEG = }")
print(f"{USE_WEBP = }")
print(f"{USE_NVJPEG = }")
print(f"{NVCC_FLAGS = }")
print(f"{USE_FFMPEG = }")
print(f"{USE_VIDEO_CODEC = }")
print(f"{TORCHVISION_INCLUDE = }")
print(f"{TORCHVISION_LIBRARY = }")
print(f"{IS_ROCM = }")
print(f"{BUILD_CUDA_SOURCES = }")


def get_version():
Expand Down Expand Up @@ -141,6 +145,8 @@ def get_macros_and_flags():


def make_C_extension():
print("Building _C extension")
print_build_config()

sources = (
list(CSRS_DIR.glob("*.cpp"))
Expand Down Expand Up @@ -231,11 +237,7 @@ def find_library(header):

searching_for = f"Searching for {header}"

print(f"{TORCHVISION_INCLUDE = }")
print(f"{TORCHVISION_LIBRARY = }")
for folder in TORCHVISION_INCLUDE:
print(f"{folder = }")
print(f"{Path(folder) = }")
if (Path(folder) / header).exists():
print(f"{searching_for} in {Path(folder) / header}. Found in TORCHVISION_INCLUDE.")
return True, None, None
Expand Down Expand Up @@ -266,6 +268,8 @@ def find_library(header):


def make_image_extension():
print("Building image extension")
print_build_config()

include_dirs = TORCHVISION_INCLUDE
library_dirs = TORCHVISION_LIBRARY
Expand Down Expand Up @@ -351,6 +355,8 @@ def make_image_extension():


def make_video_decoders_extensions():
print("Building video decoder extensions")
print_build_config()
# Locating ffmpeg
ffmpeg_exe = shutil.which("ffmpeg")
has_ffmpeg = ffmpeg_exe is not None
Expand Down

0 comments on commit 40c8c1c

Please sign in to comment.