Skip to content

Commit

Permalink
Merge branch 'master' into disambiguate_base_lco
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Aug 30, 2017
2 parents 71db907 + 8acb6a7 commit cbf64bc
Show file tree
Hide file tree
Showing 191 changed files with 814 additions and 808 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Expand Up @@ -823,6 +823,14 @@ hpx_option(HPX_WITH_THREAD_DESCRIPTION_FULL BOOL
OFF
CATEGORY "Debugging" ADVANCED)

hpx_option(HPX_WITH_ATTACH_DEBUGGER_ON_TEST_FAILURE BOOL
"Break the debugger if a test has failed (default: OFF)"
OFF
CATEGORY "Debugging" ADVANCED)
if(HPX_WITH_ATTACH_DEBUGGER_ON_TEST_FAILURE)
hpx_add_config_define(HPX_HAVE_ATTACH_DEBUGGER_ON_TEST_FAILURE)
endif()

# If APEX is defined, the action timers need thread debug info.
if(HPX_WITH_APEX)
hpx_add_config_define(HPX_HAVE_THREAD_DESCRIPTION)
Expand Down Expand Up @@ -1187,6 +1195,10 @@ if(NOT WIN32)
##############################################################################
# System libraries
##############################################################################
if(NOT MSVC)
hpx_libraries(atomic)
endif()

if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
hpx_libraries(dl)
endif()
Expand Down
8 changes: 8 additions & 0 deletions cmake/HPX_AddConfigTest.cmake
Expand Up @@ -389,6 +389,14 @@ macro(hpx_check_for_cxx11_std_array)
FILE ${ARGN})
endmacro()

###############################################################################
macro(hpx_check_for_cxx11_std_atomic)
add_hpx_config_test(HPX_WITH_CXX11_ATOMIC
SOURCE cmake/tests/cxx11_std_atomic.cpp
LIBRARIES "-latomic"
FILE ${ARGN})
endmacro()

