Skip to content

Commit 8174758

Browse files
authored
Merge pull request #4209 from msimberg/fix-cuda-10
Fix CUDA 10 build
2 parents 96c989b + 435f935 commit 8174758

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

libs/algorithms/include/hpx/parallel/util/detail/handle_local_exceptions.hpp

+41
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define HPX_PARALLEL_UTIL_DETAIL_HANDLE_LOCAL_EXCEPTIONS_OCT_03_2014_0142PM
1111

1212
#include <hpx/config.hpp>
13+
#include <hpx/assertion.hpp>
1314
#include <hpx/async.hpp>
1415
#include <hpx/errors.hpp>
1516
#include <hpx/hpx_finalize.hpp>
@@ -30,6 +31,9 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
3031
// std::bad_alloc has to be handled separately
3132
HPX_NORETURN static void call(std::exception_ptr const& e)
3233
{
34+
#if defined(HPX_COMPUTE_DEVICE_CODE)
35+
HPX_ASSERT(false);
36+
#else
3337
try
3438
{
3539
std::rethrow_exception(e);
@@ -42,11 +46,15 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
4246
{
4347
throw exception_list(e);
4448
}
49+
#endif
4550
}
4651

4752
static void call(
4853
std::exception_ptr const& e, std::list<std::exception_ptr>& errors)
4954
{
55+
#if defined(HPX_COMPUTE_DEVICE_CODE)
56+
HPX_ASSERT(false);
57+
#else
5058
try
5159
{
5260
std::rethrow_exception(e);
@@ -59,12 +67,16 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
5967
{
6068
errors.push_back(e);
6169
}
70+
#endif
6271
}
6372

6473
template <typename T>
6574
static void call(std::vector<hpx::future<T>> const& workitems,
6675
std::list<std::exception_ptr>& errors, bool throw_errors = true)
6776
{
77+
#if defined(HPX_COMPUTE_DEVICE_CODE)
78+
HPX_ASSERT(false);
79+
#else
6880
for (hpx::future<T> const& f : workitems)
6981
{
7082
if (f.has_exception())
@@ -73,13 +85,17 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
7385

7486
if (throw_errors && !errors.empty())
7587
throw exception_list(std::move(errors));
88+
#endif
7689
}
7790

7891
///////////////////////////////////////////////////////////////////////
7992
template <typename T>
8093
static void call(std::vector<hpx::shared_future<T>> const& workitems,
8194
std::list<std::exception_ptr>& errors, bool throw_errors = true)
8295
{
96+
#if defined(HPX_COMPUTE_DEVICE_CODE)
97+
HPX_ASSERT(false);
98+
#else
8399
for (hpx::shared_future<T> const& f : workitems)
84100
{
85101
if (f.has_exception())
@@ -88,13 +104,17 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
88104

89105
if (throw_errors && !errors.empty())
90106
throw exception_list(std::move(errors));
107+
#endif
91108
}
92109

93110
template <typename T, typename Cleanup>
94111
static void call(std::vector<hpx::future<T>>& workitems,
95112
std::list<std::exception_ptr>& errors, Cleanup&& cleanup,
96113
bool throw_errors = true)
97114
{
115+
#if defined(HPX_COMPUTE_DEVICE_CODE)
116+
HPX_ASSERT(false);
117+
#else
98118
bool has_exception = false;
99119
std::exception_ptr bad_alloc_exception;
100120
for (hpx::future<T>& f : workitems)
@@ -135,6 +155,7 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
135155

136156
if (throw_errors && !errors.empty())
137157
throw exception_list(std::move(errors));
158+
#endif
138159
}
139160
};
140161

@@ -144,46 +165,66 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
144165
///////////////////////////////////////////////////////////////////////
145166
HPX_NORETURN static void call(std::exception_ptr const&)
146167
{
168+
#if defined(HPX_COMPUTE_DEVICE_CODE)
169+
HPX_ASSERT(false);
170+
#else
147171
hpx::terminate();
172+
#endif
148173
}
149174

150175
HPX_NORETURN static void call(
151176
std::exception_ptr const&, std::list<std::exception_ptr>&)
152177
{
178+
#if defined(HPX_COMPUTE_DEVICE_CODE)
179+
HPX_ASSERT(false);
180+
#else
153181
hpx::terminate();
182+
#endif
154183
}
155184

156185
template <typename T>
157186
static void call(std::vector<hpx::future<T>> const& workitems,
158187
std::list<std::exception_ptr>&, bool = true)
159188
{
189+
#if defined(HPX_COMPUTE_DEVICE_CODE)
190+
HPX_ASSERT(false);
191+
#else
160192
for (hpx::future<T> const& f : workitems)
161193
{
162194
if (f.has_exception())
163195
hpx::terminate();
164196
}
197+
#endif
165198
}
166199

167200
template <typename T>
168201
static void call(std::vector<hpx::shared_future<T>> const& workitems,
169202
std::list<std::exception_ptr>&, bool = true)
170203
{
204+
#if defined(HPX_COMPUTE_DEVICE_CODE)
205+
HPX_ASSERT(false);
206+
#else
171207
for (hpx::shared_future<T> const& f : workitems)
172208
{
173209
if (f.has_exception())
174210
hpx::terminate();
175211
}
212+
#endif
176213
}
177214

178215
template <typename T, typename Cleanup>
179216
static void call(std::vector<hpx::future<T>> const& workitems,
180217
std::list<std::exception_ptr>&, Cleanup&&, bool = true)
181218
{
219+
#if defined(HPX_COMPUTE_DEVICE_CODE)
220+
HPX_ASSERT(false);
221+
#else
182222
for (hpx::future<T> const& f : workitems)
183223
{
184224
if (f.has_exception())
185225
hpx::terminate();
186226
}
227+
#endif
187228
}
188229
};
189230
}}}} // namespace hpx::parallel::util::detail

