def test_set_device(): host = occa.host() assert host == occa.get_device() occa.set_device(mode='Serial') dev = occa.get_device() assert isinstance(dev, occa.Device) assert host != dev occa.set_device(host) dev = occa.get_device() assert isinstance(dev, occa.Device) assert host == dev
def test_set_stream(): host = occa.host() stream = host.stream assert host == occa.get_device() stream2 = host.create_stream() assert stream != stream2 occa.set_stream(stream2) assert stream != occa.get_stream()
def test_get_device(): device = occa.get_device() assert isinstance(device, occa.Device) assert device.is_initialized == True assert device.mode == 'Serial'