###############################################################################
macro(hpx_check_for_cxx11_std_chrono)
add_hpx_config_test(HPX_WITH_CXX11_CHRONO
Expand Down
3 changes: 3 additions & 0 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Expand Up @@ -83,6 +83,9 @@ macro(hpx_perform_cxx_feature_tests)
hpx_check_for_cxx11_std_array(
DEFINITIONS HPX_HAVE_CXX11_STD_ARRAY)

hpx_check_for_cxx11_std_atomic(
REQUIRED "HPX needs support for C++11 std::atomic")

hpx_check_for_cxx11_std_chrono(
REQUIRED "HPX needs support for C++11 std::chrono")

Expand Down
26 changes: 26 additions & 0 deletions cmake/tests/cxx11_std_atomic.cpp
@@ -0,0 +1,26 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Agustin Berge
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////

#include <atomic>

int main()
{
std::atomic_flag af = ATOMIC_FLAG_INIT;
if (af.test_and_set())
af.clear();

std::atomic<int> ai;
ai.store(0);
int i = ai.load();

std::memory_order mo;
mo = std::memory_order_relaxed;
mo = std::memory_order_acquire;
mo = std::memory_order_release;
mo = std::memory_order_acq_rel;
mo = std::memory_order_seq_cst;
}
1 change: 1 addition & 0 deletions docs/CMakeLists.txt
Expand Up @@ -183,6 +183,7 @@ set(doxygen_dependencies
"${PROJECT_SOURCE_DIR}/hpx/lcos/wait_each.hpp"
"${PROJECT_SOURCE_DIR}/hpx/lcos/when_each.hpp"
"${PROJECT_SOURCE_DIR}/hpx/traits/is_execution_policy.hpp"
"${PROJECT_SOURCE_DIR}/hpx/util/debugging.hpp"
"${PROJECT_SOURCE_DIR}/hpx/util/invoke.hpp"
"${PROJECT_SOURCE_DIR}/hpx/util/invoke_fused.hpp"
"${PROJECT_SOURCE_DIR}/hpx/util/pack_traversal.hpp"
Expand Down
3 changes: 3 additions & 0 deletions docs/hpx.idx
Expand Up @@ -526,6 +526,9 @@ when_each_n "" "header\.hpx\.lcos\.when_each.*"
wait_each "" "header\.hpx\.lcos\.wait_each.*"
wait_each_n "" "header\.hpx\.lcos\.wait_each.*"

# hpx/util/debugging.hpp
attach_debugger "" "header\.hpx\.util\.attach_debugger.*"

# hpx/util/invoke.hpp
invoke "" "header\.hpx\.util\.invoke.*"
invoke_r "" "header\.hpx\.util\.invoke_r.*"
Expand Down
Expand Up @@ -9,13 +9,12 @@
#include <hpx/hpx_init.hpp>
#include <hpx/include/performance_counters.hpp>

#include <boost/atomic.hpp>

#include <atomic>
#include <cstdint>

///////////////////////////////////////////////////////////////////////////////
// The atomic variable 'counter' ensures the thread safety of the counter.
boost::atomic<std::int64_t> counter(0);
std::atomic<std::int64_t> counter(0);

std::int64_t some_performance_data(bool reset)
{
Expand Down
5 changes: 3 additions & 2 deletions examples/quickstart/composable_guard.cpp
Expand Up @@ -4,7 +4,8 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <hpx/lcos/local/composable_guard.hpp>
#include <hpx/hpx_init.hpp>
#include <boost/atomic.hpp>

#include <atomic>
#include <iostream>
#include <memory>

Expand All @@ -27,7 +28,7 @@
// To use guards, call the run_guarded() method, supplying it with
// a guard or guard set, and a task to be performed.

typedef boost::atomic<int> int_atomic;
typedef std::atomic<int> int_atomic;
int_atomic i1(0), i2(0);
hpx::lcos::local::guard_set guards;
std::shared_ptr<hpx::lcos::local::guard> l1(new hpx::lcos::local::guard());
Expand Down
6 changes: 3 additions & 3 deletions examples/quickstart/fibonacci_futures_distributed.cpp
Expand Up @@ -9,13 +9,13 @@
#include <hpx/include/lcos.hpp>
#include <hpx/util/unwrap.hpp>

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

#include <boost/atomic.hpp>
#include <boost/format.hpp>

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -24,7 +24,7 @@ std::uint64_t distribute_at = 2;
int num_repeats = 1;

///////////////////////////////////////////////////////////////////////////////
boost::atomic<std::size_t> serial_execution_count(0);
std::atomic<std::size_t> serial_execution_count(0);

std::size_t get_serial_execution_count()
{
Expand All @@ -33,7 +33,7 @@ std::size_t get_serial_execution_count()
HPX_PLAIN_ACTION(get_serial_execution_count);

///////////////////////////////////////////////////////////////////////////////
boost::atomic<std::size_t> next_locality(0);
std::atomic<std::size_t> next_locality(0);
std::vector<hpx::id_type> localities;
hpx::id_type here;

Expand Down
2 changes: 0 additions & 2 deletions examples/quickstart/quicksort.cpp
Expand Up @@ -10,8 +10,6 @@
#include <hpx/util/high_resolution_timer.hpp>
#include <hpx/include/async.hpp>

#include <boost/atomic.hpp>

#include <algorithm>
#include <cstddef>
#include <cstdint>
Expand Down
4 changes: 2 additions & 2 deletions examples/quickstart/shared_mutex.cpp
Expand Up @@ -13,10 +13,10 @@
#include <hpx/include/iostreams.hpp>
#include <hpx/util/unused.hpp>

#include <boost/atomic.hpp>
#include <boost/random.hpp>
#include <boost/thread/locks.hpp>

#include <atomic>
#include <chrono>
#include <cstdint>
#include <ctime>
Expand All @@ -32,7 +32,7 @@ using std::chrono::milliseconds;
int main()
{
std::vector<hpx::thread> threads;
boost::atomic<bool> ready(false);
std::atomic<bool> ready(false);
hpx::lcos::local::shared_mutex stm;

for (int i = 0; i < writers; ++i)
Expand Down
9 changes: 4 additions & 5 deletions examples/resource_partitioner/shared_priority_scheduler.hpp
Expand Up @@ -24,8 +24,7 @@
#include <plugins/parcelport/parcelport_logging.hpp>
#endif

#include <boost/atomic.hpp>

#include <atomic>
#include <chrono>
#include <cstddef>
#include <cstdint>
Expand Down Expand Up @@ -733,7 +732,7 @@ namespace threads {
this_queue->increment_num_pending_misses();

bool have_staged = this_queue->get_staged_queue_length(
boost::memory_order_relaxed) != 0;
std::memory_order_relaxed) != 0;

// Give up, we should have work to convert.
if (have_staged)
Expand Down Expand Up @@ -1287,8 +1286,8 @@ namespace threads {
std::vector<thread_queue_type*> queues_;
std::vector<thread_queue_type*> high_priority_queues_;
thread_queue_type low_priority_queue_;
boost::atomic<std::size_t> curr_queue_;
boost::atomic<std::size_t> curr_hp_queue_;
std::atomic<std::size_t> curr_queue_;
std::atomic<std::size_t> curr_hp_queue_;
std::size_t numa_sensitive_;
std::size_t numa_pinned_;
std::size_t threads_per_hp_queue_;
Expand Down
4 changes: 2 additions & 2 deletions hpx/components/iostreams/ostream.hpp
Expand Up @@ -16,9 +16,9 @@
#include <hpx/runtime/components/client_base.hpp>
#include <hpx/util/register_locks.hpp>

#include <boost/atomic.hpp>
#include <boost/iostreams/stream.hpp>

#include <atomic>
#include <cstdint>
#include <ios>
#include <iostream>
Expand Down Expand Up @@ -168,7 +168,7 @@ namespace hpx { namespace iostreams

private:
using detail::buffer::mtx_;
boost::atomic<std::uint64_t> generational_count_;
std::atomic<std::uint64_t> generational_count_;

// Performs a lazy streaming operation.
template <typename T>
Expand Down
5 changes: 2 additions & 3 deletions hpx/compute/cuda/concurrent_executor.hpp
Expand Up @@ -17,9 +17,8 @@
#include <hpx/compute/host/block_executor.hpp>
#include <hpx/compute/host/target.hpp>

#include <boost/atomic.hpp>

#include <array>
#include <atomic>
#include <cstddef>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -196,7 +195,7 @@ namespace hpx { namespace compute { namespace cuda
private:
host_executor_type host_executor_;
std::vector<cuda_executor_type> cuda_executors_;
boost::atomic<std::size_t> current_;
std::atomic<std::size_t> current_;
};
}}}

Expand Down
2 changes: 0 additions & 2 deletions hpx/compute/detail/target_distribution_policy.hpp
Expand Up @@ -17,8 +17,6 @@
#include <utility>
#include <vector>

#include <boost/atomic.hpp>

namespace hpx { namespace compute { namespace detail
{
/// This class specifies the parameters for a simple distribution policy
Expand Down
5 changes: 2 additions & 3 deletions hpx/compute/host/block_executor.hpp
Expand Up @@ -20,9 +20,8 @@
#include <hpx/util/range.hpp>
#include <hpx/util/unwrap.hpp>

#include <boost/atomic.hpp>

#include <algorithm>
#include <atomic>
#include <cstddef>
#include <exception>
#include <iterator>
Expand Down Expand Up @@ -239,7 +238,7 @@ namespace hpx { namespace compute { namespace host
}
}
std::vector<host::target> targets_;
boost::atomic<std::size_t> current_;
std::atomic<std::size_t> current_;
std::vector<Executor> executors_;
};
}}}
Expand Down
4 changes: 2 additions & 2 deletions hpx/lcos/dataflow.hpp
Expand Up @@ -40,10 +40,10 @@
#endif
#include <hpx/parallel/executors/execution.hpp>

#include <boost/atomic.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/ref.hpp>

#include <atomic>
#include <cstddef>
#include <exception>
#include <functional>
Expand Down Expand Up @@ -521,7 +521,7 @@ namespace hpx { namespace lcos { namespace detail
Policy policy_;
Func func_;
Futures futures_;
boost::atomic<bool> done_;
std::atomic<bool> done_;
};

///////////////////////////////////////////////////////////////////////////
Expand Down
14 changes: 7 additions & 7 deletions hpx/lcos/future_wait.hpp
Expand Up @@ -14,9 +14,9 @@
#include <hpx/traits/future_access.hpp>
#include <hpx/traits/future_traits.hpp>

#include <boost/atomic.hpp>
#include <boost/dynamic_bitset.hpp>

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <utility>
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace hpx { namespace lcos

template <typename F_>
wait_each(argument_type const& lazy_values, F_ && f,
boost::atomic<std::size_t>* success_counter)
std::atomic<std::size_t>* success_counter)
: lazy_values_(lazy_values),
ready_count_(0),
f_(std::forward<F>(f)),
Expand All @@ -118,7 +118,7 @@ namespace hpx { namespace lcos

template <typename F_>
wait_each(argument_type && lazy_values, F_ && f,
boost::atomic<std::size_t>* success_counter)
std::atomic<std::size_t>* success_counter)
: lazy_values_(std::move(lazy_values)),
ready_count_(0),
f_(std::forward<F>(f)),
Expand Down Expand Up @@ -185,9 +185,9 @@ namespace hpx { namespace lcos
}

std::vector<Future> lazy_values_;
boost::atomic<std::size_t> ready_count_;
std::atomic<std::size_t> ready_count_;
typename std::remove_reference<F>::type f_;
boost::atomic<std::size_t>* success_counter_;
std::atomic<std::size_t>* success_counter_;
bool goal_reached_on_calling_thread_;
};
}
Expand Down Expand Up @@ -240,7 +240,7 @@ namespace hpx { namespace lcos
std::back_inserter(lazy_values_),
detail::wait_acquire_future<Future>());

boost::atomic<std::size_t> success_counter(0);
std::atomic<std::size_t> success_counter(0);
lcos::local::futures_factory<return_type()> p(
detail::wait_each<Future, F>(std::move(lazy_values_),
std::forward<F>(f), &success_counter));
Expand Down Expand Up @@ -275,7 +275,7 @@ namespace hpx { namespace lcos
std::back_inserter(lazy_values_),
detail::wait_acquire_future<Future>());

boost::atomic<std::size_t> success_counter(0);
std::atomic<std::size_t> success_counter(0);
lcos::local::futures_factory<return_type()> p(
detail::wait_each<Future, F>(std::move(lazy_values_),
std::forward<F>(f), &success_counter));
Expand Down
5 changes: 2 additions & 3 deletions hpx/lcos/local/composable_guard.hpp
Expand Up @@ -87,8 +87,7 @@
#include <hpx/util_fwd.hpp>
#include <hpx/lcos/local/packaged_task.hpp>

#include <boost/atomic.hpp>

#include <atomic>
#include <cstddef>
#include <memory>
#include <utility>
Expand Down Expand Up @@ -125,7 +124,7 @@ namespace hpx { namespace lcos { namespace local

struct guard_task;

typedef boost::atomic<guard_task*> guard_atomic;
typedef std::atomic<guard_task*> guard_atomic;

HPX_API_EXPORT void free(guard_task* task);

Expand Down

0 comments on commit cbf64bc

Please sign in to comment.