Commit d5e19cda authored by Yaroslav's avatar Yaroslav
Browse files

Commit with last version of semanthic tests

parent 9a49cd01
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
#ifndef OPENFPM_VCLUSTER_SRC_VCLUSTER_SEMANTIC_UNIT_TESTS_HPP_ #ifndef OPENFPM_VCLUSTER_SRC_VCLUSTER_SEMANTIC_UNIT_TESTS_HPP_
#define OPENFPM_VCLUSTER_SRC_VCLUSTER_SEMANTIC_UNIT_TESTS_HPP_ #define OPENFPM_VCLUSTER_SRC_VCLUSTER_SEMANTIC_UNIT_TESTS_HPP_
#include "data_type/aggregate.hpp" struct Aexample
struct A
{ {
size_t a; size_t a;
float b; float b;
...@@ -63,7 +61,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather) ...@@ -63,7 +61,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather)
if (vcl.getProcessingUnits() >= 32) if (vcl.getProcessingUnits() >= 32)
return; return;
openfpm::vector<A> v1; openfpm::vector<Aexample> v1;
v1.resize(vcl.getProcessUnitID()); v1.resize(vcl.getProcessUnitID());
for(size_t i = 0 ; i < vcl.getProcessUnitID() ; i++) for(size_t i = 0 ; i < vcl.getProcessUnitID() ; i++)
...@@ -73,7 +71,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather) ...@@ -73,7 +71,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather)
v1.get(i).c = 11.0; v1.get(i).c = 11.0;
} }
openfpm::vector<A> v2; openfpm::vector<Aexample> v2;
vcl.SGather(v1,v2,(i%vcl.getProcessingUnits())); vcl.SGather(v1,v2,(i%vcl.getProcessingUnits()));
...@@ -191,6 +189,8 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_scatter) ...@@ -191,6 +189,8 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_scatter)
} }
} }
BOOST_AUTO_TEST_CASE (Vcluster_semantic_sendrecv) BOOST_AUTO_TEST_CASE (Vcluster_semantic_sendrecv)
{ {
for (size_t i = 0 ; i < 100 ; i++) for (size_t i = 0 ; i < 100 ; i++)
...@@ -357,7 +357,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_sendrecv) ...@@ -357,7 +357,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_sendrecv)
} }
} }
BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test) BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_2)
{ {
Vcluster & vcl = create_vcluster(); Vcluster & vcl = create_vcluster();
...@@ -375,92 +375,6 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test) ...@@ -375,92 +375,6 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test)
vcl.SGather(v1,v2,0); vcl.SGather(v1,v2,0);
if (vcl.getProcessUnitID() == 0) if (vcl.getProcessUnitID() == 0)
{
size_t n = vcl.getProcessingUnits();
BOOST_REQUIRE_EQUAL(v2.size(),n*(n-1)/2);
std::cout << v2.size() << std::endl;
bool is_five = true;
for (size_t i = 0 ; i < v2.size() ; i++)
is_five &= (v2.get(i) == 5);
BOOST_REQUIRE_EQUAL(is_five,true);
}
}
BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test_2)
{
Vcluster & vcl = create_vcluster();
if (vcl.getProcessingUnits() >= 32)
return;
openfpm::vector<size_t> v1;
v1.resize(vcl.getProcessUnitID());
for(size_t i = 0 ; i < vcl.getProcessUnitID() ; i++)
v1.get(i) = 5;
openfpm::vector<openfpm::vector<size_t>> v2;
vcl.SGather(v1,v2,0);
if (vcl.getProcessUnitID() == 0)
{
size_t n = vcl.getProcessingUnits();
BOOST_REQUIRE_EQUAL(v2.size(),n);
std::cout << v2.size() << std::endl;
/* for (size_t i = 0 ; i < v2.size() ; i++)
{
for (size_t j = 0 ; j < v2.get(i).size() ; j++)
{
int m = v2.get(i).get(j);
BOOST_REQUIRE_EQUAL(m,5);
}
}*/
for (size_t i = 0 ; i < v2.size() ; i++)
{
for (size_t j = 0 ; j < v2.get(i).size() ; j++)
{
std::cout << v2.get(i).get(j) << " " << std::endl;
}
std::cout << "Size is " << v2.get(i).size() << " " << std::endl;
}
}
}
BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test_3)
{
for (size_t i = 0 ; i < 100 ; i++)
{
Vcluster & vcl = create_vcluster();
if (vcl.getProcessingUnits() >= 32)
return;
openfpm::vector<aggregate<openfpm::vector<int>>> v1;
openfpm::vector<int> v1_int;
v1_int.resize(10);
for (size_t i = 0; i < v1_int.size(); i++)
v1_int.get(i) = 5;
v1.resize(vcl.getProcessUnitID());
for(size_t i = 0 ; i < vcl.getProcessUnitID() ; i++)
v1.template get<0>(i) = v1_int;
openfpm::vector<aggregate<openfpm::vector<int>>> v2;
/*
vcl.SGather(v1,v2,(i%vcl.getProcessingUnits()));
if (vcl.getProcessUnitID() == (i%vcl.getProcessingUnits()))
{ {
size_t n = vcl.getProcessingUnits(); size_t n = vcl.getProcessingUnits();
BOOST_REQUIRE_EQUAL(v2.size(),n*(n-1)/2); BOOST_REQUIRE_EQUAL(v2.size(),n*(n-1)/2);
...@@ -470,7 +384,6 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test_3) ...@@ -470,7 +384,6 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_test_3)
is_five &= (v2.get(i) == 5); is_five &= (v2.get(i) == 5);
BOOST_REQUIRE_EQUAL(is_five,true); BOOST_REQUIRE_EQUAL(is_five,true);
}*/
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment