Skip to content

Commit

Permalink
Updated tests to run on multiple localities
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajai V George committed Jun 21, 2017
1 parent 80fc2a4 commit 16a3660
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
15 changes: 15 additions & 0 deletions tests/unit/parallel/segmented_algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,28 @@ set(tests

set(partitioned_vector_copy_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_for_each_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_for_each_PARAMETERS
LOCALITIES 2
THREADS_PER_LOCALITY 4)
set(partitioned_vector_transform_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_transform_PARAMETERS
LOCALITIES 2
THREADS_PER_LOCALITY 4)
set(partitioned_vector_handle_values_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_iter_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_move_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_transform_reduce_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_transform_reduce_PARAMETERS
LOCALITIES 2
THREADS_PER_LOCALITY 4)
set(partitioned_vector_reduce_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_inclusive_scan_PARAMETERS
LOCALITIES 2
THREADS_PER_LOCALITY 4)
set(partitioned_vector_transform_scan_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_transform_scan_PARAMETERS
LOCALITIES 2
THREADS_PER_LOCALITY 4)

set(partitioned_vector_inclusive_scan_FLAGS DEPENDENCIES partitioned_vector_component)
set(partitioned_vector_inclusive_scan_PARAMETERS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ void test_for_each_n_async(ExPolicy && policy, hpx::partitioned_vector<T>& v, T

///////////////////////////////////////////////////////////////////////////////
template <typename T>
void for_each_tests()
void for_each_tests(std::vector<hpx::id_type> &localities)
{
std::size_t const length = 12;

{
hpx::partitioned_vector<T> v;
hpx::partitioned_vector<T> v(0,hpx::container_layout(localities));
hpx::parallel::for_each(hpx::parallel::execution::seq,
v.begin(), v.end(), pfo());
hpx::parallel::for_each(hpx::parallel::execution::par,
Expand All @@ -161,7 +161,7 @@ void for_each_tests()
}

{
hpx::partitioned_vector<T> v(length, T(0));
hpx::partitioned_vector<T> v(length, T(0),hpx::container_layout(localities));
test_for_each(hpx::parallel::execution::seq, v, T(0));
test_for_each(hpx::parallel::execution::par, v, T(1));
test_for_each_async(
Expand All @@ -177,12 +177,12 @@ void for_each_tests()

///////////////////////////////////////////////////////////////////////////////
template <typename T>
void for_each_n_tests()
void for_each_n_tests(std::vector<hpx::id_type> &localities)
{
std::size_t const length = 12;

{
hpx::partitioned_vector<T> v;
hpx::partitioned_vector<T> v(0,hpx::container_layout(localities));
hpx::parallel::for_each_n(hpx::parallel::execution::seq,
v.begin(), 0, pfo());
hpx::parallel::for_each_n(hpx::parallel::execution::par,
Expand All @@ -196,7 +196,7 @@ void for_each_n_tests()
}

{
hpx::partitioned_vector<T> v;
hpx::partitioned_vector<T> v(0,hpx::container_layout(localities));
hpx::parallel::for_each_n(hpx::parallel::execution::seq,
v.begin(), -1, pfo());
hpx::parallel::for_each_n(hpx::parallel::execution::par,
Expand All @@ -210,7 +210,7 @@ void for_each_n_tests()
}

{
hpx::partitioned_vector<T> v(length, T(0));
hpx::partitioned_vector<T> v(length, T(0), hpx::container_layout(localities));
test_for_each_n(hpx::parallel::execution::seq, v, T(0));
test_for_each_n(hpx::parallel::execution::par, v, T(1));
test_for_each_n_async(
Expand All @@ -225,9 +225,10 @@ void for_each_n_tests()
///////////////////////////////////////////////////////////////////////////////
int main()
{
for_each_tests<int>();
for_each_tests<double>();
for_each_n_tests<int>();
for_each_n_tests<double>();
std::vector<hpx::id_type> localities = hpx::find_all_localities();
for_each_tests<int>(localities);
for_each_tests<double>(localities);
for_each_n_tests<int>(localities);
for_each_n_tests<double>(localities);
return 0;
}

0 comments on commit 16a3660

Please sign in to comment.