Closed DylanWangWQF closed 2 years ago
Hi @jlwatson , When I test the timing results for copying data from device to host, I got the different results as shown:
First test to print uint64_t in DeviceData
uint64_t
# util.cuh template<typename T, typename I> void printDeviceDataForInteger(DeviceData<T, I> &device_data) { std::vector<uint64_t> host_temp(device_data.size()); thrust::copy(device_data.begin(), device_data.end(), host_temp.begin()); for (int i = 0; i < host_temp.size(); i++) { printf("%lld ", host_temp[i]); } std::cout << std::endl; } # DeviceData.cu TYPED_TEST(DeviceDataTest, IntegerDeviceData) { using T = typename TestFixture::ParamType; DeviceData<T> d1 = {1, 2, 3}; DeviceData<T> d2 = {1, 1, 1}; d1 += d2; printDeviceDataForInteger(d1); }
The result is around 32538ms
32538ms
The second test is the original DRELU2 test in piranha:
TYPED_TEST(FuncTest, DRELU2) { ....omit..... //Change to <uint8_t> DeviceData<uint64_t> super_result(result.size()); reconstruct(result, super_result); printDeviceData(super_result, "actual", false); assertDeviceData(super_result, expected, false); }
while the result is around 13ms as shown:
13ms
[ RUN ] FuncTest/1.DRELU2 actual: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 src/test/../mpc/../gpu/../util/util.cuh:343: Failure Expected: (fabs(host_result[i] - expected[i])) <= (epsilon), actual: 1 vs 0.001 [ FAILED ] FuncTest/1.DRELU2, where TypeParam = TPC<unsigned long, thrust::detail::normal_iterator<thrust::device_ptr<unsigned long> > > (13 ms)
What's the reason for these two different timing results?
The result is expected when I change the order of invoking each unit test. Maybe it's due to gtest.
Hi @jlwatson , When I test the timing results for copying data from device to host, I got the different results as shown:
First test to print
uint64_t
in DeviceDataThe result is around
32538ms
The second test is the original DRELU2 test in piranha:
while the result is around
13ms
as shown:What's the reason for these two different timing results?