def test_to_device_to_host(self): """ Tests .to_device() and .copy_to_host() """ n = 10 data = np.zeros(n) output = np.zeros(n) @vectorize("float64(float64)", target='roc') def func(x): return x + 1 hsaapi.to_device(data) out_device = hsaapi.to_device(output) func(data, out=out_device) host_output = out_device.copy_to_host() np.testing.assert_equal(np.ones(n), host_output)
def test_to_device_to_host(self): """ Tests .to_device() and .copy_to_host() """ n = 10 data = np.zeros(n) output = np.zeros(n) @vectorize("float64(float64)", target='roc') def func(x): return x + 1 hsaapi.to_device(data) out_device = hsaapi.to_device(output) func(data, out=out_device) host_output = out_device.copy_to_host() np.testing.assert_equal(np.ones(n), host_output)
def to_device(self, hostary): if dgpu_present: return api.to_device(hostary) else: return hostary
def to_device(self, hostary, stream): if dgpu_present: return api.to_device(hostary) else: return hostary