Skip to content

Commit 91ca46c

Browse files
Try to make the test work on all runners
1 parent 35528d0 commit 91ca46c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sycl/test-e2e/KernelCompiler/multi_threaded_persistent_auto_pch.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
using namespace std::string_view_literals;
2020
namespace syclexp = sycl::ext::oneapi::experimental;
2121
int main() {
22-
std::error_code ec; // For noexcept overload.
23-
std::filesystem::remove_all(PCH_DIR, ec);
2422
sycl::queue q;
2523
constexpr int N = 16;
2624
std::chrono::duration<double, std::milli> durations[N];
@@ -61,6 +59,14 @@ void iota(float start, float *ptr) {
6159

6260
std::thread threads[N];
6361

62+
std::error_code ec; // For noexcept overload.
63+
std::filesystem::remove_all(PCH_DIR, ec);
64+
Run(0);
65+
std::filesystem::remove_all(PCH_DIR, ec);
66+
auto sleep_duration = durations[0] / 5;
67+
std::cout << "Selected sleep duration is " << sleep_duration.count() << "ms"
68+
<< std::endl;
69+
6470
int removed_iter = -1;
6571
for (int i = 0; i < N; ++i) {
6672
if (compile_finished[N / 2].load() && removed_iter == -1) {
@@ -70,7 +76,7 @@ void iota(float start, float *ptr) {
7076

7177
threads[i] = std::thread{Run, i};
7278
using namespace std::chrono_literals;
73-
std::this_thread::sleep_for(100ms);
79+
std::this_thread::sleep_for(sleep_duration);
7480
}
7581

7682
for (auto &t : threads)
@@ -102,14 +108,10 @@ void iota(float start, float *ptr) {
102108
}
103109

104110
if (removed_iter == -1) {
105-
std::cout << "Removal has not been tested, adjust N" << std::endl;
111+
std::cout << "Removal has not been tested, adjust sleep_duration and/or N."
112+
<< std::endl;
106113
return 1;
107114
}
108115

109-
if (removed_iter == 0) {
110-
std::cout << "Sleep is too long" << std::endl;
111-
return 2;
112-
}
113-
114116
return 0;
115117
}

0 commit comments

Comments
 (0)