Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 512272c

Browse files
authored
Merge pull request #1776 from allisonvacanti/cdp_for_each_fix_backport
Move sync from for_each to parallel_for to fix CDP usages [2.0.X backport]
2 parents d6e9274 + 1e6fb36 commit 512272c

File tree

8 files changed

+3
-41
lines changed

8 files changed

+3
-41
lines changed

thrust/system/cuda/detail/fill.h

-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ fill_n(execution_policy<Derived>& policy,
7171
value),
7272
count);
7373

74-
cuda_cub::throw_on_error(
75-
cuda_cub::synchronize_optional(policy)
76-
, "fill_n: failed to synchronize"
77-
);
78-
7974
return first + count;
8075
} // func fill_n
8176

thrust/system/cuda/detail/for_each.h

-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ namespace cuda_cub {
8181
for_each_f<Input, wrapped_t>(first, wrapped_op),
8282
count);
8383

84-
cuda_cub::throw_on_error(
85-
cuda_cub::synchronize_optional(policy)
86-
, "for_each: failed to synchronize"
87-
);
88-
8984
return first + count;
9085
}
9186

thrust/system/cuda/detail/parallel_for.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ parallel_for(execution_policy<Derived> &policy,
161161
THRUST_CDP_DISPATCH(
162162
(cudaStream_t stream = cuda_cub::stream(policy);
163163
cudaError_t status = __parallel_for::parallel_for(count, f, stream);
164-
cuda_cub::throw_on_error(status, "parallel_for failed");),
164+
cuda_cub::throw_on_error(status, "parallel_for failed");
165+
status = cuda_cub::synchronize_optional(policy);
166+
cuda_cub::throw_on_error(status, "parallel_for: failed to synchronize");),
165167
// CDP sequential impl:
166168
(for (Size idx = 0; idx != count; ++idx)
167169
{

thrust/system/cuda/detail/swap_ranges.h

-5
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ swap_ranges(execution_policy<Derived> &policy,
9292
ItemsIt2>(first1, first2),
9393
num_items);
9494

95-
cuda_cub::throw_on_error(
96-
cuda_cub::synchronize_optional(policy)
97-
, "swap_ranges: failed to synchronize"
98-
);
99-
10095
return first2 + num_items;
10196
}
10297

thrust/system/cuda/detail/tabulate.h

-5
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ tabulate(execution_policy<Derived>& policy,
7676
cuda_cub::parallel_for(policy,
7777
functor_t(first, tabulate_op),
7878
count);
79-
80-
cuda_cub::throw_on_error(
81-
cuda_cub::synchronize_optional(policy)
82-
, "tabulate: failed to synchronize"
83-
);
8479
}
8580

8681
} // namespace cuda_cub

thrust/system/cuda/detail/transform.h

-10
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,6 @@ namespace __transform {
232232
predicate),
233233
num_items);
234234

235-
cuda_cub::throw_on_error(
236-
cuda_cub::synchronize_optional(policy)
237-
, "transform: failed to synchronize"
238-
);
239-
240235
return result + num_items;
241236
}
242237

@@ -278,11 +273,6 @@ namespace __transform {
278273
predicate),
279274
num_items);
280275

281-
cuda_cub::throw_on_error(
282-
cuda_cub::synchronize_optional(policy)
283-
, "transform: failed to synchronize"
284-
);
285-
286276
return result + num_items;
287277
}
288278

thrust/system/cuda/detail/uninitialized_copy.h

-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ uninitialized_copy_n(execution_policy<Derived> &policy,
8787
functor_t(first, result),
8888
count);
8989

90-
cuda_cub::throw_on_error(
91-
cuda_cub::synchronize_optional(policy)
92-
, "uninitialized_copy_n: failed to synchronize"
93-
);
94-
9590
return result + count;
9691
}
9792

thrust/system/cuda/detail/uninitialized_fill.h

-5
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ uninitialized_fill_n(execution_policy<Derived>& policy,
8585
functor_t(first, x),
8686
count);
8787

88-
cuda_cub::throw_on_error(
89-
cuda_cub::synchronize_optional(policy)
90-
, "uninitialized_fill_n: failed to synchronize"
91-
);
92-
9388
return first + count;
9489
}
9590

0 commit comments

Comments
 (0)