Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_vcluster
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_vcluster
Commits
b929b2a7
Commit
b929b2a7
authored
Aug 24, 2016
by
Yaroslav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SGather and SSendRecv with packer are done, but SSendRecv still needs new tests
parent
7ee3820b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
199 additions
and
40 deletions
+199
-40
src/VCluster_semantic.ipp
src/VCluster_semantic.ipp
+73
-27
src/VCluster_semantic_unit_tests.hpp
src/VCluster_semantic_unit_tests.hpp
+126
-13
No files found.
src/VCluster_semantic.ipp
View file @
b929b2a7
...
...
@@ -54,6 +54,15 @@ private:
{
for (size_t i = 0 ; i < recv_buf.size() ; i++)
{
/*ExtPreAlloc<HeapMemory> & mem = *(new ExtPreAlloc<HeapMemory>(recv_buf.get(i).size(),recv_buf.get(i)));
mem.incRef();
Unpack_stat ps;
size_t n_ele = 0;
Unpacker<size_t, HeapMemory>::unpack(mem,n_ele,ps);*/
// calculate the number of received elements
size_t n_ele = recv_buf.get(i).size() / sizeof(typename T::value_type);
...
...
@@ -113,18 +122,39 @@ private:
static void packingRequest(T & send, size_t & tot_size, openfpm::vector<size_t> & sz)
{
typedef typename ::generate_indexes<int, has_max_prop<T, has_value_type<T>::value>::number, MetaFuncOrd>::result ind_prop_to_pack;
call_serialize_variadic<ind_prop_to_pack>::call_pr(send,tot_size);
if (has_pack<typename T::value_type>::type::value == false && is_vector<T>::value == true)
{
sz.add(send.size()*sizeof(typename T::value_type));
}
else
{
call_serialize_variadic<ind_prop_to_pack>::call_pr(send,tot_size);
#ifdef DEBUG
std::cout << "Tot_size: " << tot_size << std::endl;
std::cout << "Tot_size: " << tot_size << std::endl;
#endif
sz.add(tot_size);
sz.add(tot_size);
}
}
static void packing(ExtPreAlloc<HeapMemory> & mem, T & send, Pack_stat & sts, openfpm::vector<const void *> & send_buf)
{
typedef typename ::generate_indexes<int, has_max_prop<T, has_value_type<T>::value>::number, MetaFuncOrd>::result ind_prop_to_pack;
call_serialize_variadic<ind_prop_to_pack>::call_pack(mem,send,sts);
send_buf.add(mem.getPointerBase());
if (has_pack<typename T::value_type>::type::value == false && is_vector<T>::value == true)
{
#ifdef DEBUG
std::cout << "Inside SGather pack (has prp) (vector case) " << std::endl;
#endif
send_buf.add(send.getPointer());
}
else
{
#ifdef DEBUG
std::cout << "Inside SGather pack (has prp) (general case) " << std::endl;
#endif
call_serialize_variadic<ind_prop_to_pack>::call_pack(mem,send,sts);
send_buf.add(mem.getPointerBase());
}
}
static void unpacking(S & recv, openfpm::vector<BHeapMemory> & recv_buf, openfpm::vector<size_t> * sz = NULL)
...
...
@@ -141,12 +171,17 @@ private:
{
static void packingRequest(T & send, size_t & tot_size, openfpm::vector<size_t> & sz)
{
if (has_pack<typename T::value_type>::type::value == true)
if (has_pack<typename T::value_type>::type::value == false && is_vector<T>::value == true)
{
#ifdef DEBUG
std::cout << "Inside SGather pack request (no prp) " << std::endl;
std::cout << "Inside SGather pack request (no prp)
(vector case)
" << std::endl;
#endif
sz.add(send.size()*sizeof(typename T::value_type));
}
else
{
Packer<T,HeapMemory>::packRequest(send,tot_size);
#ifdef DEBUG
...
...
@@ -154,30 +189,26 @@ private:
#endif
sz.add(tot_size);
}
else
{
sz.add(send.size()*sizeof(typename T::value_type));
}
}
static void packing(ExtPreAlloc<HeapMemory> & mem, T & send, Pack_stat & sts, openfpm::vector<const void *> & send_buf)
{
if (has_pack<typename T::value_type>::type::value == false && is_vector<T>::value == true)
{
#ifdef DEBUG
std::cout << "Inside SGather pack (no prp)
" << std::endl;
std::cout << "Inside SGather pack (no prp) (vector case)
" << std::endl;
#endif
if (has_pack<typename T::value_type>::type::value == true)
{
Packer<T,HeapMemory>::pack(mem,send,sts);
send_buf.add(mem.getPointerBase());
send_buf.add(send.getPointer());
}
else
{
#ifdef DEBUG
std::cout << "Inside SGather pack (no prp) (
no pack insid
e) " << std::endl;
std::cout << "Inside SGather pack (no prp) (
genaral cas
e) " << std::endl;
#endif
send_buf.add(send.getPointer());
Packer<T,HeapMemory>::pack(mem,send,sts);
send_buf.add(mem.getPointerBase());
}
}
...
...
@@ -381,11 +412,13 @@ template<typename T, typename S> bool SGather(T & send, S & recv, openfpm::vecto
openfpm::vector<size_t> send_prc;
send_prc.add(root);
size_t tot_size = 0;
openfpm::vector<size_t> sz;
openfpm::vector<const void *> send_buf;
//Pack requesting
openfpm::vector<size_t> sz
;
size_t tot_size = 0
;
pack_unpack_cond<has_max_prop<T, has_value_type<T>::value>::value, T, S>::packingRequest(send, tot_size, sz);
...
...
@@ -397,7 +430,6 @@ template<typename T, typename S> bool SGather(T & send, S & recv, openfpm::vecto
//Packing
Pack_stat sts;
openfpm::vector<const void *> send_buf;
pack_unpack_cond<has_max_prop<T, has_value_type<T>::value>::value, T, S>::packing(mem, send, sts, send_buf);
...
...
@@ -530,12 +562,26 @@ template<typename T, typename S> bool SSendRecv(openfpm::vector<T> & send, S & r
openfpm::vector<const void *> send_buf;
openfpm::vector<size_t> sz_byte;
sz_byte.resize(send.size());
for (size_t i = 0; i < send.size() ; i++)
{
send_buf.add((char *)send.get(i).getPointer());
sz_byte.get(i) = send.get(i).size() * sizeof(typename T::value_type);
size_t tot_size = 0;
//Pack requesting
pack_unpack_cond<has_max_prop<T, has_value_type<T>::value>::value, T, S>::packingRequest(send.get(i), tot_size, sz_byte);
HeapMemory pmem;
ExtPreAlloc<HeapMemory> & mem = *(new ExtPreAlloc<HeapMemory>(tot_size,pmem));
mem.incRef();
//Packing
Pack_stat sts;
pack_unpack_cond<has_max_prop<T, has_value_type<T>::value>::value, T, S>::packing(mem, send.get(i), sts, send_buf);
}
// receive information
...
...
src/VCluster_semantic_unit_tests.hpp
View file @
b929b2a7
...
...
@@ -74,12 +74,12 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_2)
openfpm
::
vector
<
openfpm
::
vector
<
size_t
>>
v2
;
vcl
.
SGather
(
v1
,
v2
,
1
);
vcl
.
SGather
(
v1
,
v2
,
0
);
if
(
vcl
.
getProcessUnitID
()
==
1
)
if
(
vcl
.
getProcessUnitID
()
==
0
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
-
1
);
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
);
bool
is_five
=
true
;
for
(
size_t
i
=
0
;
i
<
v2
.
size
()
;
i
++
)
...
...
@@ -91,18 +91,20 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_2)
}
vcl
.
SGather
(
v1
,
v2
,
0
)
;
openfpm
::
vector
<
openfpm
::
vector
<
size_t
>>
v3
;
if
(
vcl
.
getProcessUnitID
()
==
0
)
vcl
.
SGather
(
v1
,
v3
,
1
);
if
(
vcl
.
getProcessUnitID
()
==
1
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v
2
.
size
(),
n
);
BOOST_REQUIRE_EQUAL
(
v
3
.
size
(),
n
-
1
);
bool
is_five
=
true
;
for
(
size_t
i
=
0
;
i
<
v
2
.
size
()
;
i
++
)
for
(
size_t
i
=
0
;
i
<
v
3
.
size
()
;
i
++
)
{
for
(
size_t
j
=
0
;
j
<
v
2
.
get
(
i
).
size
()
;
j
++
)
is_five
&=
(
v
2
.
get
(
i
).
get
(
j
)
==
5
);
for
(
size_t
j
=
0
;
j
<
v
3
.
get
(
i
).
size
()
;
j
++
)
is_five
&=
(
v
3
.
get
(
i
).
get
(
j
)
==
5
);
}
BOOST_REQUIRE_EQUAL
(
is_five
,
true
);
...
...
@@ -120,6 +122,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_3)
return
;
openfpm
::
vector
<
openfpm
::
vector
<
aggregate
<
float
,
openfpm
::
vector
<
size_t
>
,
Point_test
<
float
>>>
>
v1
;
openfpm
::
vector
<
aggregate
<
float
,
openfpm
::
vector
<
size_t
>
,
Point_test
<
float
>>>
v1_int
;
aggregate
<
float
,
openfpm
::
vector
<
size_t
>
,
Point_test
<
float
>>
aggr
;
openfpm
::
vector
<
size_t
>
v1_int2
;
...
...
@@ -203,11 +206,11 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_4)
openfpm
::
vector
<
grid_cpu
<
2
,
Point_test
<
float
>>>
v2
;
vcl
.
SGather
(
g1
,
v2
,
1
);
vcl
.
SGather
(
g1
,
v2
,
0
);
typedef
Point_test
<
float
>
p
;
if
(
vcl
.
getProcessUnitID
()
==
1
)
if
(
vcl
.
getProcessUnitID
()
==
0
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
);
...
...
@@ -362,8 +365,116 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather_6)
}
BOOST_REQUIRE_EQUAL
(
is_seven
,
true
);
}
if
(
vcl
.
getProcessUnitID
()
==
0
&&
i
==
99
)
std
::
cout
<<
"Semantic gather test stop"
<<
std
::
endl
;
}
}
BOOST_AUTO_TEST_CASE
(
Vcluster_semantic_gather_7
)
{
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
create_vcluster
();
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
openfpm
::
vector
<
Point_test
<
float
>>
v1
;
Point_test
<
float
>
p1
;
p1
.
fill
();
v1
.
resize
(
vcl
.
getProcessUnitID
());
for
(
size_t
i
=
0
;
i
<
vcl
.
getProcessUnitID
()
;
i
++
)
v1
.
get
(
i
)
=
p1
;
openfpm
::
vector
<
openfpm
::
vector
<
Point_test
<
float
>>>
v2
;
vcl
.
SGather
(
v1
,
v2
,
0
);
typedef
Point_test
<
float
>
p
;
if
(
vcl
.
getProcessUnitID
()
==
0
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
);
bool
match
=
true
;
for
(
size_t
i
=
0
;
i
<
v2
.
size
()
;
i
++
)
{
for
(
size_t
j
=
0
;
j
<
v2
.
get
(
i
).
size
()
;
j
++
)
{
Point_test
<
float
>
p2
=
v2
.
get
(
i
).
get
(
j
);
//BOOST_REQUIRE(p2 == p1);
match
&=
(
p2
.
template
get
<
p
::
x
>()
==
p1
.
template
get
<
p
::
x
>());
match
&=
(
p2
.
template
get
<
p
::
y
>()
==
p1
.
template
get
<
p
::
y
>());
match
&=
(
p2
.
template
get
<
p
::
z
>()
==
p1
.
template
get
<
p
::
z
>());
match
&=
(
p2
.
template
get
<
p
::
s
>()
==
p1
.
template
get
<
p
::
s
>());
match
&=
(
p2
.
template
get
<
p
::
v
>()[
0
]
==
p1
.
template
get
<
p
::
v
>()[
0
]);
match
&=
(
p2
.
template
get
<
p
::
v
>()[
1
]
==
p1
.
template
get
<
p
::
v
>()[
1
]);
match
&=
(
p2
.
template
get
<
p
::
v
>()[
2
]
==
p1
.
template
get
<
p
::
v
>()[
2
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
0
][
0
]
==
p1
.
template
get
<
p
::
t
>()[
0
][
0
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
0
][
1
]
==
p1
.
template
get
<
p
::
t
>()[
0
][
1
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
0
][
2
]
==
p1
.
template
get
<
p
::
t
>()[
0
][
2
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
1
][
0
]
==
p1
.
template
get
<
p
::
t
>()[
1
][
0
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
1
][
1
]
==
p1
.
template
get
<
p
::
t
>()[
1
][
1
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
1
][
2
]
==
p1
.
template
get
<
p
::
t
>()[
1
][
2
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
2
][
0
]
==
p1
.
template
get
<
p
::
t
>()[
2
][
0
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
2
][
1
]
==
p1
.
template
get
<
p
::
t
>()[
2
][
1
]);
match
&=
(
p2
.
template
get
<
p
::
t
>()[
2
][
2
]
==
p1
.
template
get
<
p
::
t
>()[
2
][
2
]);
}
}
BOOST_REQUIRE_EQUAL
(
match
,
true
);
}
}
}
BOOST_AUTO_TEST_CASE
(
Vcluster_semantic_gather_8
)
{
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
create_vcluster
();
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
openfpm
::
vector
<
Box
<
3
,
size_t
>>
v1
;
Box
<
3
,
size_t
>
bx
;
bx
.
setLow
(
0
,
1
);
bx
.
setLow
(
1
,
2
);
bx
.
setLow
(
2
,
3
);
bx
.
setHigh
(
0
,
4
);
bx
.
setHigh
(
1
,
5
);
bx
.
setHigh
(
2
,
6
);
v1
.
resize
(
vcl
.
getProcessUnitID
());
for
(
size_t
i
=
0
;
i
<
vcl
.
getProcessUnitID
()
;
i
++
)
v1
.
get
(
i
)
=
bx
;
openfpm
::
vector
<
openfpm
::
vector
<
Box
<
3
,
size_t
>>>
v2
;
vcl
.
SGather
(
v1
,
v2
,
0
);
if
(
vcl
.
getProcessUnitID
()
==
0
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
);
for
(
size_t
i
=
0
;
i
<
v2
.
size
()
;
i
++
)
{
for
(
size_t
j
=
0
;
j
<
v2
.
get
(
i
).
size
()
;
j
++
)
{
Box
<
3
,
size_t
>
b2
=
v2
.
get
(
i
).
get
(
j
);
BOOST_REQUIRE
(
bx
==
b2
);
}
}
}
}
}
...
...
@@ -405,6 +516,8 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather)
BOOST_REQUIRE_EQUAL
(
is_correct
,
true
);
}
if
(
vcl
.
getProcessUnitID
()
==
0
&&
i
==
99
)
std
::
cout
<<
"Semantic gather test stop"
<<
std
::
endl
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment