Skip to content

Commit c1ae269

Browse files
authored
Merge pull request #26 from SC-SGS/change_mutex_defaults
Change mutex defaults
2 parents 733b870 + e515ae1 commit c1ae269

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 17)
1313

1414
set(CPPUDDLE_VERSION_MAJOR 0)
1515
set(CPPUDDLE_VERSION_MINOR 3)
16-
set(CPPUDDLE_VERSION_PATCH 0)
16+
set(CPPUDDLE_VERSION_PATCH 1)
1717
set(CPPUDDLE_VERSION_STRING "${CPPUDDLE_VERSION_MAJOR}.${CPPUDDLE_VERSION_MINOR}.${CPPUDDLE_VERSION_PATCH}.")
1818

1919
#------------------------------------------------------------------------------------------------------------
@@ -27,7 +27,7 @@ set(CPPUDDLE_WITH_MAX_NUMBER_GPUS "1" CACHE STRING "Number of GPUs that will be
2727
# HPX-related options
2828
option(CPPUDDLE_WITH_HPX "Enable basic HPX integration and examples" OFF)
2929
option(CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS "Enable HPX-aware allocators for even better HPX integration" ON)
30-
set(CPPUDDLE_WITH_HPX_MUTEX OFF CACHE BOOL
30+
set(CPPUDDLE_WITH_HPX_MUTEX ON CACHE BOOL
3131
"Use HPX spinlock mutex instead of std::mutex")
3232
set(CPPUDDLE_WITH_NUMBER_BUCKETS "128" CACHE STRING "Number of internal recycle buckets buffer type. Should ideally match the intended number of HPX workers or be 1 in non-HPX builds.")
3333
# Test-related options
@@ -49,13 +49,6 @@ if (CPPUDDLE_WITH_HPX)
4949
find_package(HPX 1.8.0 REQUIRED) # older versions might work but are untested with the current cppuddle
5050
endif()
5151

52-
# HPX mutex requires HPX-Support
53-
if(CPPUDDLE_WITH_HPX_MUTEX)
54-
if(NOT CPPUDDLE_WITH_HPX)
55-
message(FATAL_ERROR " CPPUDDLE_WITH_HPX_MUTEX requires a build with HPX (CPPUDDLE_WITH_HPX=ON)")
56-
endif()
57-
endif()
58-
5952
# HPX build are really better with HPX-aware allocators: Warn if disabled
6053
if(CPPUDDLE_WITH_HPX)
6154
if(NOT CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS)

include/aggregation_manager.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#ifndef WORK_AGGREGATION_MANAGER
77
#define WORK_AGGREGATION_MANAGER
88

9+
#ifndef CPPUDDLE_HAVE_HPX
10+
#error "Work aggregation allocators/executors require CPPUDDLE_WITH_HPX=ON"
11+
#endif
12+
913
#include <stdexcept>
1014
#define DEBUG_AGGREGATION_CALLS 1
1115

@@ -48,6 +52,16 @@
4852
#include "../include/stream_manager.hpp"
4953
#include "../include/detail/config.hpp"
5054

55+
#ifndef CPPUDDLE_HAVE_HPX_MUTEX
56+
#pragma message \
57+
"Work aggregation will use hpx::mutex internally, despite CPPUDDLE_WITH_HPX_MUTEX=OFF"
58+
#pragma message \
59+
"Consider using CPPUDDLE_WITH_HPX_MUTEX=ON, to make the rest of CPPuddle also use hpx::mutex"
60+
#endif
61+
namespace recycler {
62+
using aggregation_mutex_t = hpx::mutex;
63+
}
64+
5165
//===============================================================================
5266
//===============================================================================
5367
// Helper functions/classes

include/detail/config.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ namespace recycler {
3232

3333
#if defined(CPPUDDLE_HAVE_HPX) && defined(CPPUDDLE_HAVE_HPX_MUTEX)
3434
using mutex_t = hpx::spinlock_no_backoff;
35-
using aggregation_mutex_t = hpx::mutex;
3635
#else
3736
using mutex_t = std::mutex;
38-
using aggregation_mutex_t = std::mutex;
3937
#endif
4038

4139
// Recycling configuration

0 commit comments

Comments
 (0)