mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Cuda updates
Summary: Updates to: - enable cuda kernel launches on any GPU (not just the default) - cuda and contiguous checks for all kernels - checks to ensure all tensors are on the same device - error reporting in the cuda kernels - cuda tests now run on a random device not just the default Reviewed By: jcjohnson, gkioxari Differential Revision: D21215280 fbshipit-source-id: 1bedc9fe6c35e9e920bdc4d78ed12865b1005519
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c9267ab7af
commit
c3d636dc8c
@@ -3,7 +3,7 @@
|
||||
import unittest
|
||||
|
||||
import torch
|
||||
from common_testing import TestCaseMixin
|
||||
from common_testing import TestCaseMixin, get_random_cuda_device
|
||||
from pytorch3d.ops import packed_to_padded, padded_to_packed
|
||||
from pytorch3d.structures.meshes import Meshes
|
||||
|
||||
@@ -126,13 +126,16 @@ class TestPackedToPadded(TestCaseMixin, unittest.TestCase):
|
||||
self._test_packed_to_padded_helper(16, "cpu")
|
||||
|
||||
def test_packed_to_padded_flat_cuda(self):
|
||||
self._test_packed_to_padded_helper(0, "cuda:0")
|
||||
device = get_random_cuda_device()
|
||||
self._test_packed_to_padded_helper(0, device)
|
||||
|
||||
def test_packed_to_padded_D1_cuda(self):
|
||||
self._test_packed_to_padded_helper(1, "cuda:0")
|
||||
device = get_random_cuda_device()
|
||||
self._test_packed_to_padded_helper(1, device)
|
||||
|
||||
def test_packed_to_padded_D16_cuda(self):
|
||||
self._test_packed_to_padded_helper(16, "cuda:0")
|
||||
device = get_random_cuda_device()
|
||||
self._test_packed_to_padded_helper(16, device)
|
||||
|
||||
def _test_padded_to_packed_helper(self, D, device):
|
||||
"""
|
||||
@@ -191,13 +194,16 @@ class TestPackedToPadded(TestCaseMixin, unittest.TestCase):
|
||||
self._test_padded_to_packed_helper(16, "cpu")
|
||||
|
||||
def test_padded_to_packed_flat_cuda(self):
|
||||
self._test_padded_to_packed_helper(0, "cuda:0")
|
||||
device = get_random_cuda_device()
|
||||
self._test_padded_to_packed_helper(0, device)
|
||||
|
||||
def test_padded_to_packed_D1_cuda(self):
|
||||
self._test_padded_to_packed_helper(1, "cuda:0")
|
||||
device = get_random_cuda_device()
|
||||
self._test_padded_to_packed_helper(1, device)
|
||||
|
||||
def test_padded_to_packed_D16_cuda(self):
|
||||
self._test_padded_to_packed_helper(16, "cuda:0")
|
||||
device = get_random_cuda_device()
|
||||
self._test_padded_to_packed_helper(16, device)
|
||||
|
||||
def test_invalid_inputs_shapes(self, device="cuda:0"):
|
||||
with self.assertRaisesRegex(ValueError, "input can only be 2-dimensional."):
|
||||
|
||||
Reference in New Issue
Block a user