Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_pdata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_pdata
Commits
f7ab82da
Commit
f7ab82da
authored
4 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Adding box distribution test
parent
b5ce7a9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2753
passed
4 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Decomposition/Distribution/BoxDistribution.hpp
+10
-6
10 additions, 6 deletions
src/Decomposition/Distribution/BoxDistribution.hpp
src/Decomposition/Distribution/Distribution_unit_tests.hpp
+48
-0
48 additions, 0 deletions
src/Decomposition/Distribution/Distribution_unit_tests.hpp
with
58 additions
and
6 deletions
src/Decomposition/Distribution/BoxDistribution.hpp
+
10
−
6
View file @
f7ab82da
...
...
@@ -228,7 +228,8 @@ public:
getPrimeFactors
(
v_cl
.
size
(),
facts
);
size_t
div
[
dim
];
size_t
ln
[
dim
];
size_t
ln
[
dim
];
double
ln_d
[
dim
];
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
div
[
i
]
=
1
;}
...
...
@@ -237,7 +238,10 @@ public:
{
div
[
i
%
dim
]
*=
facts
.
get
(
i
);}
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
ln
[
i
]
=
gr
.
size
(
i
)
/
div
[
i
];}
{
ln
[
i
]
=
gr
.
size
(
i
)
/
div
[
i
];
ln_d
[
i
]
=
(
double
)
gr
.
size
(
i
)
/
div
[
i
];
}
grid_sm
<
dim
,
void
>
gr_proc
(
div
);
...
...
@@ -249,10 +253,10 @@ public:
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
key_prc
.
set_d
(
i
,
key
.
get
(
i
)
/
ln
[
i
]);
if
(
key_prc
.
get
(
i
)
>=
div
[
i
])
{
key_prc
.
set_d
(
i
,
div
[
i
]
-
1
);}
}
key_prc
.
set_d
(
i
,
key
.
get
(
i
)
/
ln
_d
[
i
]);
if
(
key_prc
.
get
(
i
)
>=
div
[
i
])
{
key_prc
.
set_d
(
i
,
div
[
i
]
-
1
);}
}
size_t
i
=
gr
.
LinId
(
key
);
...
...
This diff is collapsed.
Click to expand it.
src/Decomposition/Distribution/Distribution_unit_tests.hpp
+
48
−
0
View file @
f7ab82da
...
...
@@ -11,6 +11,7 @@
#include
"config.h"
#include
"SpaceDistribution.hpp"
#include
<unistd.h>
#include
"BoxDistribution.hpp"
/*! \brief Set a sphere as high computation cost
*
...
...
@@ -423,6 +424,53 @@ BOOST_AUTO_TEST_CASE( Space_distribution_test)
}
BOOST_AUTO_TEST_CASE
(
Box_distribution_test
)
{
Vcluster
<>
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
size
()
>
16
)
{
return
;}
//! [Initialize a ParMetis Cartesian graph and decompose]
BoxDistribution
<
3
,
float
>
box_dist
(
v_cl
);
// Physical domain
Box
<
3
,
float
>
box
(
{
0.0
,
0.0
,
0.0
},
{
10.0
,
10.0
,
10.0
});
// Grid info
grid_sm
<
3
,
void
>
info
(
{
GS_SIZE
,
GS_SIZE
,
GS_SIZE
});
// Initialize Cart graph and decompose
box_dist
.
createCartGraph
(
info
,
box
);
// First create the center of the weights distribution, check it is coherent to the size of the domain
Point
<
3
,
float
>
center
(
{
2.0
,
2.0
,
2.0
});
// first decomposition
box_dist
.
decompose
();
BOOST_REQUIRE_EQUAL
(
box_dist
.
get_ndec
(),
0ul
);
auto
&
graph
=
box_dist
.
getGraph
();
for
(
int
i
=
0
;
i
<
graph
.
getNVertex
()
;
i
++
)
{
BOOST_REQUIRE
(
graph
.
vertex
(
i
).
template
get
<
nm_v_proc_id
>()
<
v_cl
.
size
());
}
size_t
n_sub
=
box_dist
.
getNOwnerSubSubDomains
();
size_t
n_sub_tot
=
info
.
size
();
size_t
n_sub_bal
=
n_sub_tot
/
v_cl
.
size
();
BOOST_REQUIRE
(
(((
int
)
n_sub_bal
-
64
)
<=
(
long
int
)
n_sub
)
&&
(
n_sub_bal
+
64
>=
n_sub
)
);
//! [refine with parmetis the decomposition]
// BOOST_REQUIRE_EQUAL(sizeof(ParMetisDistribution<3,float>),872ul);
}
BOOST_AUTO_TEST_SUITE_END
()
#endif
/* SRC_DECOMPOSITION_DISTRIBUTION_DISTRIBUTION_UNIT_TESTS_HPP_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment