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
ede7ff53
Commit
ede7ff53
authored
Mar 18, 2016
by
Pietro Incardona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing semantic communication
parent
730d7f34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
80 deletions
+11
-80
src/VCluster.hpp
src/VCluster.hpp
+2
-1
src/VCluster_semantic.ipp
src/VCluster_semantic.ipp
+3
-3
src/VCluster_semantic_unit_tests.hpp
src/VCluster_semantic_unit_tests.hpp
+6
-76
No files found.
src/VCluster.hpp
View file @
ede7ff53
...
...
@@ -17,6 +17,7 @@
#include "util/util_debug.hpp"
#endif
#include "util/Vcluster_log.hpp"
#include "memory/BHeapMemory.hpp"
#define MSG_LENGTH 1024
#define MSG_SEND_RECV 1025
...
...
@@ -161,7 +162,7 @@ class Vcluster
openfpm
::
vector
<
size_t
>
map
;
// Receive buffers
openfpm
::
vector
<
HeapMemory
>
recv_buf
;
openfpm
::
vector
<
B
HeapMemory
>
recv_buf
;
// barrier request
MPI_Request
bar_req
;
...
...
src/VCluster_semantic.ipp
View file @
ede7ff53
...
...
@@ -32,7 +32,7 @@ void reset_recv_buf()
*/
static void * msg_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, size_t ri, void * ptr)
{
openfpm::vector<
HeapMemory> * recv_buf = (openfpm::vector<
HeapMemory> *)ptr;
openfpm::vector<
BHeapMemory> * recv_buf = (openfpm::vector<B
HeapMemory> *)ptr;
if (recv_buf == NULL)
std::cerr << __FILE__ << ":" << __LINE__ << " Internal error this processor is not suppose to receive\n";
...
...
@@ -69,7 +69,7 @@ static void * msg_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i
* \return true if the function completed succefully
*
*/
template<typename T, typename S> bool SGather(T & send, S & recv,size_t root)
template<typename T, typename S> bool SGather(T & send, S & recv,size_t root
, int debug = 0
)
{
// Reset the receive buffer
reset_recv_buf();
...
...
@@ -89,7 +89,7 @@ template<typename T, typename S> bool SGather(T & send, S & recv,size_t root)
// for each received buffer create a memory reppresentation
// calculate the number of received elements
size_t n_ele = recv_buf.get(i).size() / sizeof(typename T::value_type);
// add the received particles to the vector
PtrMemory * ptr1 = new PtrMemory(recv_buf.get(i).getPointer(),recv_buf.get(i).size());
...
...
src/VCluster_semantic_unit_tests.hpp
View file @
ede7ff53
...
...
@@ -20,38 +20,7 @@ BOOST_AUTO_TEST_SUITE( VCluster_semantic_test )
BOOST_AUTO_TEST_CASE
(
Vcluster_semantic_gather
)
{
{
Vcluster
&
vcl
=
*
global_v_cluster
;
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
//! [Gather the data on master]
openfpm
::
vector
<
size_t
>
v1
;
v1
.
resize
(
vcl
.
getProcessUnitID
());
for
(
size_t
i
=
0
;
i
<
vcl
.
getProcessUnitID
()
;
i
++
)
v1
.
get
(
i
)
=
5
;
openfpm
::
vector
<
size_t
>
v2
;
vcl
.
SGather
(
v1
,
v2
,
0
);
//! [Gather the data on master]
if
(
vcl
.
getProcessUnitID
()
==
0
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
*
(
n
-
1
)
/
2
);
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
);
}
}
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
...
...
@@ -66,9 +35,9 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather)
openfpm
::
vector
<
size_t
>
v2
;
vcl
.
SGather
(
v1
,
v2
,
1
);
vcl
.
SGather
(
v1
,
v2
,
(
i
%
vcl
.
getProcessingUnits
())
);
if
(
vcl
.
getProcessUnitID
()
==
1
)
if
(
vcl
.
getProcessUnitID
()
==
(
i
%
vcl
.
getProcessingUnits
())
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
*
(
n
-
1
)
/
2
);
...
...
@@ -85,46 +54,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather)
BOOST_AUTO_TEST_CASE
(
Vcluster_semantic_struct_gather
)
{
{
Vcluster
&
vcl
=
*
global_v_cluster
;
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
//! [Gather the data on master complex]
openfpm
::
vector
<
A
>
v1
;
v1
.
resize
(
vcl
.
getProcessUnitID
());
for
(
size_t
i
=
0
;
i
<
vcl
.
getProcessUnitID
()
;
i
++
)
{
v1
.
get
(
i
).
a
=
5
;
v1
.
get
(
i
).
b
=
10.0
;
v1
.
get
(
i
).
c
=
11.0
;
}
openfpm
::
vector
<
A
>
v2
;
vcl
.
SGather
(
v1
,
v2
,
0
);
//! [Gather the data on master complex]
if
(
vcl
.
getProcessUnitID
()
==
0
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
*
(
n
-
1
)
/
2
);
bool
is_correct
=
true
;
for
(
size_t
i
=
0
;
i
<
v2
.
size
()
;
i
++
)
{
is_correct
&=
(
v2
.
get
(
i
).
a
==
5
);
is_correct
&=
(
v2
.
get
(
i
).
b
==
10.0
);
is_correct
&=
(
v2
.
get
(
i
).
c
==
11.0
);
}
BOOST_REQUIRE_EQUAL
(
is_correct
,
true
);
}
}
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
...
...
@@ -143,9 +73,9 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather)
openfpm
::
vector
<
A
>
v2
;
vcl
.
SGather
(
v1
,
v2
,
1
);
vcl
.
SGather
(
v1
,
v2
,
(
i
%
vcl
.
getProcessingUnits
())
);
if
(
vcl
.
getProcessUnitID
()
==
1
)
if
(
vcl
.
getProcessUnitID
()
==
(
i
%
vcl
.
getProcessingUnits
())
)
{
size_t
n
=
vcl
.
getProcessingUnits
();
BOOST_REQUIRE_EQUAL
(
v2
.
size
(),
n
*
(
n
-
1
)
/
2
);
...
...
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