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
a3750c9b
Commit
a3750c9b
authored
7 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring test
parent
f2d7c8d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Vector/vector_dist_dlb_test.hpp
+157
-114
157 additions, 114 deletions
src/Vector/vector_dist_dlb_test.hpp
with
157 additions
and
114 deletions
src/Vector/vector_dist_dlb_test.hpp
+
157
−
114
View file @
a3750c9b
...
...
@@ -10,123 +10,11 @@
BOOST_AUTO_TEST_SUITE
(
vector_dist_dlb_test
)
template
<
typename
vector_type
>
void
test_dlb_vector
()
template
<
typename
vector_type
>
void
mp_test_template
(
vector_type
&
vd0
,
vector_type
&
vd1
,
vector_type
&
vd2
,
vector_type
&
vd3
)
{
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
>
8
)
return
;
Box
<
3
,
float
>
domain
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
Ghost
<
3
,
float
>
g
(
0.1
);
size_t
bc
[
3
]
=
{
PERIODIC
,
PERIODIC
,
PERIODIC
};
vector_type
vd
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
// Only processor 0 initialy add particles on a corner of a domain
if
(
v_cl
.
getProcessUnitID
()
==
0
)
{
for
(
size_t
i
=
0
;
i
<
50000
;
i
++
)
{
vd
.
add
();
vd
.
getLastPos
()[
0
]
=
((
float
)
rand
())
/
RAND_MAX
*
0.3
;
vd
.
getLastPos
()[
1
]
=
((
float
)
rand
())
/
RAND_MAX
*
0.3
;
vd
.
getLastPos
()[
2
]
=
((
float
)
rand
())
/
RAND_MAX
*
0.3
;
}
}
vd
.
map
();
vd
.
template
ghost_get
<
>();
ModelSquare
md
;
md
.
factor
=
10
;
vd
.
addComputationCosts
(
md
);
vd
.
getDecomposition
().
decompose
();
vd
.
map
();
vd
.
addComputationCosts
(
md
);
openfpm
::
vector
<
size_t
>
loads
;
size_t
load
=
vd
.
getDecomposition
().
getDistribution
().
getProcessorLoad
();
v_cl
.
allGather
(
load
,
loads
);
v_cl
.
execute
();
for
(
size_t
i
=
0
;
i
<
loads
.
size
()
;
i
++
)
{
float
load_f
=
load
;
float
load_fc
=
loads
.
get
(
i
);
BOOST_REQUIRE_CLOSE
(
load_f
,
load_fc
,
7.0
);
}
BOOST_REQUIRE
(
vd
.
size_local
()
!=
0
);
Point
<
3
,
float
>
v
({
1.0
,
1.0
,
1.0
});
for
(
size_t
i
=
0
;
i
<
25
;
i
++
)
{
// move the particles by 0.1
auto
it
=
vd
.
getDomainIterator
();
while
(
it
.
isNext
())
{
auto
p
=
it
.
get
();
vd
.
getPos
(
p
)[
0
]
+=
v
.
get
(
0
)
*
0.09
;
vd
.
getPos
(
p
)[
1
]
+=
v
.
get
(
1
)
*
0.09
;
vd
.
getPos
(
p
)[
2
]
+=
v
.
get
(
2
)
*
0.09
;
++
it
;
}
vd
.
map
();
ModelSquare
md
;
vd
.
addComputationCosts
(
md
);
vd
.
getDecomposition
().
redecompose
(
200
);
vd
.
map
();
BOOST_REQUIRE
(
vd
.
size_local
()
!=
0
);
vd
.
template
ghost_get
<
>();
vd
.
addComputationCosts
(
md
);
openfpm
::
vector
<
size_t
>
loads
;
size_t
load
=
vd
.
getDecomposition
().
getDistribution
().
getProcessorLoad
();
v_cl
.
allGather
(
load
,
loads
);
v_cl
.
execute
();
for
(
size_t
i
=
0
;
i
<
loads
.
size
()
;
i
++
)
{
float
load_f
=
load
;
float
load_fc
=
loads
.
get
(
i
);
BOOST_REQUIRE_CLOSE
(
load_f
,
load_fc
,
10.0
);
}
}
}
template
<
typename
vector_type
>
void
test_dlb_multi_phase_vector
()
{
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
>
8
)
return
;
Box
<
3
,
float
>
domain
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
Ghost
<
3
,
float
>
g
(
0.1
);
size_t
bc
[
3
]
=
{
PERIODIC
,
PERIODIC
,
PERIODIC
};
vector_type
vd0
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
vector_type
vd1
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
vector_type
vd2
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
vector_type
vd3
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
// Only processor 0 initialy add particles on a corner of a domain
if
(
v_cl
.
getProcessUnitID
()
==
0
)
...
...
@@ -320,6 +208,156 @@ template<typename vector_type> void test_dlb_multi_phase_vector()
}
}
template
<
typename
vector_type
>
void
test_dlb_vector
()
{
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
>
8
)
return
;
Box
<
3
,
float
>
domain
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
Ghost
<
3
,
float
>
g
(
0.1
);
size_t
bc
[
3
]
=
{
PERIODIC
,
PERIODIC
,
PERIODIC
};
vector_type
vd
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
// Only processor 0 initialy add particles on a corner of a domain
if
(
v_cl
.
getProcessUnitID
()
==
0
)
{
for
(
size_t
i
=
0
;
i
<
50000
;
i
++
)
{
vd
.
add
();
vd
.
getLastPos
()[
0
]
=
((
float
)
rand
())
/
RAND_MAX
*
0.3
;
vd
.
getLastPos
()[
1
]
=
((
float
)
rand
())
/
RAND_MAX
*
0.3
;
vd
.
getLastPos
()[
2
]
=
((
float
)
rand
())
/
RAND_MAX
*
0.3
;
}
}
vd
.
map
();
vd
.
template
ghost_get
<
>();
ModelSquare
md
;
md
.
factor
=
10
;
vd
.
addComputationCosts
(
md
);
vd
.
getDecomposition
().
decompose
();
vd
.
map
();
vd
.
addComputationCosts
(
md
);
openfpm
::
vector
<
size_t
>
loads
;
size_t
load
=
vd
.
getDecomposition
().
getDistribution
().
getProcessorLoad
();
v_cl
.
allGather
(
load
,
loads
);
v_cl
.
execute
();
for
(
size_t
i
=
0
;
i
<
loads
.
size
()
;
i
++
)
{
float
load_f
=
load
;
float
load_fc
=
loads
.
get
(
i
);
BOOST_REQUIRE_CLOSE
(
load_f
,
load_fc
,
7.0
);
}
BOOST_REQUIRE
(
vd
.
size_local
()
!=
0
);
Point
<
3
,
float
>
v
({
1.0
,
1.0
,
1.0
});
for
(
size_t
i
=
0
;
i
<
25
;
i
++
)
{
// move the particles by 0.1
auto
it
=
vd
.
getDomainIterator
();
while
(
it
.
isNext
())
{
auto
p
=
it
.
get
();
vd
.
getPos
(
p
)[
0
]
+=
v
.
get
(
0
)
*
0.09
;
vd
.
getPos
(
p
)[
1
]
+=
v
.
get
(
1
)
*
0.09
;
vd
.
getPos
(
p
)[
2
]
+=
v
.
get
(
2
)
*
0.09
;
++
it
;
}
vd
.
map
();
ModelSquare
md
;
vd
.
addComputationCosts
(
md
);
vd
.
getDecomposition
().
redecompose
(
200
);
vd
.
map
();
BOOST_REQUIRE
(
vd
.
size_local
()
!=
0
);
vd
.
template
ghost_get
<
>();
vd
.
addComputationCosts
(
md
);
openfpm
::
vector
<
size_t
>
loads
;
size_t
load
=
vd
.
getDecomposition
().
getDistribution
().
getProcessorLoad
();
v_cl
.
allGather
(
load
,
loads
);
v_cl
.
execute
();
for
(
size_t
i
=
0
;
i
<
loads
.
size
()
;
i
++
)
{
float
load_f
=
load
;
float
load_fc
=
loads
.
get
(
i
);
BOOST_REQUIRE_CLOSE
(
load_f
,
load_fc
,
10.0
);
}
}
}
template
<
typename
vector_type
>
void
test_dlb_multi_phase_vector
()
{
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
>
8
)
return
;
Box
<
3
,
float
>
domain
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
Ghost
<
3
,
float
>
g
(
0.1
);
size_t
bc
[
3
]
=
{
PERIODIC
,
PERIODIC
,
PERIODIC
};
vector_type
vd0
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
vector_type
vd1
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
vector_type
vd2
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
vector_type
vd3
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
mp_test_template
(
vd0
,
vd1
,
vd2
,
vd3
);
}
template
<
typename
vector_type
>
void
test_dlb_multi_phase_v_vector
()
{
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
>
8
)
return
;
Box
<
3
,
float
>
domain
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
Ghost
<
3
,
float
>
g
(
0.1
);
size_t
bc
[
3
]
=
{
PERIODIC
,
PERIODIC
,
PERIODIC
};
openfpm
::
vector
<
vector_type
>
v_phases
;
{
vector_type
vd0
(
0
,
domain
,
bc
,
g
,
DEC_GRAN
(
2048
));
v_phases
.
add
(
vd0
);
v_phases
.
add
(
vector_type
(
vd0
.
getDecomposition
(),
0
));
v_phases
.
add
(
vector_type
(
vd0
.
getDecomposition
(),
0
));
v_phases
.
add
(
vector_type
(
vd0
.
getDecomposition
(),
0
));
}
auto
&
vd0
=
v_phases
.
get
(
0
);
auto
&
vd1
=
v_phases
.
get
(
1
);
auto
&
vd2
=
v_phases
.
get
(
2
);
auto
&
vd3
=
v_phases
.
get
(
3
);
mp_test_template
(
vd0
,
vd1
,
vd2
,
vd3
);
}
BOOST_AUTO_TEST_CASE
(
vector_dist_dlb_test_part
)
{
test_dlb_vector
<
vector_dist
<
3
,
float
,
aggregate
<
float
>>>
();
...
...
@@ -330,6 +368,11 @@ BOOST_AUTO_TEST_CASE( vector_dist_dlb_multi_phase_test_part )
test_dlb_multi_phase_vector
<
vector_dist
<
3
,
float
,
aggregate
<
float
>>>
();
}
BOOST_AUTO_TEST_CASE
(
vector_dist_dlb_multi_phase_v_test_part
)
{
test_dlb_multi_phase_v_vector
<
vector_dist
<
3
,
float
,
aggregate
<
float
>>>
();
}
BOOST_AUTO_TEST_CASE
(
vector_dist_dlb_metis_test_part
)
{
test_dlb_vector
<
vector_dist
<
3
,
...
...
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