sync up May15 2023
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Copyright 2021 by Contributors
|
||||
/**
|
||||
* Copyright 2021-2023, XGBoost Contributors
|
||||
*/
|
||||
#include <gtest/gtest.h>
|
||||
#include <xgboost/host_device_vector.h>
|
||||
@@ -22,31 +22,19 @@ TEST(ArrayInterface, Stream) {
|
||||
HostDeviceVector<float> storage;
|
||||
auto arr_str = RandomDataGenerator{kRows, kCols, 0}.GenerateArrayInterface(&storage);
|
||||
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
cudaStream_t stream;
|
||||
cudaStreamCreate(&stream);
|
||||
#elif defined(XGBOOST_USE_HIP)
|
||||
hipStream_t stream;
|
||||
hipStreamCreate(&stream);
|
||||
#endif
|
||||
dh::CUDAStream stream;
|
||||
|
||||
auto j_arr =Json::Load(StringView{arr_str});
|
||||
j_arr["stream"] = Integer(reinterpret_cast<int64_t>(stream));
|
||||
auto j_arr = Json::Load(StringView{arr_str});
|
||||
j_arr["stream"] = Integer(reinterpret_cast<int64_t>(stream.Handle()));
|
||||
Json::Dump(j_arr, &arr_str);
|
||||
|
||||
dh::caching_device_vector<uint64_t> out(1, 0);
|
||||
uint64_t dur = 1e9;
|
||||
dh::LaunchKernel{1, 1, 0, stream}(SleepForTest, out.data().get(), dur);
|
||||
std::uint64_t dur = 1e9;
|
||||
dh::LaunchKernel{1, 1, 0, stream.View()}(SleepForTest, out.data().get(), dur);
|
||||
ArrayInterface<2> arr(arr_str);
|
||||
|
||||
auto t = out[0];
|
||||
CHECK_GE(t, dur);
|
||||
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
cudaStreamDestroy(stream);
|
||||
#elif defined(XGBOOST_USE_HIP)
|
||||
hipStreamDestroy(stream);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(ArrayInterface, Ptr) {
|
||||
|
||||
Reference in New Issue
Block a user