def ensure_supported_ccs_initialized(): from numba.cuda import is_available as cuda_is_available from numba.cuda.cudadrv import nvvm if cuda_is_available(): # Ensure that cudart.so is loaded and the list of supported compute # capabilities in the nvvm module is populated before a fork. This is # needed because some compilation tests don't require a CUDA context, # but do use NVVM, and it is required that libcudart.so should be # loaded before a fork (note that the requirement is not explicitly # documented). nvvm.get_supported_ccs()
def test_get_arch_option(self): # Test returning the nearest lowest arch. self.assertEqual(get_arch_option(5, 0), 'compute_50') self.assertEqual(get_arch_option(5, 1), 'compute_50') self.assertEqual(get_arch_option(3, 7), 'compute_35') # Test known arch. supported_cc = get_supported_ccs() for arch in supported_cc: self.assertEqual(get_arch_option(*arch), 'compute_%d%d' % arch) self.assertEqual(get_arch_option(1000, 0), 'compute_%d%d' % supported_cc[-1])
def test_nvvm_support(self): """Test supported CC by NVVM """ for arch in get_supported_ccs(): self._test_nvvm_support(arch=arch)