Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions features/config/TEMPLATE_defaultStream.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<test driverID="test_feature" name="TEMPLATE">
<description>test</description>
<files>
<file path="feature_case/driverStreamAndEvent/defaultStream.cu" />
</files>
<rules />
</test>
54 changes: 54 additions & 0 deletions features/feature_case/driverStreamAndEvent/defaultStream.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include <iostream>
#include <cstdint>
#include <cuda_runtime.h>

struct stream_wrapper {
cudaStream_t s;
stream_wrapper() : s(0) {}
void set(cudaStream_t t) { s = t; }
void set_int(uintptr_t p) { s = (cudaStream_t) p; }
};

int main() {
stream_wrapper wr {};
int x, y;
int res = 0;
int i = 0;

auto run = [&]() {
x = -1;
y = 42;
cudaMemcpyAsync(&x, &y, sizeof(int), cudaMemcpyDefault, wr.s);
cudaStreamSynchronize(wr.s);
if (x != y) {
std::cout << "default stream fail " << i << "\n";
res = 1;
}
++i;
};

run();

wr.set(cudaStreamDefault);
run();

wr.set(cudaStreamLegacy);
run();

wr.set(cudaStreamPerThread);
run();

wr.set_int(0);
run();

cudaStream_t s;
cudaStreamCreate(&s);
wr.set_int((uintptr_t) s);
run();

if (!res) {
std::cout << "default stream success\n";
}

return res;
}
1 change: 1 addition & 0 deletions features/features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
<test testName="libcu_atomic" configFile="config/TEMPLATE_libcu.xml" />
<test testName="pointer_attributes" configFile="config/TEMPLATE_pointer_attributes.xml" />
<test testName="image" configFile="config/TEMPLATE_image.xml" />
<test testName="defaultStream" configFile="config/TEMPLATE_defaultStream.xml" />
<!-- <test testName="math_intel_specific" configFile="config/TEMPLATE_math_intel_specific.xml" splitGroup="double" /> -->
</tests>
</suite>
2 changes: 1 addition & 1 deletion features/test_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'cusolver_test1', 'cusolver_test2', 'thrust_op', 'cublas-extension', 'cublas_v1_runable', 'thrust_minmax_element',
'thrust_is_sorted', 'thrust_partition', 'thrust_remove_copy', 'thrust_unique_copy', 'thrust_transform_exclusive_scan',
'thrust_set_difference', 'thrust_set_difference_by_key', 'thrust_set_intersection_by_key', 'thrust_stable_sort',
'thrust_tabulate', 'thrust_for_each_n', 'device_info']
'thrust_tabulate', 'thrust_for_each_n', 'device_info', 'defaultStream']

def setup_test():
return True
Expand Down