Skip to content

Commit

Permalink
Merge branch 'master' into std-atomic-lite
Browse files Browse the repository at this point in the history
  • Loading branch information
sithhell committed Aug 29, 2017
2 parents a08615a + 6c098f8 commit 6fd6dba
Show file tree
Hide file tree
Showing 26 changed files with 566 additions and 470 deletions.
21 changes: 20 additions & 1 deletion appveyor.yml
Expand Up @@ -9,8 +9,10 @@ environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
MSVC_GENERATOR: Visual Studio 14 2015
MSVC_GENERATOR_SHORT: VS2015
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
MSVC_GENERATOR: Visual Studio 15 2017
MSVC_GENERATOR_SHORT: VS2017

configuration:
- Debug
Expand All @@ -33,11 +35,28 @@ before_build:

build_script:
- cmd: cmake --build build --config %CONFIGURATION% --target core -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal /maxcpucount:2 /nologo
- cmd: |
7z a "hpx-master-redist-%MSVC_GENERATOR_SHORT%-%CONFIGURATION%.7z" -y "build\Debug\bin\*.dll" "build\Debug\bin\hpx\*.dll" "build\Debug\bin\*.pdb" "build\Debug\bin\hpx\*.pdb" >NUL
7z a "hpx-master-redist-%MSVC_GENERATOR_SHORT%-%CONFIGURATION%.7z" -y "build\Debug\lib\*.lib" "build\Debug\lib\hpx\*.lib" "build\src\hpx_init.dir\Debug\hpx_init.pdb" >NUL
7z a "hpx-master-redist-%MSVC_GENERATOR_SHORT%-%CONFIGURATION%.7z" -y "build\lib\cmake\HPX\*.cmake" "build\hpx\config\*.hpp" "build\hpx\runtime\parcelset\*.hpp" "hpx" "cmake\*.cmake" >NUL
- cmd: cmake --build build --config %CONFIGURATION% --target examples -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal /maxcpucount:2 /nologo
# - cmd: cmake --build build --config %CONFIGURATION% --target tests/regressions -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal /maxcpucount:2 /nologo

test_script:
- cmd: |
set PATH=%PATH%;C:\projects\vcpkg\installed\x64-windows\debug\bin
python build\bin\hpxrun.py -l2 -t2 build\Debug\bin\hello_world.exe -- --hpx:bind=none
artifacts:
- path: hpx-master-redist-$(MSVC_GENERATOR_SHORT)-$(configuration).7z
name: hpx-master-redist-$(MSVC_GENERATOR_SHORT)-$(configuration)

deploy:
provider: FTP
on:
branch: master
protocol: ftp
host: ftp.stellar-group.org
username: appveyor-ci@stellar-group.org
password:
secure: tsfxuDuvSntD/aqRcuxSvkU4lqQck85OI7e7nhDhIr4=
beta: true
1 change: 1 addition & 0 deletions cmake/templates/HPXConfig.cmake.in
Expand Up @@ -19,6 +19,7 @@ set(HPX_INCLUDE_DIRS "@HPX_CMAKE_CONF_INCLUDE_DIRS@")
set(HPX_LIBRARIES "@HPX_CONF_LIBRARIES@")
set(HPX_LIBRARY_DIR "@HPX_CONF_LIBRARY_DIR@")

set(HPX_VERSION_STRING "@HPX_VERSION@")
set(HPX_MAJOR_VERSION @HPX_MAJOR_VERSION@)
set(HPX_MINOR_VERSION @HPX_MINOR_VERSION@)
set(HPX_PATCH_LEVEL @HPX_PATCH_LEVEL@)
Expand Down
8 changes: 4 additions & 4 deletions docs/manual/vector.qbk
Expand Up @@ -371,7 +371,7 @@ By default, the `partitioned_vector` class integrates 1-D views of its segments
std::vector<double> v = vv[i];

