Skip to content

Commit

Permalink
Momentarily comment out use of std::ref
Browse files Browse the repository at this point in the history
  • Loading branch information
atrantan committed Apr 21, 2017
1 parent f7c56cc commit 28ec500
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions tests/unit/parallel/spmd_block.cpp
Expand Up @@ -9,8 +9,6 @@
#include <hpx/parallel/execution_policy.hpp>
#include <hpx/util/lightweight_test.hpp>

#include <boost/atomic.hpp>

#include <cstddef>
#include <functional>
#include <utility>
Expand All @@ -24,6 +22,10 @@ int main()
using hpx::parallel::execution::par;
using hpx::parallel::execution::task;

// FIXME : the atomic variable is passed by pointer in place of by
// reference because of some issue related to std::ref when using certain
// stdlib versions
/*
auto bulk_test =
[](hpx::parallel::v2::spmd_block block, boost::atomic<std::size_t> & c)
{
Expand Down Expand Up @@ -52,6 +54,42 @@ int main()
num_images, std::move(bulk_test), std::ref(c2));
hpx::wait_all(join);
*/

auto bulk_test =
[](hpx::parallel::v2::spmd_block block, boost::atomic<std::size_t> * cptr)
{
boost::atomic<std::size_t> & c = *cptr;

HPX_TEST_EQ(block.get_num_images(), num_images);
HPX_TEST_EQ(block.this_image() < num_images, true);

for(std::size_t i=0, test_count = num_images;
i<iterations;
i++, test_count+=num_images)
{
++c;
block.sync_all();
HPX_TEST_EQ(c, test_count);
block.sync_all();
}
};

boost::atomic<std::size_t> * c1 = new boost::atomic<std::size_t>(0);
boost::atomic<std::size_t> * c2 = new boost::atomic<std::size_t>(0);

hpx::parallel::v2::define_spmd_block(
num_images, std::move(bulk_test), c1);

std::vector<hpx::future<void>> join =
hpx::parallel::v2::define_spmd_block(
par(task),
num_images, std::move(bulk_test),c2);

hpx::wait_all(join);

delete(c1);
delete(c2);

return 0;
}

0 comments on commit 28ec500

Please sign in to comment.