Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pairs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
software
pairs
Commits
53d4c62d
Commit
53d4c62d
authored
2 years ago
by
Rafael Ravedutti
Browse files
Options
Downloads
Patches
Plain Diff
Adjustments to GPU/MPI version
Signed-off-by:
Rafael Ravedutti
<
rafaelravedutti@gmail.com
>
parent
94332a50
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
runtime/pairs.cpp
+17
-0
17 additions, 0 deletions
runtime/pairs.cpp
runtime/pairs.hpp
+1
-0
1 addition, 0 deletions
runtime/pairs.hpp
src/pairs/ir/module.py
+4
-2
4 additions, 2 deletions
src/pairs/ir/module.py
src/pairs/sim/comm.py
+4
-0
4 additions, 0 deletions
src/pairs/sim/comm.py
with
26 additions
and
2 deletions
runtime/pairs.cpp
+
17
−
0
View file @
53d4c62d
...
...
@@ -40,6 +40,12 @@ Array &PairsSimulation::getArrayByName(std::string name) {
return
*
a
;
}
Array
&
PairsSimulation
::
getArrayByHostPointer
(
const
void
*
h_ptr
)
{
auto
a
=
std
::
find_if
(
arrays
.
begin
(),
arrays
.
end
(),
[
h_ptr
](
Array
a
)
{
return
a
.
getHostPointer
()
==
h_ptr
;
});
PAIRS_ASSERT
(
a
!=
std
::
end
(
arrays
));
return
*
a
;
}
void
PairsSimulation
::
addProperty
(
Property
prop
)
{
int
id
=
prop
.
getId
();
auto
p
=
std
::
find_if
(
properties
.
begin
(),
properties
.
end
(),
[
id
](
Property
p
)
{
return
p
.
getId
()
==
id
;
});
...
...
@@ -100,6 +106,14 @@ void PairsSimulation::copyPropertyToHost(Property &prop) {
}
void
PairsSimulation
::
communicateSizes
(
int
dim
,
const
int
*
send_sizes
,
int
*
recv_sizes
)
{
auto
nsend_id
=
getArrayByHostPointer
(
send_sizes
).
getId
();
auto
nrecv_id
=
getArrayByHostPointer
(
recv_sizes
).
getId
();
copyArrayToHost
(
nsend_id
);
array_flags
->
setHostFlag
(
nsend_id
);
array_flags
->
clearDeviceFlag
(
nsend_id
);
array_flags
->
setHostFlag
(
nrecv_id
);
array_flags
->
clearDeviceFlag
(
nrecv_id
);
this
->
getDomainPartitioner
()
->
communicateSizes
(
dim
,
send_sizes
,
recv_sizes
);
PAIRS_DEBUG
(
"send_sizes=[%d, %d], recv_sizes=[%d, %d]
\n
"
,
send_sizes
[
dim
*
2
+
0
],
send_sizes
[
dim
*
2
+
1
],
recv_sizes
[
dim
*
2
+
0
],
recv_sizes
[
dim
*
2
+
1
]);
}
...
...
@@ -109,6 +123,9 @@ void PairsSimulation::communicateData(
const
real_t
*
send_buf
,
const
int
*
send_offsets
,
const
int
*
nsend
,
real_t
*
recv_buf
,
const
int
*
recv_offsets
,
const
int
*
nrecv
)
{
auto
recv_buf_id
=
getArrayByHostPointer
(
recv_buf
).
getId
();
array_flags
->
setHostFlag
(
recv_buf_id
);
array_flags
->
clearDeviceFlag
(
recv_buf_id
);
this
->
getDomainPartitioner
()
->
communicateData
(
dim
,
elem_size
,
send_buf
,
send_offsets
,
nsend
,
recv_buf
,
recv_offsets
,
nrecv
);
/*
...
...
This diff is collapsed.
Click to expand it.
runtime/pairs.hpp
+
1
−
0
View file @
53d4c62d
...
...
@@ -57,6 +57,7 @@ public:
Array
&
getArray
(
array_t
id
);
Array
&
getArrayByName
(
std
::
string
name
);
Array
&
getArrayByHostPointer
(
const
void
*
h_ptr
);
template
<
typename
T_ptr
>
void
addProperty
(
property_t
id
,
std
::
string
name
,
T_ptr
**
h_ptr
,
std
::
nullptr_t
,
PropertyType
type
,
layout_t
layout
,
size_t
sx
,
size_t
sy
=
1
);
...
...
This diff is collapsed.
Click to expand it.
src/pairs/ir/module.py
+
4
−
2
View file @
53d4c62d
...
...
@@ -65,13 +65,15 @@ class Module(ASTNode):
return
self
.
_host_references
def
properties_to_synchronize
(
self
):
return
{
p
for
p
in
self
.
_properties
if
self
.
_properties
[
p
][
0
]
==
'
r
'
}
#return {p for p in self._properties if self._properties[p][0] == 'r'}
return
{
p
for
p
in
self
.
_properties
}
def
write_properties
(
self
):
return
{
p
for
p
in
self
.
_properties
if
'
w
'
in
self
.
_properties
[
p
]}
def
arrays_to_synchronize
(
self
):
return
{
a
for
a
in
self
.
_arrays
if
a
.
sync
()
and
self
.
_arrays
[
a
][
0
]
==
'
r
'
}
#return {a for a in self._arrays if a.sync() and self._arrays[a][0] == 'r'}
return
{
a
for
a
in
self
.
_arrays
if
a
.
sync
()}
def
write_arrays
(
self
):
return
{
a
for
a
in
self
.
_arrays
if
a
.
sync
()
and
'
w
'
in
self
.
_arrays
[
a
]}
...
...
This diff is collapsed.
Click to expand it.
src/pairs/sim/comm.py
+
4
−
0
View file @
53d4c62d
...
...
@@ -115,6 +115,7 @@ class DetermineGhostParticles(Lowerable):
self
.
spacing
=
spacing
self
.
sim
.
add_statement
(
self
)
#@pairs_host_block
@pairs_device_block
def
lower
(
self
):
nsend_all
=
self
.
comm
.
nsend_all
...
...
@@ -189,6 +190,7 @@ class PackGhostParticles(Lowerable):
def
get_elems_per_particle
(
self
):
return
sum
([
self
.
sim
.
ndims
()
if
p
.
type
()
==
Types
.
Vector
else
1
for
p
in
self
.
prop_list
])
#@pairs_host_block
@pairs_device_block
def
lower
(
self
):
send_buffer
=
self
.
comm
.
send_buffer
...
...
@@ -230,6 +232,7 @@ class UnpackGhostParticles(Lowerable):
def
get_elems_per_particle
(
self
):
return
sum
([
self
.
sim
.
ndims
()
if
p
.
type
()
==
Types
.
Vector
else
1
for
p
in
self
.
prop_list
])
#@pairs_host_block
@pairs_device_block
def
lower
(
self
):
nlocal
=
self
.
sim
.
nlocal
...
...
@@ -285,6 +288,7 @@ class RemoveExchangedParticles_part2(Lowerable):
self
.
prop_list
=
prop_list
self
.
sim
.
add_statement
(
self
)
#@pairs_host_block
@pairs_device_block
def
lower
(
self
):
self
.
sim
.
module_name
(
"
remove_exchanged_particles_pt2
"
)
...
...
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