Our views are called "multi-dimensional" in the sense that they generalize
to N dimensions the purpose of `segmented_iterator_traits::segments()` in the 1-D case. Note that
to N dimensions the purpose of `segmented_iterator_traits::segment()` in the 1-D case. Note that
in a parallel section, the 2-D expression `a(i,j) = b(i,j)` is quite confusing
because without convention, each of the images invoked will race to execute
the statement. For this reason, our views are not only multi-dimensional
Expand Down Expand Up @@ -539,14 +539,14 @@ sub-view.

// Instanciate the subview
View_2D svv(
block,&v(tilesize,0),&v(2*tilesize-1,tilesize-1),{tilesize,tilesize},{N,N});
block,&vv(tilesize,0),&vv(2*tilesize-1,tilesize-1),{tilesize,tilesize},{N,N});

if(block.this_image() == 0)
{
// Equivalent to 'sv(tilesize,0) = 2.0f'
// Equivalent to 'vv(tilesize,0) = 2.0f'
svv(0,0) = 2.0f;

// Equivalent to 'sv(2*tilesize-1,tilesize-1) = 3.0f'
// Equivalent to 'vv(2*tilesize-1,tilesize-1) = 3.0f'
svv(tilesize-1,tilesize-1) = 3.0f;
}

Expand Down
Expand Up @@ -200,9 +200,9 @@ int hpx_main(boost::program_options::variables_map& vm)
<< std::endl;
thread_set.clear();

auto high_priority_async_policy =
hpx::launch::async_policy(hpx::threads::thread_priority_critical);
auto normal_priority_async_policy = hpx::launch::async_policy();
// auto high_priority_async_policy =
// hpx::launch::async_policy(hpx::threads::thread_priority_critical);
// auto normal_priority_async_policy = hpx::launch::async_policy();

