def __init__(self, device=None): if device is None: self.id = runtime.getDevice() else: self.id = int(device) self._device_stack = []
import pytest import unittest import numpy import cupy from cupy import testing from cupy.cuda import runtime from cupy.cuda.texture import (ChannelFormatDescriptor, CUDAarray, ResourceDescriptor, TextureDescriptor, TextureObject, TextureReference, SurfaceObject) if cupy.cuda.runtime.is_hip: pytest.skip('HIP texture support is not yet ready', allow_module_level=True) dev = cupy.cuda.Device(runtime.getDevice()) @testing.gpu @testing.parameterize(*testing.product({ 'xp': ('numpy', 'cupy'), 'stream': (True, False), 'dimensions': ((67, 0, 0), (67, 19, 0), (67, 19, 31)), 'n_channels': (1, 2, 4), 'dtype': (numpy.float16, numpy.float32, numpy.int8, numpy.int16, numpy.int32, numpy.uint8, numpy.uint16, numpy.uint32), })) class TestCUDAarray(unittest.TestCase): def test_array_gen_cpy(self): xp = numpy if self.xp == 'numpy' else cupy stream = None if not self.stream else cupy.cuda.Stream()