static string TestCopyIntsDeviceToDevice() { string testName = "TestCopyIntsDeviceToDevice"; uint arrayLen = 1000; var alist = Enumerable.Range(4, (int)arrayLen).ToArray(); var aa = new CudaArray(); IntPtr devDataA = new System.IntPtr(); IntPtr devDataB = new System.IntPtr(); var retlist = new int[(int)arrayLen]; try { var res = aa.ResetDevice(); res = res + aa.MallocIntsOnDevice(ref devDataA, arrayLen); res = res + aa.MallocIntsOnDevice(ref devDataB, arrayLen); res = res + aa.CopyIntsToDevice(alist, devDataA, arrayLen); res = res + aa.CopyIntsDeviceToDevice(devDataB, devDataA, arrayLen); res = res + aa.CopyIntsFromDevice(retlist, devDataB, arrayLen); res = res + aa.ReleaseDevicePtr(devDataA); res = res + aa.ReleaseDevicePtr(devDataB); if (!alist.SequenceEqual(retlist)) { return(testName + " fail: sequences do not match"); } if (res != String.Empty) { return(testName + " fail: " + res); } return(testName + " pass"); } catch (Exception ex) { return(testName + " exception " + ex.Message); } finally { aa.ReleaseDevicePtr(devDataA); aa.ReleaseDevicePtr(devDataB); aa.ResetDevice(); } }