// test a parallel algorithm on custom pool with high priority
hpx::parallel::for_loop_strided(
Expand Down
8 changes: 4 additions & 4 deletions examples/resource_partitioner/shared_priority_scheduler.hpp
Expand Up @@ -25,6 +25,7 @@
#endif

#include <atomic>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <exception>
Expand All @@ -37,15 +38,15 @@
#include <vector>

#if !defined(HPX_MSVC)
static std::chrono::system_clock::time_point log_t_start =
static std::chrono::high_resolution_clock::time_point log_t_start =
std::chrono::high_resolution_clock::now();

#define LOG_CUSTOM_WORKER(x) \
dummy << "<CUSTOM> " << THREAD_ID << " time " << decimal(16) << nowt \
<< ' '; \
if (parent_pool_) \
if (parent_pool_) \
dummy << "pool " << std::setfill(' ') << std::setw(8) \
<< parent_pool_->get_pool_name() << " " << x << std::endl; \
<< parent_pool_->get_pool_name() << " " << x << std::endl; \
else \
dummy << "pool (unset) " << x << std::endl; \
std::cout << dummy.str().c_str();
Expand Down Expand Up @@ -1252,7 +1253,6 @@ namespace threads {
hp_victim_queues_[i]);
debug::output("hp_xnuma_queues " + std::string(buff) + " ",
hp_xnuma_queues_[i]);
i++;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/resource_partitioner/simple_resource_partitioner.cpp
Expand Up @@ -200,9 +200,9 @@ int hpx_main(boost::program_options::variables_map& vm)
<< std::endl;
thread_set.clear();

auto high_priority_async_policy =
hpx::launch::async_policy(hpx::threads::thread_priority_critical);
auto normal_priority_async_policy = hpx::launch::async_policy();
// auto high_priority_async_policy =
// hpx::launch::async_policy(hpx::threads::thread_priority_critical);
// auto normal_priority_async_policy = hpx::launch::async_policy();

// test a parallel algorithm on custom pool with high priority
hpx::parallel::for_loop_strided(
Expand Down
30 changes: 4 additions & 26 deletions hpx/lcos/base_lco_with_value.hpp
Expand Up @@ -12,7 +12,7 @@
#include <hpx/runtime/actions/basic_action.hpp>
#include <hpx/runtime/actions/component_action.hpp>
#include <hpx/runtime/components/component_type.hpp>
#include <hpx/runtime/components/server/simple_component_base.hpp>
#include <hpx/runtime/components/server/component.hpp>
#include <hpx/runtime/components/server/managed_component_base.hpp>
#include <hpx/runtime/components_fwd.hpp>
#include <hpx/runtime/naming/id_type.hpp>
Expand Down Expand Up @@ -42,13 +42,7 @@ namespace hpx { namespace lcos
template <typename BaseLco>
struct base_lco_wrapping_type<traits::detail::component_tag, BaseLco>
{
typedef components::simple_component<BaseLco> type;
};

template <typename BaseLco>
struct base_lco_wrapping_type<traits::detail::simple_component_tag, BaseLco>
{
typedef components::simple_component<BaseLco> type;
typedef components::component<BaseLco> type;
};

template <typename BaseLco>
Expand Down Expand Up @@ -174,7 +168,8 @@ namespace hpx { namespace lcos
// components must contain a typedef for wrapping_type defining the
// managed_component type used to encapsulate instances of this
// component
typedef components::managed_component<base_lco_with_value> wrapping_type;
typedef typename detail::base_lco_wrapping_type<ComponentTag,
base_lco_with_value>::type wrapping_type;
typedef base_lco_with_value base_type_holder;

// refer to base type for the corresponding implementation
Expand Down Expand Up @@ -208,23 +203,6 @@ namespace hpx { namespace traits
}
};

template <typename Result, typename RemoteResult, typename Enable>
struct component_type_database<
hpx::lcos::base_lco_with_value<
Result, RemoteResult, traits::detail::simple_component_tag
>, Enable>
{
static components::component_type get()
{
return components::component_base_lco_with_value_unmanaged;
}

static void set(components::component_type)
{
HPX_ASSERT(false);
}
};

template <typename Result, typename RemoteResult, typename Enable>
struct component_type_database<
hpx::lcos::base_lco_with_value<
Expand Down
36 changes: 23 additions & 13 deletions hpx/performance_counters/server/base_performance_counter.hpp
Expand Up @@ -20,8 +20,8 @@
namespace hpx { namespace performance_counters { namespace server
{
class base_performance_counter
: public hpx::performance_counters::performance_counter_base
, public hpx::traits::detail::simple_component_tag
: public hpx::performance_counters::performance_counter_base,
public hpx::traits::detail::component_tag
{
protected:
/// the following functions are not implemented by default, they will
Expand All @@ -48,7 +48,8 @@ namespace hpx { namespace performance_counters { namespace server
virtual counter_values_array get_counter_values_array(bool reset)
{
HPX_THROW_EXCEPTION(invalid_status, "get_counter_values_array",
"get_counter_values_array is not implemented for this counter");
"get_counter_values_array is not implemented for this "
"counter");
return counter_values_array();
}

Expand All @@ -68,20 +69,28 @@ namespace hpx { namespace performance_counters { namespace server
}

public:
base_performance_counter() : invocation_count_(0) {}
base_performance_counter()
: invocation_count_(0)
{
}
base_performance_counter(counter_info const& info)
: info_(info), invocation_count_(0)
{}
: info_(info)
, invocation_count_(0)
{
}

// components must contain a typedef for wrapping_type defining the
// component type used to encapsulate instances of this
// component
typedef components::component<base_performance_counter> wrapping_type;
typedef components::component<base_performance_counter>
wrapping_type;
typedef base_performance_counter base_type_holder;

/// \brief finalize() will be called just before the instance gets
/// destructed
void finalize() {}
void finalize()
{
}

static components::component_type get_component_type()
{
Expand Down Expand Up @@ -145,7 +154,8 @@ namespace hpx { namespace performance_counters { namespace server
/// The \a get_counter_value_action queries the value of a performance
/// counter.
HPX_DEFINE_COMPONENT_ACTION(base_performance_counter,
get_counter_values_array_nonvirt, get_counter_values_array_action);
get_counter_values_array_nonvirt,
get_counter_values_array_action);

/// The \a set_counter_value_action
HPX_DEFINE_COMPONENT_ACTION(base_performance_counter,
Expand All @@ -156,12 +166,12 @@ namespace hpx { namespace performance_counters { namespace server
reset_counter_value_nonvirt, reset_counter_value_action);

/// The \a start_action
HPX_DEFINE_COMPONENT_ACTION(base_performance_counter,
start_nonvirt, start_action);
HPX_DEFINE_COMPONENT_ACTION(
base_performance_counter, start_nonvirt, start_action);

/// The \a stop_action
HPX_DEFINE_COMPONENT_ACTION(base_performance_counter,
stop_nonvirt, stop_action);
HPX_DEFINE_COMPONENT_ACTION(
base_performance_counter, stop_nonvirt, stop_action);

protected:
hpx::performance_counters::counter_info info_;
Expand Down
2 changes: 1 addition & 1 deletion hpx/runtime/components/component_type.hpp
Expand Up @@ -70,7 +70,7 @@ namespace hpx { namespace components
component_first_dynamic = component_last,

// Force this enum type to be at least 32 bits.
component_upper_bound = 0x7fffffffL //-V112
component_upper_bound = 0x7fffffffL //-V112
};

enum factory_state_enum
Expand Down
4 changes: 2 additions & 2 deletions hpx/runtime/components/server/abstract_component_base.hpp
Expand Up @@ -22,14 +22,14 @@ namespace hpx { namespace components
{
///////////////////////////////////////////////////////////////////////////
template <typename Component>
class simple_component;
class component;

template <typename Component>
class abstract_simple_component_base
: private traits::detail::component_tag
{
private:
typedef simple_component<Component> outer_wrapping_type;
typedef component<Component> outer_wrapping_type;

public:
virtual ~abstract_simple_component_base() {}
Expand Down
60 changes: 53 additions & 7 deletions hpx/runtime/components/server/component.hpp
@@ -1,4 +1,6 @@
// Copyright (c) 2015 Thomas Heller
// Copyright (c) 2007-2017 Hartmut Kaiser
// Copyright (c) 2015-2017 Thomas Heller
// Copyright (c) 2011 Bryce Lelbach
//
// 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)
Expand All @@ -7,23 +9,67 @@
#define HPX_RUNTIME_COMPONENTS_SERVER_COMPONENT_HPP

#include <hpx/config.hpp>
#include <hpx/util/assert.hpp>

#include <hpx/runtime/components/server/simple_component_base.hpp>

#include <cstddef>
#include <new>
#include <utility>

namespace hpx { namespace components {

namespace detail {
///////////////////////////////////////////////////////////////////////
template <typename Component>
struct simple_heap_factory
{
static void* alloc(std::size_t count)
{
HPX_ASSERT(1 == count);
return ::operator new(sizeof(Component));
}
static void free(void* p, std::size_t count)
{
HPX_ASSERT(1 == count);
::operator delete(p);
}
};
}

///////////////////////////////////////////////////////////////////////////
template <typename Component>
class component
: public simple_component<Component>
class component : public Component
{
public:
typedef Component type_holder;
typedef component<Component> component_type;
typedef component_type derived_type;
typedef detail::simple_heap_factory<component_type> heap_type;

/// \brief Construct a simple_component instance holding a new wrapped
/// instance
template <typename ...Ts>
template <typename... Ts>
component(Ts&&... vs)
: simple_component<Component>(std::forward<Ts>(vs)...)
: Component(std::forward<Ts>(vs)...)
{}

/// \brief The function \a create is used for allocation and
/// initialization of instances of the derived components.
static component_type* create(std::size_t count)
{
// simple components can be created individually only
HPX_ASSERT(1 == count);
return new component_type(); //-V572
}

/// \brief The function \a destroy is used for destruction and
/// de-allocation of instances of the derived components.
static void destroy(Component* p, std::size_t count = 1)
{
// simple components can be deleted individually only
HPX_ASSERT(1 == count);
p->finalize();
delete p;
}
};
}}

Expand Down

0 comments on commit 6fd6dba

Please sign in to comment.