Permalink
Browse files

Use `unwrap` and `unwrapping` in the examples

  • Loading branch information...
Naios committed Jul 24, 2017
1 parent b6545ba commit e4465fc96863c4d32f33f54c18c1bd9c945fdcf1
@@ -66,7 +66,7 @@ struct stepper
hpx::future<space> do_work(std::size_t nx, std::size_t nt)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
// U[t][i] is the state of position i at time t.
std::vector<space> U(2);
@@ -77,7 +77,7 @@ struct stepper
for (std::size_t i = 0; i != nx; ++i)
U[0][i] = hpx::make_ready_future(double(i));
auto Op = unwrapped(&stepper::heat);
auto Op = unwrapping(&stepper::heat);
// Actual time step loop
for (std::size_t t = 0; t != nt; ++t)
@@ -133,7 +133,7 @@ struct stepper
std::uint64_t nd)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
// U[t][i] is the state of position i at time t.
std::vector<space> U(2);
@@ -154,7 +154,7 @@ struct stepper
// limit depth of dependency tree
hpx::lcos::local::sliding_semaphore sem(nd);
auto Op = unwrapped(&stepper::heat_part);
auto Op = unwrapping(&stepper::heat_part);
// Actual time step loop
for (std::size_t t = 0; t != nt; ++t)
@@ -117,7 +117,7 @@ struct stepper
// time steps
hpx::future<space> do_work(std::size_t np, std::size_t nx, std::size_t nt)
{
using hpx::util::unwrapped;
using hpx::util::unwrapping;
using hpx::dataflow;
using hpx::parallel::for_each;
using hpx::parallel::execution::par;
@@ -131,7 +131,7 @@ struct stepper
for (std::size_t i = 0; i != np; ++i)
U[0][i] = hpx::make_ready_future(partition_data(nx, double(i)));
auto Op = unwrapped(&stepper::heat_part);
auto Op = unwrapping(&stepper::heat_part);
// Actual time step loop
for (std::size_t t = 0; t != nt; ++t)
@@ -219,7 +219,7 @@ struct stepper
boost::shared_array<double> data)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
// U[t][i] is the state of position i at time t.
std::vector<space> U(2);
@@ -255,7 +255,7 @@ struct stepper
);
}
auto Op = unwrapped(&stepper::heat_part);
auto Op = unwrapping(&stepper::heat_part);
// Actual time step loop
for (std::size_t t = 0; t != nt; ++t)
@@ -202,7 +202,7 @@ struct stepper
hpx::future<space> do_work(std::size_t np, std::size_t nx, std::size_t nt)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
// U[t][i] is the state of position i at time t.
std::vector<space> U(2);
@@ -220,7 +220,7 @@ struct stepper
}
);
auto Op = unwrapped(&stepper::heat_part);
auto Op = unwrapping(&stepper::heat_part);
// Actual time step loop
for (std::size_t t = 0; t != nt; ++t)
@@ -224,10 +224,10 @@ struct stepper
partition const& right)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
return dataflow(
unwrapped(
unwrapping(
[middle](partition_data const& l, partition_data const& m,
partition_data const& r)
{
@@ -275,11 +275,11 @@ struct stepper
partition const& right)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
return dataflow(
hpx::launch::async,
unwrapped(
unwrapping(
[left, middle, right](partition_data const& l, partition_data const& m,
partition_data const& r)
{
@@ -260,13 +260,13 @@ struct stepper
partition const& middle, partition const& right)
{
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
hpx::shared_future<partition_data> middle_data =
middle.get_data(partition_server::middle_partition);
hpx::future<partition_data> next_middle = middle_data.then(
unwrapped(
unwrapping(
[middle](partition_data const& m) -> partition_data
{
HPX_UNUSED(middle);
@@ -284,7 +284,7 @@ struct stepper
return dataflow(
hpx::launch::async,
unwrapped(
unwrapping(
[left, middle, right](partition_data next, partition_data const& l,
partition_data const& m, partition_data const& r) -> partition
{
@@ -485,7 +485,7 @@ partition stepper_server::heat_part(partition const& left,
middle.get_data(partition_server::middle_partition);
hpx::future<partition_data> next_middle = middle_data.then(
hpx::util::unwrapped(
hpx::util::unwrapping(
[middle](partition_data const& m) -> partition_data
{
HPX_UNUSED(middle);
@@ -503,7 +503,7 @@ partition stepper_server::heat_part(partition const& left,
return hpx::dataflow(
hpx::launch::async,
hpx::util::unwrapped(
hpx::util::unwrapping(
[left, middle, right](partition_data next, partition_data const& l,
partition_data const& m, partition_data const& r) -> partition
{
@@ -6,7 +6,7 @@
#include <hpx/hpx.hpp>
#include <hpx/include/iostreams.hpp>
#include <hpx/include/async.hpp>
#include <hpx/util/unwrapped.hpp>
#include <hpx/util/unwrap.hpp>
#include "allgather.hpp"
@@ -40,7 +40,7 @@ namespace ag { namespace server
lazy_results.push_back( hpx::async(get_item_, point_components[i]) );
}
n_ = hpx::util::unwrapped(lazy_results);
n_ = hpx::util::unwrap(lazy_results);
}
double allgather::get_item() const
@@ -14,7 +14,7 @@
#include <hpx/include/util.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/util/unwrapped.hpp>
#include <hpx/util/unwrap.hpp>
#include <cstdint>
#include <iostream>
@@ -45,7 +45,7 @@ hpx::future<std::uint64_t> fibonacci(std::uint64_t n)
return
hpx::dataflow(
hpx::util::unwrapped(
hpx::util::unwrapping(
[](std::uint64_t lhs, std::uint64_t rhs)
{
return lhs + rhs;
@@ -7,7 +7,7 @@
#include <hpx/include/actions.hpp>
#include <hpx/include/util.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/util/unwrapped.hpp>
#include <hpx/util/unwrap.hpp>
#include <cstddef>
#include <cstdint>
@@ -108,7 +108,7 @@ void hello_world_foreman()
// all the futures in the vector have returned.
hpx::lcos::local::spinlock mtx;
hpx::lcos::wait_each(
hpx::util::unwrapped([&](std::size_t t) {
hpx::util::unwrapping([&](std::size_t t) {
if (std::size_t(-1) != t)
{
std::lock_guard<hpx::lcos::local::spinlock> lk(mtx);
@@ -50,7 +50,7 @@ int hpx_main(variables_map & vm)
using hpx::shared_future;
using hpx::make_ready_future;
using hpx::dataflow;
using hpx::util::unwrapped;
using hpx::util::unwrapping;
hpx::naming::id_type here = hpx::find_here();
double init_principal=vm["principal"].as<double>(); //Initial principal
@@ -81,8 +81,8 @@ int hpx_main(variables_map & vm)
for (int i = 0; i < t; ++i)
{
shared_future<double> interest = dataflow(unwrapped(calc), principal, rate);
principal = dataflow(unwrapped(add), principal, interest);
shared_future<double> interest = dataflow(unwrapping(calc), principal, rate);
principal = dataflow(unwrapping(add), principal, interest);
}
// wait for the dataflow execution graph to be finished calculating our
@@ -31,7 +31,7 @@ struct pipeline
};
hpx::async(trim, std::move(item))
.then(hpx::util::unwrapped(
.then(hpx::util::unwrapping(
[](std::string const& tc)
{
std::cout << "->" << tc << std::endl;
@@ -243,7 +243,7 @@ void test_sheneos_one_bulk(std::size_t num_ye_points,
// shen.interpolate_one_bulk_async(values_ye, values_temp, values_rho,
// sheneos::server::partition3d::logpress);
//std::vector<double> results = hpx::util::unwrapped(bulk_one_tests);
//std::vector<double> results = hpx::util::unwrap(bulk_one_tests);
}
///////////////////////////////////////////////////////////////////////////////
@@ -342,7 +342,7 @@ void test_sheneos_bulk(std::size_t num_ye_points,
}
}
}
//std::vector<std::vector<double> > results = hpx::util::unwrapped(bulk_tests);
//std::vector<std::vector<double> > results = hpx::util::unwrap(bulk_tests);
}
///////////////////////////////////////////////////////////////////////////////
@@ -192,7 +192,7 @@ void test_sheneos_one_bulk(std::size_t num_ye_points,
shen.interpolate_one_bulk_async(values,
sheneos::server::partition3d::logpress);
std::vector<double> results = hpx::util::unwrapped(bulk_one_tests);
std::vector<double> results = hpx::util::unwrap(bulk_one_tests);
}
HPX_DECLARE_ACTION(test_sheneos_one_bulk, test_one_bulk_action);
@@ -284,7 +284,7 @@ void test_sheneos_bulk(std::size_t num_ye_points,
hpx::lcos::future<std::vector<std::vector<double> > > bulk_tests =
shen.interpolate_bulk_async(values);
std::vector<std::vector<double> > results = hpx::util::unwrapped(bulk_tests);
std::vector<std::vector<double> > results = hpx::util::unwrap(bulk_tests);
}
HPX_DECLARE_ACTION(test_sheneos_bulk, test_bulk_action);
@@ -492,7 +492,7 @@ int hpx_main(boost::program_options::variables_map& vm)
)
);
}
std::vector<double> errsqs = hpx::util::unwrapped(numa_workers);
std::vector<double> errsqs = hpx::util::unwrap(numa_workers);
///////////////////////////////////////////////////////////////////////
// Analyze and output results

0 comments on commit e4465fc

Please sign in to comment.