mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									0cfa6a122b
								
							
						
					
					
						commit
						232e4a7e3d
					
				@ -157,7 +157,7 @@ jobs:
 | 
			
		||||
          sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION}
 | 
			
		||||
          sudo systemctl restart docker
 | 
			
		||||
 | 
			
		||||
          DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run"
 | 
			
		||||
          DRIVER_FN="NVIDIA-Linux-x86_64-440.59.run"
 | 
			
		||||
          wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
 | 
			
		||||
          sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
 | 
			
		||||
          nvidia-smi
 | 
			
		||||
 | 
			
		||||
@ -157,7 +157,7 @@ jobs:
 | 
			
		||||
          sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION}
 | 
			
		||||
          sudo systemctl restart docker
 | 
			
		||||
 | 
			
		||||
          DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run"
 | 
			
		||||
          DRIVER_FN="NVIDIA-Linux-x86_64-440.59.run"
 | 
			
		||||
          wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
 | 
			
		||||
          sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
 | 
			
		||||
          nvidia-smi
 | 
			
		||||
 | 
			
		||||
@ -62,7 +62,7 @@ def make_mesh_texture_atlas(
 | 
			
		||||
        # the convention GL_REPEAT in OpenGL i.e the integer part of the coordinate
 | 
			
		||||
        # will be ignored and a repeating pattern is formed.
 | 
			
		||||
        # Shapenet data uses this format see:
 | 
			
		||||
        # https://shapenet.org/qaforum/index.php?qa=15&qa_1=why-is-the-texture-coordinate-in-the-obj-file-not-in-the-range
 | 
			
		||||
        # 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
 | 
			
		||||
        if (faces_verts_uvs > 1).any() or (faces_verts_uvs < 0).any():
 | 
			
		||||
            msg = "Texture UV coordinates outside the range [0, 1]. \
 | 
			
		||||
                The integer part will be ignored to form a repeating pattern."
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								setup.py
									
									
									
									
									
								
							@ -72,6 +72,18 @@ __version__ = ""
 | 
			
		||||
with open("pytorch3d/__init__.py", "r") as init:
 | 
			
		||||
    exec(init.read())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if os.getenv("PYTORCH3D_NO_NINJA", "0") == "1":
 | 
			
		||||
 | 
			
		||||
    class BuildExtension(torch.utils.cpp_extension.BuildExtension):
 | 
			
		||||
        def __init__(self, *args, **kwargs):
 | 
			
		||||
            super().__init__(use_ninja=False, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
else:
 | 
			
		||||
    BuildExtension = torch.utils.cpp_extension.BuildExtension
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
setup(
 | 
			
		||||
    name="pytorch3d",
 | 
			
		||||
    version=__version__,
 | 
			
		||||
@ -86,5 +98,5 @@ setup(
 | 
			
		||||
        "dev": ["flake8", "isort", "black==19.3b0"],
 | 
			
		||||
    },
 | 
			
		||||
    ext_modules=get_extensions(),
 | 
			
		||||
    cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
 | 
			
		||||
    cmdclass={"build_ext": BuildExtension},
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -138,7 +138,19 @@ class TestCaseMixin(unittest.TestCase):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        if not close and msg is None:
 | 
			
		||||
            max_diff = backend.abs(input - other).max()
 | 
			
		||||
            self.fail(f"Not close. max diff {max_diff}.")
 | 
			
		||||
            diff = backend.abs(input - other) + 0.0
 | 
			
		||||
            ratio = diff / backend.abs(other)
 | 
			
		||||
            try_relative = (diff <= atol) | (backend.isfinite(ratio) & (ratio > 0))
 | 
			
		||||
            if try_relative.all():
 | 
			
		||||
                if backend == np:
 | 
			
		||||
                    # Avoid a weirdness with zero dimensional arrays.
 | 
			
		||||
                    ratio = np.array(ratio)
 | 
			
		||||
                ratio[diff <= atol] = 0
 | 
			
		||||
                extra = f" Max relative diff {ratio.max()}"
 | 
			
		||||
            else:
 | 
			
		||||
                extra = ""
 | 
			
		||||
            shape = tuple(input.shape)
 | 
			
		||||
            max_diff = diff.max()
 | 
			
		||||
            self.fail(f"Not close. Max diff {max_diff}.{extra} Shape {shape}.")
 | 
			
		||||
 | 
			
		||||
        self.assertTrue(close, msg)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user