Skip to content

Commit 232e4a7

Browse files
bottlerfacebook-github-bot
authored andcommitted
Driver update for ci, easier diagnosing
Summary: Bump the nvidia driver used in the conda tests. Add an environment variable (unused) to allow building without ninja. Print relative error on assertClose failure. Reviewed By: nikhilaravi Differential Revision: D21227373 fbshipit-source-id: 5dd8eb097151da27d3632daa755a1e7b9ac97845
1 parent 0cfa6a1 commit 232e4a7

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

.circleci/config.in.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION}
158158
sudo systemctl restart docker
159159
160-
DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run"
160+
DRIVER_FN="NVIDIA-Linux-x86_64-440.59.run"
161161
wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
162162
sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
163163
nvidia-smi

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION}
158158
sudo systemctl restart docker
159159
160-
DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run"
160+
DRIVER_FN="NVIDIA-Linux-x86_64-440.59.run"
161161
wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
162162
sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
163163
nvidia-smi

pytorch3d/io/mtl_io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def make_mesh_texture_atlas(
6262
# the convention GL_REPEAT in OpenGL i.e the integer part of the coordinate
6363
# will be ignored and a repeating pattern is formed.
6464
# Shapenet data uses this format see:
65-
# https://shapenet.org/qaforum/index.php?qa=15&qa_1=why-is-the-texture-coordinate-in-the-obj-file-not-in-the-range
65+
# https://shapenet.org/qaforum/index.php?qa=15&qa_1=why-is-the-texture-coordinate-in-the-obj-file-not-in-the-range # noqa: B950
6666
if (faces_verts_uvs > 1).any() or (faces_verts_uvs < 0).any():
6767
msg = "Texture UV coordinates outside the range [0, 1]. \
6868
The integer part will be ignored to form a repeating pattern."

setup.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ def get_extensions():
7272
with open("pytorch3d/__init__.py", "r") as init:
7373
exec(init.read())
7474

75+
76+
if os.getenv("PYTORCH3D_NO_NINJA", "0") == "1":
77+
78+
class BuildExtension(torch.utils.cpp_extension.BuildExtension):
79+
def __init__(self, *args, **kwargs):
80+
super().__init__(use_ninja=False, *args, **kwargs)
81+
82+
83+
else:
84+
BuildExtension = torch.utils.cpp_extension.BuildExtension
85+
86+
7587
setup(
7688
name="pytorch3d",
7789
version=__version__,
@@ -86,5 +98,5 @@ def get_extensions():
8698
"dev": ["flake8", "isort", "black==19.3b0"],
8799
},
88100
ext_modules=get_extensions(),
89-
cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
101+
cmdclass={"build_ext": BuildExtension},
90102
)

tests/common_testing.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,19 @@ def assertClose(
138138
)
139139

140140
if not close and msg is None:
141-
max_diff = backend.abs(input - other).max()
142-
self.fail(f"Not close. max diff {max_diff}.")
141+
diff = backend.abs(input - other) + 0.0
142+
ratio = diff / backend.abs(other)
143+
try_relative = (diff <= atol) | (backend.isfinite(ratio) & (ratio > 0))
144+
if try_relative.all():
145+
if backend == np:
146+
# Avoid a weirdness with zero dimensional arrays.
147+
ratio = np.array(ratio)
148+
ratio[diff <= atol] = 0
149+
extra = f" Max relative diff {ratio.max()}"
150+
else:
151+
extra = ""
152+
shape = tuple(input.shape)
153+
max_diff = diff.max()
154+
self.fail(f"Not close. Max diff {max_diff}.{extra} Shape {shape}.")
143155

144156
self.assertTrue(close, msg)

0 commit comments

Comments
 (0)