Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_pdata
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
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
argupta
openfpm_pdata
Commits
cc8365cf
Commit
cc8365cf
authored
Feb 14, 2018
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding missing testing files
parent
81970c3e
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
659 additions
and
425 deletions
+659
-425
CHANGELOG.md
CHANGELOG.md
+6
-8
example/Numerics/PS-CMA-ES/Makefile
example/Numerics/PS-CMA-ES/Makefile
+1
-1
example/Numerics/PS-CMA-ES/main.cpp
example/Numerics/PS-CMA-ES/main.cpp
+162
-77
openfpm_data
openfpm_data
+1
-1
src/Decomposition/CartDecomposition.hpp
src/Decomposition/CartDecomposition.hpp
+123
-6
src/Decomposition/Distribution/DistParMetisDistribution.hpp
src/Decomposition/Distribution/DistParMetisDistribution.hpp
+1
-3
src/Decomposition/Distribution/Distribution_unit_tests.hpp
src/Decomposition/Distribution/Distribution_unit_tests.hpp
+0
-5
src/Decomposition/Distribution/ParMetisDistribution.hpp
src/Decomposition/Distribution/ParMetisDistribution.hpp
+1
-0
src/Decomposition/Distribution/SpaceDistribution.hpp
src/Decomposition/Distribution/SpaceDistribution.hpp
+2
-0
src/Decomposition/ie_ghost.hpp
src/Decomposition/ie_ghost.hpp
+22
-30
src/Decomposition/ie_loc_ghost.hpp
src/Decomposition/ie_loc_ghost.hpp
+1
-1
src/Decomposition/nn_processor.hpp
src/Decomposition/nn_processor.hpp
+1
-1
src/Decomposition/tests/CartDecomposition_unit_test.cpp
src/Decomposition/tests/CartDecomposition_unit_test.cpp
+133
-4
src/Grid/Iterators/grid_dist_id_iterator_sub.hpp
src/Grid/Iterators/grid_dist_id_iterator_sub.hpp
+1
-1
src/Grid/grid_dist_id_unit_test.cpp
src/Grid/grid_dist_id_unit_test.cpp
+14
-22
src/Grid/grid_dist_id_unit_test_ext_dom.hpp
src/Grid/grid_dist_id_unit_test_ext_dom.hpp
+1
-1
src/Grid/grid_dist_id_unit_test_unb_ghost.hpp
src/Grid/grid_dist_id_unit_test_unb_ghost.hpp
+2
-2
src/Grid/grid_dist_key.hpp
src/Grid/grid_dist_key.hpp
+4
-3
src/Grid/staggered_dist_grid_util.hpp
src/Grid/staggered_dist_grid_util.hpp
+84
-16
src/Makefile.am
src/Makefile.am
+3
-3
src/Vector/performance/vector_dist_performance_common.hpp
src/Vector/performance/vector_dist_performance_common.hpp
+1
-0
src/Vector/performance/vector_dist_performance_util.hpp
src/Vector/performance/vector_dist_performance_util.hpp
+3
-116
src/Vector/tests/vector_dist_HDF5_chckpnt_restart_test.cpp
src/Vector/tests/vector_dist_HDF5_chckpnt_restart_test.cpp
+4
-7
src/Vector/tests/vector_dist_MP_unit_tests.cpp
src/Vector/tests/vector_dist_MP_unit_tests.cpp
+4
-3
src/Vector/tests/vector_dist_NN_tests.cpp
src/Vector/tests/vector_dist_NN_tests.cpp
+9
-5
src/Vector/tests/vector_dist_cell_list_tests.cpp
src/Vector/tests/vector_dist_cell_list_tests.cpp
+18
-15
src/Vector/tests/vector_dist_complex_prp_unit_test.cpp
src/Vector/tests/vector_dist_complex_prp_unit_test.cpp
+7
-3
src/Vector/tests/vector_dist_unit_test.cpp
src/Vector/tests/vector_dist_unit_test.cpp
+38
-66
src/Vector/vector_dist.hpp
src/Vector/vector_dist.hpp
+2
-2
src/Vector/vector_dist_comm.hpp
src/Vector/vector_dist_comm.hpp
+7
-19
src/Vector/vector_dist_dlb_test.hpp
src/Vector/vector_dist_dlb_test.hpp
+3
-0
src/main.cpp
src/main.cpp
+0
-4
No files found.
CHANGELOG.md
View file @
cc8365cf
# Change Log
All notable changes to this project will be documented in this file.
## [1.1.0]
## [1.1.0]
February 2018
### Added
-
Interface for Multi-vector dynamic load balancing
-
Added Verlet List with balanced Memory and wise memory form
-
Increaded performance for grid ghost get
-
Introduced forms to increase the performance of the grid iterator in case of stencil code (see example 5_GrayScott)
-
EMatrix wrapped eigen matrices compatibles with vector_dist_id
-
General tuning for high dimension vector_dist_id (up to 50 dimensions)
-
Added Discrete element Method example (8_DEM)
### Fixed
-
Installation/detection of PETSC
-
2D Fixing IO in binary for vector
-
1D Fixing grid writer in ASCII mode
### Changed
-
VerletList
<
3,
double
,
FAST
,
shift
<3,
double
>
> is now VerletList
<
3,
double
,
Mem_fast
<
>
, shift
<
3,
double
>
>
-
Fixing 2D IO in binary for vector
-
Fixing 1D grid writer in ASCII mode
## [1.0.0] 13 September 2017 (Codename: Vortex)
...
...
example/Numerics/PS-CMA-ES/Makefile
View file @
cc8365cf
...
...
@@ -7,7 +7,7 @@ LDIR =
OBJ
=
main.o
%.o
:
%.cpp
$(CC)
-O
0
-g
-c
--std
=
c++11
-o
$@
$<
$(INCLUDE_PATH)
$(CC)
-O
3
-g
-c
--std
=
c++11
-o
$@
$<
$(INCLUDE_PATH)
ps_cma_es
:
$(OBJ)
$(CC)
-o
$@
$^
$(CFLAGS)
$(LIBS_PATH)
$(LIBS)
...
...
example/Numerics/PS-CMA-ES/main.cpp
View file @
cc8365cf
This diff is collapsed.
Click to expand it.
openfpm_data
@
d4dd1167
Subproject commit
92aa87ad50e32a2999b856387e70a0c161a36945
Subproject commit
d4dd11672cd49676ec60d500bc55c26202142ca6
src/Decomposition/CartDecomposition.hpp
View file @
cc8365cf
...
...
@@ -41,6 +41,50 @@
#define CARTDEC_ERROR 2000lu
/*! \brief It spread the sub-sub-domain on a regular cartesian grid of size dim
*
* \warning this function only guarantee that the division on each direction is
* 2^n with some n and does not guarantee that the number of
* sub-sub-domain is preserved
*
* \param div number of division on each direction as output
* \param n_sub number of sub-domain
* \param dim_r dimension reduction
*
*/
template
<
unsigned
int
dim
>
static
void
nsub_to_div2
(
size_t
(
&
div
)[
dim
],
size_t
n_sub
,
size_t
dim_r
)
{
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
{
if
(
i
<
dim_r
)
{
div
[
i
]
=
openfpm
::
math
::
round_big_2
(
pow
(
n_sub
,
1.0
/
dim_r
));}
else
{
div
[
i
]
=
1
;}
}
}
/*! \brief It spread the sub-sub-domain on a regular cartesian grid of size dim
*
* \warning this function only guarantee that the division on each direction is
* 2^n with some n and does not guarantee that the number of
* sub-sub-domain is preserved
*
* \param div number of division on each direction as output
* \param n_sub number of sub-domain
* \param dim_r dimension reduction
*
*/
template
<
unsigned
int
dim
>
static
void
nsub_to_div
(
size_t
(
&
div
)[
dim
],
size_t
n_sub
,
size_t
dim_r
)
{
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
{
if
(
i
<
dim_r
)
{
div
[
i
]
=
std
::
floor
(
pow
(
n_sub
,
1.0
/
dim_r
));}
else
{
div
[
i
]
=
1
;}
}
}
#define COMPUTE_SKIN_SUB 1
/**
...
...
@@ -352,13 +396,13 @@ public:
// calculate the sub-divisions
size_t
div
[
dim
];
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
div
[
i
]
=
(
size_t
)
((
bound
.
getHigh
(
i
)
-
bound
.
getLow
(
i
))
/
cd
.
getCellBox
().
getP2
()[
i
]);
{
div
[
i
]
=
(
size_t
)
((
bound
.
getHigh
(
i
)
-
bound
.
getLow
(
i
))
/
cd
.
getCellBox
().
getP2
()[
i
]);}
// Initialize the geo_cell structure
ie_ghost
<
dim
,
T
>::
Initialize_geo_cell
(
bound
,
div
);
// Initialize shift vectors
ie_ghost
<
dim
,
T
>::
generateShiftVectors
(
domain
);
ie_ghost
<
dim
,
T
>::
generateShiftVectors
(
domain
,
bc
);
}
}
...
...
@@ -512,9 +556,7 @@ public:
\endverbatim
*
*
*
* \param ghost margins for each dimensions (p1 negative part) (p2 positive part)
* ghost margins for each dimensions (p1 negative part) (p2 positive part)
*
*
\verbatim
...
...
@@ -1045,6 +1087,77 @@ public:
}
}
/*! \brief Set the best parameters for the decomposition
*
* It based on number of processors and dimensionality find a "good" parameter setting
*
* \param domain_ domain to decompose
* \param bc boundary conditions
* \param ghost Ghost size
* \param sec_dist Distribution grid. The distribution grid help in reducing the underlying
* distribution problem simplifying decomposition problem. This is done in order to
* reduce the load/balancing dynamic load balancing problem
*
* \param dec_gran number of sub-sub-domain for each processor
*
*/
void
setGoodParameters
(
::
Box
<
dim
,
T
>
domain_
,
const
size_t
(
&
bc
)[
dim
],
const
Ghost
<
dim
,
T
>
&
ghost
,
size_t
dec_gran
,
const
grid_sm
<
dim
,
void
>
&
sec_dist
=
grid_sm
<
dim
,
void
>
())
{
size_t
div
[
dim
];
// Create a valid decomposition of the space
// Get the number of processor and calculate the number of sub-domain
// for decomposition
size_t
n_proc
=
v_cl
.
getProcessingUnits
();
size_t
n_sub
=
n_proc
*
dec_gran
;
// Calculate the maximum number (before merging) of sub-domain on
// each dimension
nsub_to_div2
(
div
,
n_sub
,
dim
);
/* for (size_t i = 0; i < dim; i++)
{
div[i] = openfpm::math::round_big_2(pow(n_sub, 1.0 / dim));
}*/
if
(
dim
>
3
)
{
long
int
dim_r
=
dim
-
1
;
do
{
// Check for adjustment
size_t
tot_size
=
1
;
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
{
tot_size
*=
div
[
i
];}
// the granularity is too coarse increase the divisions
if
(
tot_size
/
n_proc
>
0.75
*
dec_gran
)
{
break
;}
nsub_to_div
(
div
,
n_sub
,
dim_r
);
dim_r
--
;
}
while
(
dim_r
>
0
);
}
setParameters
(
div
,
domain_
,
bc
,
ghost
,
sec_dist
);
}
/*! \brief return the parameters of the decomposition
*
* \param div_ number of divisions in each dimension
*
*/
void
getParameters
(
size_t
(
&
div_
)[
dim
])
{
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
{
div_
[
i
]
=
this
->
gr
.
size
(
i
);}
}
/*! \brief Set the parameter of the decomposition
*
...
...
@@ -1057,7 +1170,11 @@ public:
* reduce the load/balancing dynamic load balancing problem
*
*/
void
setParameters
(
const
size_t
(
&
div_
)[
dim
],
::
Box
<
dim
,
T
>
domain_
,
const
size_t
(
&
bc
)[
dim
]
,
const
Ghost
<
dim
,
T
>
&
ghost
,
const
grid_sm
<
dim
,
void
>
&
sec_dist
=
grid_sm
<
dim
,
void
>
())
void
setParameters
(
const
size_t
(
&
div_
)[
dim
],
::
Box
<
dim
,
T
>
domain_
,
const
size_t
(
&
bc
)[
dim
],
const
Ghost
<
dim
,
T
>
&
ghost
,
const
grid_sm
<
dim
,
void
>
&
sec_dist
=
grid_sm
<
dim
,
void
>
())
{
// set the boundary conditions
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
...
...
src/Decomposition/Distribution/DistParMetisDistribution.hpp
View file @
cc8365cf
...
...
@@ -272,9 +272,7 @@ public:
/*! \brief return number of moved vertices in all iterations so far
*
* \param id vertex id
*
* \return vector with x, y, z
* \return number of moved vertices
*
*/
size_t
getMaxMovedV
()
...
...
src/Decomposition/Distribution/Distribution_unit_tests.hpp
View file @
cc8365cf
...
...
@@ -422,11 +422,6 @@ BOOST_AUTO_TEST_CASE( Space_distribution_test)
//! [refine with dist_parmetis the decomposition]
}
void
print_test_v
(
std
::
string
test
,
size_t
sz
)
{
if
(
create_vcluster
().
getProcessUnitID
()
==
0
)
std
::
cout
<<
test
<<
" "
<<
sz
<<
"
\n
"
;
}
BOOST_AUTO_TEST_SUITE_END
()
...
...
src/Decomposition/Distribution/ParMetisDistribution.hpp
View file @
cc8365cf
...
...
@@ -304,6 +304,7 @@ public:
*
*/
ParMetisDistribution
(
ParMetisDistribution
<
dim
,
T
>
&&
pm
)
:
v_cl
(
pm
.
v_cl
)
{
this
->
operator
=
(
pm
);
}
...
...
src/Decomposition/Distribution/SpaceDistribution.hpp
View file @
cc8365cf
...
...
@@ -10,6 +10,7 @@
#include "util/mathutil.hpp"
#include "NN/CellList/CellDecomposer.hpp"
#include "Grid/grid_key_dx_iterator_hilbert.hpp"
/*! \brief Class that distribute sub-sub-domains across processors using an hilbert curve
* to divide the space
...
...
@@ -63,6 +64,7 @@ public:
*
*/
SpaceDistribution
(
SpaceDistribution
<
dim
,
T
>
&&
pm
)
:
v_cl
(
pm
.
v_cl
)
{
this
->
operator
=
(
pm
);
}
...
...
src/Decomposition/ie_ghost.hpp
View file @
cc8365cf
...
...
@@ -10,6 +10,8 @@
#include "common.hpp"
#include "nn_processor.hpp"
#include "Decomposition/shift_vect_converter.hpp"
/*! \brief structure that store and compute the internal and external local ghost box
*
...
...
@@ -49,6 +51,8 @@ class ie_ghost
//! Temporal buffers to return temporal information
openfpm
::
vector
<
size_t
>
ids
;
//! shift converter
shift_vect_converter
<
dim
,
T
>
sc_convert
;
/*! \brief Given a local sub-domain i, it give the id of such sub-domain in the sent list
* for the processor p_id
...
...
@@ -153,35 +157,9 @@ protected:
* \param domain box that describe the domain
*
*/
void
generateShiftVectors
(
const
Box
<
dim
,
T
>
&
domain
)
void
generateShiftVectors
(
const
Box
<
dim
,
T
>
&
domain
,
size_t
(
&
bc
)[
dim
]
)
{
shifts
.
resize
(
openfpm
::
math
::
pow
(
3
,
dim
));
HyperCube
<
dim
>
hyp
;
for
(
long
int
i
=
dim
-
1
;
i
>=
0
;
i
--
)
{
std
::
vector
<
comb
<
dim
>>
cmbs
=
hyp
.
getCombinations_R
(
i
);
for
(
size_t
j
=
0
;
j
<
cmbs
.
size
()
;
j
++
)
{
for
(
size_t
k
=
0
;
k
<
dim
;
k
++
)
{
switch
(
cmbs
[
j
][
k
])
{
case
1
:
shifts
.
get
(
cmbs
[
j
].
lin
()).
template
get
<
0
>()[
k
]
=
-
(
domain
.
getHigh
(
k
)
-
domain
.
getLow
(
k
));
break
;
case
0
:
shifts
.
get
(
cmbs
[
j
].
lin
()).
template
get
<
0
>()[
k
]
=
0
;
break
;
case
-
1
:
shifts
.
get
(
cmbs
[
j
].
lin
()).
template
get
<
0
>()[
k
]
=
(
domain
.
getHigh
(
k
)
-
domain
.
getLow
(
k
));
break
;
}
}
}
}
sc_convert
.
generateShiftVectors
(
domain
,
bc
,
shifts
);
}
/*! \brief Initialize the geo cell list structure
...
...
@@ -196,7 +174,7 @@ protected:
void
Initialize_geo_cell
(
const
Box
<
dim
,
T
>
&
domain
,
const
size_t
(
&
div
)[
dim
])
{
// Initialize the geo_cell structure
geo_cell
.
Initialize
(
domain
,
div
);
geo_cell
.
Initialize
(
domain
,
div
,
0
);
}
/*! \brief Create the box_nn_processor_int (bx part) structure
...
...
@@ -371,7 +349,7 @@ protected:
b_int
.
lc_proc
=
lc_proc
;
// fill the shift id
b_int
.
shift_id
=
nn_p_box_pos
.
get
(
k
).
lin
(
);
b_int
.
shift_id
=
convertShift
(
nn_p_box_pos
.
get
(
k
)
);
//
// Updating
...
...
@@ -531,6 +509,20 @@ public:
return
shifts
;
}
/*! It return the converted shift vector
*
* In high dimensions the number of shifts vectors explode exponentially, so we are
* expecting that some of the boundary is non periodic to reduce the numbers of shift
* vectors
*
* \return the shift vectors
*
*/
size_t
convertShift
(
const
comb
<
dim
>
&
cmb
)
{
return
sc_convert
.
linId
(
cmb
);
}
/*! \brief Get the number of Internal ghost boxes for one processor
*
* \param id near processor list id (the id go from 0 to getNNProcessor())
...
...
src/Decomposition/ie_loc_ghost.hpp
View file @
cc8365cf
...
...
@@ -159,7 +159,7 @@ class ie_loc_ghost
// that must be adjusted, each of this boxes define a shift in case of periodic boundary condition
for
(
long
int
i
=
dim
-
1
;
i
>=
0
;
i
--
)
{
std
::
vector
<
comb
<
dim
>>
cmbs
=
hyp
.
getCombinations_R
(
i
);
std
::
vector
<
comb
<
dim
>>
cmbs
=
hyp
.
getCombinations_R
_bc
(
i
,
bc
);
for
(
size_t
j
=
0
;
j
<
cmbs
.
size
()
;
j
++
)
{
...
...
src/Decomposition/nn_processor.hpp
View file @
cc8365cf
...
...
@@ -178,7 +178,7 @@ class nn_prcs
// that must be adjusted, each of this boxes define a shift in case of periodic boundary condition
for
(
long
int
i
=
dim
-
1
;
i
>=
0
;
i
--
)
{
std
::
vector
<
comb
<
dim
>>
cmbs
=
hyp
.
getCombinations_R
(
i
);
std
::
vector
<
comb
<
dim
>>
cmbs
=
hyp
.
getCombinations_R
_bc
(
i
,
bc
);
for
(
size_t
j
=
0
;
j
<
cmbs
.
size
()
;
j
++
)
{
...
...
src/Decomposition/
CartDecomposition_unit_test.h
pp
→
src/Decomposition/
tests/CartDecomposition_unit_test.c
pp
View file @
cc8365cf
#
ifndef CARTDECOMPOSITION_UNIT_TEST_HPP
#
define CARTDECOMPOSITION_UNIT_TEST_HPP
#
define BOOST_TEST_DYN_LINK
#
include <boost/test/unit_test.hpp>
#include "CartDecomposition.hpp"
#include "
Decomposition/
CartDecomposition.hpp"
#include "util/mathutil.hpp"
BOOST_AUTO_TEST_SUITE
(
CartDecomposition_test
)
...
...
@@ -414,6 +414,135 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_non_periodic_test_dist_grid)
BOOST_REQUIRE_EQUAL
(
val
,
true
);
}
BOOST_AUTO_TEST_CASE
(
CartDecomposition_nsub_algo_functions_test
)
{
size_t
n_sub
=
64
*
2
;
size_t
div
[
3
];
nsub_to_div2
<
3
>
(
div
,
n_sub
,
3
);
BOOST_REQUIRE_EQUAL
(
div
[
0
],
8ul
);
BOOST_REQUIRE_EQUAL
(
div
[
1
],
8ul
);
BOOST_REQUIRE_EQUAL
(
div
[
2
],
8ul
);
nsub_to_div2
<
3
>
(
div
,
n_sub
,
2
);
BOOST_REQUIRE_EQUAL
(
div
[
0
],
16ul
);
BOOST_REQUIRE_EQUAL
(
div
[
1
],
16ul
);
BOOST_REQUIRE_EQUAL
(
div
[
2
],
1ul
);
nsub_to_div2
<
3
>
(
div
,
n_sub
,
1
);
BOOST_REQUIRE_EQUAL
(
div
[
0
],
128ul
);
BOOST_REQUIRE_EQUAL
(
div
[
1
],
1ul
);
BOOST_REQUIRE_EQUAL
(
div
[
2
],
1ul
);
n_sub
=
64
*
3
;
nsub_to_div
<
3
>
(
div
,
n_sub
,
3
);
BOOST_REQUIRE_EQUAL
(
div
[
0
],
5ul
);
BOOST_REQUIRE_EQUAL
(
div
[
1
],
5ul
);
BOOST_REQUIRE_EQUAL
(
div
[
2
],
5ul
);
nsub_to_div
<
3
>
(
div
,
n_sub
,
2
);
BOOST_REQUIRE_EQUAL
(
div
[
0
],
13ul
);
BOOST_REQUIRE_EQUAL
(
div
[
1
],
13ul
);
BOOST_REQUIRE_EQUAL
(
div
[
2
],
1ul
);
nsub_to_div
<
3
>
(
div
,
n_sub
,
1
);
BOOST_REQUIRE_EQUAL
(
div
[
0
],
192ul
);
BOOST_REQUIRE_EQUAL
(
div
[
1
],
1ul
);
BOOST_REQUIRE_EQUAL
(
div
[
2
],
1ul
);
// Test high dimension cart decomposition subdivision
Box
<
50
,
double
>
domain
;
size_t
bc
[
50
];
Ghost
<
50
,
double
>
ghost
(
0.01
);
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
domain
.
setLow
(
i
,
0.0
);
domain
.
setHigh
(
i
,
1.0
);
bc
[
i
]
=
NON_PERIODIC
;
}
CartDecomposition
<
50
,
double
>
dec
(
create_vcluster
());
dec
.
setGoodParameters
(
domain
,
bc
,
ghost
,
64
);
size_t
div2
[
50
];
dec
.
getParameters
(
div2
);
auto
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
size
()
==
1
)
{
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
if
(
i
<
6
)
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
2ul
);}
else
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
1ul
);}
}
}
if
(
v_cl
.
size
()
==
2
)
{
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
if
(
i
<
7
)
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
2ul
);}
else
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
1ul
);}
}
}
if
(
v_cl
.
size
()
==
3
)
{
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
if
(
i
<
2
)
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
13ul
);}
else
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
1ul
);}
}
}
if
(
v_cl
.
size
()
==
4
)
{
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
if
(
i
<
8
)
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
2ul
);}
else
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
1ul
);}
}
}
if
(
v_cl
.
size
()
==
5
)
{
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
if
(
i
<
8
)
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
2ul
);}
else
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
1ul
);}
}
}
if
(
v_cl
.
size
()
==
6
)
{
for
(
size_t
i
=
0
;
i
<
50
;
i
++
)
{
if
(
i
<
3
)
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
7ul
);}
else
{
BOOST_REQUIRE_EQUAL
(
div2
[
i
],
1ul
);}
}
}
}
BOOST_AUTO_TEST_SUITE_END
()
#endif
src/Grid/Iterators/grid_dist_id_iterator_sub.hpp
View file @
cc8365cf
...
...
@@ -302,7 +302,7 @@ class grid_dist_iterator_sub
int sx = uhi[0]+1;\
int sxsy = (uhi[0]+1)*(uhi[1]+1);
#define ITERATE_3D_M(n_pt)
int i = lo[2];\
#define ITERATE_3D_M(n_pt) int i = lo[2];\
for ( ; i <= hi[2] ; i+=1)\
{\
int j = lo[1];\
...
...
src/Grid/grid_dist_id_unit_test.cpp
View file @
cc8365cf
#ifndef GRID_DIST_UNIT_TEST_HPP
#define GRID_DIST_UNIT_TEST_HPP
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
...
...
@@ -8,14 +5,10 @@
#include "grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
extern
void
print_test_v
(
std
::
string
test
,
size_t
sz
);
BOOST_AUTO_TEST_SUITE
(
grid_dist_id_test
)
void
print_test
(
std
::
string
test
,
size_t
sz
)
{
if
(
create_vcluster
().
getProcessUnitID
()
==
0
)
std
::
cout
<<
test
<<
" "
<<
sz
<<
"
\n
"
;
}
BOOST_AUTO_TEST_CASE
(
grid_dist_id_domain_grid_unit_converter3D_test
)
{
...
...
@@ -38,7 +31,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_domain_grid_unit_converter3D_test)
big_step
=
(
big_step
==
0
)
?
1
:
big_step
;
long
int
small_step
=
21
;
print_test
(
"Testing 3D grid converter k<="
,
k
);
print_test
_v
(
"Testing 3D grid converter k<="
,
k
);
// 3D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -166,7 +159,7 @@ void Test2D(const Box<2,float> & domain, long int k)
big_step
=
(
big_step
==
0
)
?
1
:
big_step
;
long
int
small_step
=
21
;
print_test
(
"Testing 2D grid k<="
,
k
);
print_test
_v
(
"Testing 2D grid k<="
,
k
);
// 2D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -287,7 +280,7 @@ void Test1D(const Box<1,float> & domain, long int k)
if
(
v_cl
.
getProcessingUnits
()
>
48
)
return
;
print_test
(
"Testing 1D grid k<="
,
k
);
print_test
_v
(
"Testing 1D grid k<="
,
k
);
// 1D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -404,7 +397,7 @@ void Test3D_sub(const Box<3,float> & domain, long int k)
if
(
create_vcluster
().
getProcessingUnits
()
>
32
)
return
;
print_test
(
"Testing 3D grid sub k<="
,
k
);
print_test
_v
(
"Testing 3D grid sub k<="
,
k
);
// 3D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -513,7 +506,7 @@ void Test3D(const Box<3,float> & domain, long int k)
big_step
=
(
big_step
==
0
)
?
1
:
big_step
;
long
int
small_step
=
21
;
print_test
(
"Testing 3D grid k<="
,
k
);
print_test
_v
(
"Testing 3D grid k<="
,
k
);
// 3D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -626,7 +619,7 @@ void Test3D_gg(const Box<3,float> & domain, long int k, long int gk)
if
(
create_vcluster
().
getProcessingUnits
()
>
32
)
return
;
print_test
(
"Testing 3D grid k<="
,
k
);
print_test
_v
(
"Testing 3D grid k<="
,
k
);
// 3D test
for
(
;
k
>
64
;
k
/=
2
)
...
...
@@ -677,7 +670,7 @@ void Test3D_domain(const Box<3,float> & domain, long int k, const periodicity<3>
big_step
=
(
big_step
==
0
)
?
1
:
big_step
;
long
int
small_step
=
21
;
print_test
(
"Testing 3D grid shift domain k<="
,
k
);
print_test
_v
(
"Testing 3D grid shift domain k<="
,
k
);
// 3D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -782,7 +775,7 @@ void Test2D_complex(const Box<2,float> & domain, long int k)
big_step
=
(
big_step
==
0
)
?
1
:
big_step
;
long
int
small_step
=
21
;
print_test
(
"Testing 2D complex grid k<="
,
k
);
print_test
_v
(
"Testing 2D complex grid k<="
,
k
);
// 2D test
for
(
;
k
>=
2
;
k
-=
(
k
>
2
*
big_step
)
?
big_step
:
small_step
)
...
...
@@ -946,7 +939,7 @@ void Test3D_complex(const Box<3,float> & domain, long int k)