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
ee9f3fc1
Commit
ee9f3fc1
authored
8 years ago
by
Yaroslav
Browse files
Options
Downloads
Patches
Plain Diff
Work on grid map
parent
1c44e271
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Grid/grid_dist_id.hpp
+26
-2
26 additions, 2 deletions
src/Grid/grid_dist_id.hpp
src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
+33
-0
33 additions, 0 deletions
src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
src/Grid/grid_dist_id_comm.hpp
+39
-22
39 additions, 22 deletions
src/Grid/grid_dist_id_comm.hpp
with
98 additions
and
24 deletions
src/Grid/grid_dist_id.hpp
+
26
−
2
View file @
ee9f3fc1
...
@@ -1693,15 +1693,39 @@ public:
...
@@ -1693,15 +1693,39 @@ public:
getGlobalGridsInfo
(
gdb_ext_global
);
getGlobalGridsInfo
(
gdb_ext_global
);
std
::
cout
<<
"Global size: "
<<
gdb_ext_global
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"Global size: "
<<
gdb_ext_global
.
size
()
<<
std
::
endl
;
/*
for (size_t i = 0; i < gdb_ext_global.size(); i++)
for (size_t i = 0; i < gdb_ext_global.size(); i++)
{
{
std
::
cout
<<
"("
<<
gdb_ext_global
.
get
(
i
).
Dbox
.
getLow
(
0
)
<<
"; "
<<
gdb_ext_global
.
get
(
i
).
Dbox
.
get
High
(
0
)
<<
")"
<<
std
::
endl
;
std::cout << "(" << gdb_ext_global.get(i).Dbox.getLow(0) << "; " << gdb_ext_global.get(i).Dbox.get
Low(1) << "); (" << gdb_ext_global.get(i).Dbox.getHigh(0) << "; " << gdb_ext_global.get(i).Dbox.getHigh(1
) << ")" << std::endl;
std::cout << "I = " << i << ", Origin is (" << gdb_ext_global.get(i).origin.get(0) << "; " << gdb_ext_global.get(i).origin.get(1) << ")" << std::endl;
std::cout << "I = " << i << ", Origin is (" << gdb_ext_global.get(i).origin.get(0) << "; " << gdb_ext_global.get(i).origin.get(1) << ")" << std::endl;
}
}
*/
for
(
size_t
i
=
0
;
i
<
gdb_ext
.
size
();
i
++
)
{
Box
<
dim
,
long
int
>
box
=
gdb_ext
.
get
(
i
).
Dbox
;
box
+=
gdb_ext
.
get
(
i
).
origin
;
std
::
cout
<<
"("
<<
box
.
getLow
(
0
)
<<
"; "
<<
box
.
getLow
(
1
)
<<
"); ("
<<
box
.
getHigh
(
0
)
<<
"; "
<<
box
.
getHigh
(
1
)
<<
")"
<<
std
::
endl
;
}
this
->
template
map_
(
domain
,
dec
,
cd_sm
,
loc_grid
,
loc_grid_old
,
gdb_ext
,
gdb_ext_old
,
gdb_ext_global
);
this
->
template
map_
(
domain
,
dec
,
cd_sm
,
loc_grid
,
loc_grid_old
,
gdb_ext
,
gdb_ext_old
,
gdb_ext_global
);
}
}
void
gdb_ext_info
()
{
for
(
size_t
i
=
0
;
i
<
gdb_ext
.
size
();
i
++
)
{
Box
<
dim
,
long
int
>
box
=
gdb_ext
.
get
(
i
).
Dbox
;
box
+=
gdb_ext
.
get
(
i
).
origin
;
std
::
cout
<<
"("
<<
box
.
getLow
(
0
)
<<
"; "
<<
box
.
getLow
(
1
)
<<
"); ("
<<
box
.
getHigh
(
0
)
<<
"; "
<<
box
.
getHigh
(
1
)
<<
")"
<<
std
::
endl
;
}
std
::
cout
<<
"--------------"
<<
std
::
endl
;
for
(
size_t
i
=
0
;
i
<
dec
.
getNSubDomain
();
i
++
)
{
std
::
cout
<<
"("
<<
dec
.
getSubDomain
(
i
).
getLow
(
0
)
<<
"; "
<<
dec
.
getSubDomain
(
i
).
getLow
(
1
)
<<
"); ("
<<
dec
.
getSubDomain
(
i
).
getHigh
(
0
)
<<
"; "
<<
dec
.
getSubDomain
(
i
).
getHigh
(
1
)
<<
")"
<<
std
::
endl
;
}
std
::
cout
<<
"******************"
<<
std
::
endl
;
}
inline
void
save
(
const
std
::
string
&
filename
)
const
inline
void
save
(
const
std
::
string
&
filename
)
const
{
{
...
...
This diff is collapsed.
Click to expand it.
src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
+
33
−
0
View file @
ee9f3fc1
...
@@ -125,6 +125,39 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
...
@@ -125,6 +125,39 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
BOOST_REQUIRE_EQUAL
(
sum
,
(
size_t
)
k
*
k
);
BOOST_REQUIRE_EQUAL
(
sum
,
(
size_t
)
k
*
k
);
}
}
BOOST_AUTO_TEST_CASE
(
grid_gdb_test
)
{
// Input data
size_t
k
=
10
;
size_t
ghost_part
=
0.2
;
// Domain
Box
<
2
,
float
>
domain
({
0.0
,
0.0
},{
1.0
,
1.0
});
Vcluster
&
v_cl
=
create_vcluster
();
// Skip this test on big scale
if
(
v_cl
.
getProcessingUnits
()
>=
32
)
return
;
if
(
v_cl
.
getProcessUnitID
()
==
0
)
std
::
cout
<<
"Testing gdb_ext grid info..."
<<
std
::
endl
;
// grid size
size_t
sz
[
2
];
sz
[
0
]
=
k
;
sz
[
1
]
=
k
;
// Ghost
Ghost
<
2
,
float
>
g
(
ghost_part
);
// Distributed grid with id decomposition
grid_dist_id
<
2
,
float
,
scalar
<
float
>
,
CartDecomposition
<
2
,
float
>>
g_dist
(
sz
,
domain
,
g
);
g_dist
.
gdb_ext_info
();
}
BOOST_AUTO_TEST_SUITE_END
()
BOOST_AUTO_TEST_SUITE_END
()
#endif
/* SRC_GRID_GRID_DIST_ID_HDF5_CHCKPNT_RESTART_TEST_HPP_ */
#endif
/* SRC_GRID_GRID_DIST_ID_HDF5_CHCKPNT_RESTART_TEST_HPP_ */
This diff is collapsed.
Click to expand it.
src/Grid/grid_dist_id_comm.hpp
+
39
−
22
View file @
ee9f3fc1
...
@@ -60,7 +60,7 @@ public:
...
@@ -60,7 +60,7 @@ public:
/*! \brief Label intersection grids for mappings
/*! \brief Label intersection grids for mappings
*
*
* \param prc_sz For each processor the number of grids to send
* \param prc_sz For each processor the number of grids to send
to
*/
*/
inline
void
labelIntersectionGridsProcessor
(
Box
<
dim
,
St
>
domain
,
Decomposition
&
dec
,
CellDecomposer_sm
<
dim
,
St
,
shift
<
dim
,
St
>>
&
cd_sm
,
openfpm
::
vector
<
device_grid
>
&
loc_grid_old
,
openfpm
::
vector
<
GBoxes
<
device_grid
::
dims
>>
&
gdb_ext
,
openfpm
::
vector
<
GBoxes
<
device_grid
::
dims
>>
&
gdb_ext_old
,
openfpm
::
vector
<
GBoxes
<
device_grid
::
dims
>>
&
gdb_ext_global
,
openfpm
::
vector
<
openfpm
::
vector
<
device_grid
>>
&
lbl_b
,
openfpm
::
vector
<
size_t
>
&
prc_sz
)
inline
void
labelIntersectionGridsProcessor
(
Box
<
dim
,
St
>
domain
,
Decomposition
&
dec
,
CellDecomposer_sm
<
dim
,
St
,
shift
<
dim
,
St
>>
&
cd_sm
,
openfpm
::
vector
<
device_grid
>
&
loc_grid_old
,
openfpm
::
vector
<
GBoxes
<
device_grid
::
dims
>>
&
gdb_ext
,
openfpm
::
vector
<
GBoxes
<
device_grid
::
dims
>>
&
gdb_ext_old
,
openfpm
::
vector
<
GBoxes
<
device_grid
::
dims
>>
&
gdb_ext_global
,
openfpm
::
vector
<
openfpm
::
vector
<
device_grid
>>
&
lbl_b
,
openfpm
::
vector
<
size_t
>
&
prc_sz
)
{
{
...
@@ -72,22 +72,27 @@ public:
...
@@ -72,22 +72,27 @@ public:
for
(
size_t
i
=
0
;
i
<
gdb_ext_old
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
gdb_ext_old
.
size
();
i
++
)
{
{
// Local old sub-domain
// Local old sub-domain
SpaceBox
<
dim
,
St
>
sub_dom
=
gdb_ext_old
.
get
(
i
).
Dbox
;
SpaceBox
<
dim
,
long
int
>
sub_dom
=
gdb_ext_old
.
get
(
i
).
Dbox
;
sub_dom
+=
gdb_ext_old
.
get
(
i
).
origin
;
for
(
size_t
j
=
0
;
j
<
gdb_ext_global
.
size
();
j
++
)
for
(
size_t
j
=
0
;
j
<
gdb_ext_global
.
size
();
j
++
)
{
{
size_t
p_id
=
0
;
size_t
p_id
=
0
;
// Intersection box
// Intersection box
SpaceBox
<
dim
,
S
t
>
inte_box
;
SpaceBox
<
dim
,
long
in
t
>
inte_box
;
// Global new sub-domain
// Global new sub-domain
SpaceBox
<
dim
,
St
>
sub_dom_new
=
gdb_ext_global
.
get
(
j
).
Dbox
;
SpaceBox
<
dim
,
long
int
>
sub_dom_new
=
gdb_ext_global
.
get
(
j
).
Dbox
;
sub_dom_new
+=
gdb_ext_global
.
get
(
j
).
origin
;
bool
intersect
=
sub_dom
.
Intersect
(
sub_dom_new
,
inte_box
);
bool
intersect
=
sub_dom
.
Intersect
(
sub_dom_new
,
inte_box
);
if
(
intersect
==
true
)
if
(
intersect
==
true
)
{
{
//std::cout << "Inte_box: (" << inte_box.getLow(0) << "; " << inte_box.getLow(1) << "); (" << inte_box.getHigh(0) << "; " << inte_box.getHigh(1) << ")" << std::endl;
/*
/*
// Grid to send size
// Grid to send size
size_t sz1[dim];
size_t sz1[dim];
...
@@ -101,30 +106,40 @@ public:
...
@@ -101,30 +106,40 @@ public:
Point
<
dim
,
St
>
p
;
Point
<
dim
,
St
>
p
;
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
p
.
get
(
i
)
=
(
inte_box
.
getHigh
(
i
)
+
inte_box
.
getLow
(
i
))
/
2
;
p
.
get
(
i
)
=
(
inte_box
.
getHigh
(
i
)
+
inte_box
.
getLow
(
i
))
/
2
;
//std::cout << "Point: (" << p.get(0) << "; " << p.get(1) << ")" << std::endl;
p_id
=
dec
.
processorID
(
p
);
p_id
=
dec
.
processorID
(
p
);
prc_sz
.
get
(
p_id
)
++
;
prc_sz
.
get
(
p_id
)
++
;
std
::
cout
<<
"P_id: "
<<
p_id
<<
std
::
endl
;
//
std::cout << "P_id: " << p_id << std::endl;
// Convert intersection box from contiguous to discrete
// Convert intersection box from contiguous to discrete
SpaceBox
<
dim
,
long
int
>
inte_box_discr
=
cd_sm
.
convertDomainSpaceIntoGridUnits
(
inte_box
,
dec
.
periodicity
());
//
SpaceBox<dim,long int> inte_box_discr = cd_sm.convertDomainSpaceIntoGridUnits(inte_box,dec.periodicity());
std
::
cout
<<
"Beg:"
<<
inte_box_discr
.
getHigh
(
0
)
<<
"; "
<<
inte_box
.
getHigh
(
1
)
<<
std
::
endl
;
//
std::cout << "Beg:" << inte_box_discr.getHigh(0) << "; " << inte_box.getHigh(1) << std::endl;
std
::
cout
<<
"End:"
<<
inte_box_discr
.
getLow
(
0
)
<<
"; "
<<
inte_box
.
getLow
(
1
)
<<
std
::
endl
;
//
std::cout << "End:" << inte_box_discr.getLow(0) << "; " << inte_box.getLow(1) << std::endl;
// Transform coordinates to local
// Transform coordinates to local
inte_box_discr
-=
gdb_ext
.
get
(
i
).
origin
;
auto
inte_box_local
=
inte_box
;
inte_box_local
-=
gdb_ext_global
.
get
(
j
).
origin
;
//std::cout << "Inte_box_local: (" << inte_box_local.getLow(0) << "; " << inte_box_local.getLow(1) << "); (" << inte_box_local.getHigh(0) << "; " << inte_box_local.getHigh(1) << ")" << std::endl;
// Grid corresponding for gdb_ext_old.get(i) box
// Grid corresponding for gdb_ext_old.get(i) box
device_grid
gr
=
loc_grid_old
.
get
(
i
);
device_grid
gr
=
loc_grid_old
.
get
(
i
);
for
(
size_t
l
=
0
;
l
<
dim
;
l
++
)
std
::
cout
<<
"GR Size on "
<<
l
<<
" dimension: "
<<
gr
.
getGrid
().
size
(
l
)
<<
std
::
endl
;
// Size of the grid to send
// Size of the grid to send
size_t
sz
[
dim
];
size_t
sz
[
dim
];
for
(
size_t
l
=
0
;
l
<
dim
;
l
++
)
for
(
size_t
l
=
0
;
l
<
dim
;
l
++
)
{
{
sz
[
l
]
=
inte_box_
discr
.
getHigh
(
l
)
-
inte_box_
discr
.
getLow
(
l
);
sz
[
l
]
=
inte_box_
local
.
getHigh
(
l
)
-
inte_box_
local
.
getLow
(
l
);
//
std::cout << "
S
ize on " << l << " dimension: " << sz[l] << std::endl;
std
::
cout
<<
"
GR_send s
ize on "
<<
l
<<
" dimension: "
<<
sz
[
l
]
<<
std
::
endl
;
}
}
// Grid to send
// Grid to send
...
@@ -132,32 +147,34 @@ public:
...
@@ -132,32 +147,34 @@ public:
gr_send
.
setMemory
();
gr_send
.
setMemory
();
// Sub iterator across intersection box inside local grid
// Sub iterator across intersection box inside local grid
grid_key_dx
<
dim
>
start
=
inte_box_
discr
.
getKP1
();
grid_key_dx
<
dim
>
start
=
inte_box_
local
.
getKP1
();
grid_key_dx
<
dim
>
stop
=
inte_box_
discr
.
getKP2
();
grid_key_dx
<
dim
>
stop
=
inte_box_
local
.
getKP2
();
//std::string start2 = start.to_string();
//std::string start2 = start.to_string();
//std::string stop2 = stop.to_string();
//std::string stop2 = stop.to_string();
auto
key_
it
=
gr
.
getSubIterator
(
start
,
stop
);
auto
it
=
gr
.
getSubIterator
(
start
,
stop
);
// Copy selected elements into a new sub-grid
// Copy selected elements into a new sub-grid
while
(
key_
it
.
isNext
())
while
(
it
.
isNext
())
{
{
grid_key_dx
<
dim
>
key
=
key_
it
.
get
();
auto
key
=
it
.
get
();
//
std::string str = key.to_string();
std
::
string
str
=
key
.
to_string
();
//
std::cout << "Key: " << str << std::endl;
std
::
cout
<<
"Key: "
<<
str
<<
std
::
endl
;
gr_send
.
get_o
(
key
)
=
gr
.
get_o
(
key
);
gr_send
.
get_o
(
key
)
=
gr
.
get_o
(
key
);
//gr_send.template get<0>(key) = gr.template get<0>(key);
//gr.template get<0>(key)
//gr.template get<0>(key)
std
::
cout
<<
"8"
<<
std
::
endl
;
//gr_send.set(key,gr,key);
//gr_send.set(key,gr,key);
++
key_
it
;
++
it
;
}
}
// Add to the labeling vector
// Add to the labeling vector
lbl_b
.
get
(
p_id
).
add
(
gr_send
);
//
lbl_b.get(p_id).add(gr_send);
//std::cout << "9" << std::endl;
//std::cout << "9" << std::endl;
}
}
}
}
}
}
...
...
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