libs/assertion/include/hpx/assertion.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// Make HPX inspect tool happy:
88
// hpxinspect:noinclude:HPX_ASSERT
99
// hpxinspect:noinclude:HPX_ASSERT_MSG
10+
// hpxinspect:noassert_macro
1011

1112
// Note: There are no include guards. This is intentional.
1213

@@ -16,6 +17,9 @@
1617
#include <hpx/assertion/source_location.hpp>
1718
#include <hpx/preprocessor/stringize.hpp>
1819

20+
#if defined(HPX_COMPUTE_DEVICE_CODE)
21+
#include <assert.h>
22+
#endif
1923
#include <string>
2024
#include <type_traits>
2125

@@ -61,8 +65,13 @@ namespace hpx { namespace assertion {
6165
/**/
6266

6367
#if defined(HPX_DEBUG)
68+
#if defined(HPX_COMPUTE_DEVICE_CODE)
69+
#define HPX_ASSERT(expr) assert(expr)
70+
#define HPX_ASSERT_MSG(expr, msg) HPX_ASSERT(expr)
71+
#else
6472
#define HPX_ASSERT(expr) HPX_ASSERT_(expr, std::string())
6573
#define HPX_ASSERT_MSG(expr, msg) HPX_ASSERT_(expr, msg)
74+
#endif
6675
#define HPX_NOEXCEPT_WITH_ASSERT
6776
#else
6877
#define HPX_ASSERT(expr)

src/util/interval_timer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ namespace hpx { namespace util { namespace detail
250250
// lock here would be the right thing but leads to crashes and hangs
251251
// at shutdown.
252252
//util::unlock_guard<std::unique_lock<mutex_type> > ul(l);
253-
id = hpx::applier::register_thread_plain(
253+
id = hpx::threads::register_thread_plain(
254254
util::bind_front(&interval_timer::evaluate,
255255
this->shared_from_this()),
256256
description_.c_str(), threads::suspended, true,

src/util/one_size_heap_list.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace hpx { namespace util
157157
{
158158
if (nullptr == threads::get_self_ptr())
159159
{
160-
hpx::applier::register_work_nullary(
160+
hpx::threads::register_work_nullary(
161161
util::bind_front(&one_size_heap_list::free, this, p, count),
162162
"one_size_heap_list::free");
163163
return true;

0 commit comments

Comments
 (0)