Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
da5b1073
Commit
da5b1073
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Code formatting
parent
171dddb5
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!433
Correct wrapping of multipoles in FFT task
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/engine.c
+35
-41
35 additions, 41 deletions
src/engine.c
src/parallel_io.c
+10
-10
10 additions, 10 deletions
src/parallel_io.c
src/partition.c
+5
-4
5 additions, 4 deletions
src/partition.c
src/proxy.c
+2
-2
2 additions, 2 deletions
src/proxy.c
src/proxy.h
+2
-2
2 additions, 2 deletions
src/proxy.h
with
54 additions
and
59 deletions
src/engine.c
+
35
−
41
View file @
da5b1073
...
@@ -4466,7 +4466,7 @@ void engine_makeproxies(struct engine *e) {
...
@@ -4466,7 +4466,7 @@ void engine_makeproxies(struct engine *e) {
for
(
int
i
=
0
;
i
<
cdim
[
0
];
i
++
)
{
for
(
int
i
=
0
;
i
<
cdim
[
0
];
i
++
)
{
for
(
int
j
=
0
;
j
<
cdim
[
1
];
j
++
)
{
for
(
int
j
=
0
;
j
<
cdim
[
1
];
j
++
)
{
for
(
int
k
=
0
;
k
<
cdim
[
2
];
k
++
)
{
for
(
int
k
=
0
;
k
<
cdim
[
2
];
k
++
)
{
/* Get the cell ID. */
/* Get the cell ID. */
const
int
cid
=
cell_getid
(
cdim
,
i
,
j
,
k
);
const
int
cid
=
cell_getid
(
cdim
,
i
,
j
,
k
);
...
@@ -4488,21 +4488,18 @@ void engine_makeproxies(struct engine *e) {
...
@@ -4488,21 +4488,18 @@ void engine_makeproxies(struct engine *e) {
/* Get the cell ID. */
/* Get the cell ID. */
const
int
cjd
=
cell_getid
(
cdim
,
ii
,
jj
,
kk
);
const
int
cjd
=
cell_getid
(
cdim
,
ii
,
jj
,
kk
);
/* Early abort (same cell) */
/* Early abort (same cell) */
if
(
cid
==
cjd
)
if
(
cid
==
cjd
)
continue
;
continue
;
/* Early abort (both same node) */
/* Early abort (both same node) */
if
(
cells
[
cid
].
nodeID
==
nodeID
&&
if
(
cells
[
cid
].
nodeID
==
nodeID
&&
cells
[
cjd
].
nodeID
==
nodeID
)
cells
[
cjd
].
nodeID
==
nodeID
)
continue
;
continue
;
/* Early abort (both foreign node) */
/* Early abort (both foreign node) */
if
(
cells
[
cid
].
nodeID
!=
nodeID
&&
if
(
cells
[
cid
].
nodeID
!=
nodeID
&&
cells
[
cjd
].
nodeID
!=
nodeID
)
cells
[
cjd
].
nodeID
!=
nodeID
)
continue
;
continue
;
char
proxy_type
=
proxy_cell_type_none
;
char
proxy_type
=
proxy_cell_type_none
;
/* In the gravity case, check distances using the MAC. */
/* In the gravity case, check distances using the MAC. */
if
(
with_gravity
)
{
if
(
with_gravity
)
{
...
@@ -4526,82 +4523,79 @@ void engine_makeproxies(struct engine *e) {
...
@@ -4526,82 +4523,79 @@ void engine_makeproxies(struct engine *e) {
}
}
const
double
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
const
double
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Are we too close for M2L? */
/* Are we too close for M2L? */
if
(
!
gravity_M2L_accept
(
r_max_i
,
r_max_j
,
theta_crit2
,
r2
))
if
(
!
gravity_M2L_accept
(
r_max_i
,
r_max_j
,
theta_crit2
,
r2
))
proxy_type
|=
proxy_cell_type_gravity
;
proxy_type
|=
proxy_cell_type_gravity
;
}
}
/* In the hydro case, only care about neighbours */
/* In the hydro case, only care about neighbours */
if
(
with_hydro
)
{
if
(
with_hydro
)
{
/* This is super-ugly but checks for direct neighbours */
/* This is super-ugly but checks for direct neighbours */
/* with periodic BC */
/* with periodic BC */
if
(((
abs
(
i
-
ii
)
<=
1
||
abs
(
i
-
ii
-
cdim
[
0
])
<=
1
||
if
(((
abs
(
i
-
ii
)
<=
1
||
abs
(
i
-
ii
-
cdim
[
0
])
<=
1
||
abs
(
i
-
ii
+
cdim
[
0
])
<=
1
)
&&
abs
(
i
-
ii
+
cdim
[
0
])
<=
1
)
&&
(
abs
(
j
-
jj
)
<=
1
||
abs
(
j
-
jj
-
cdim
[
1
])
<=
1
||
(
abs
(
j
-
jj
)
<=
1
||
abs
(
j
-
jj
-
cdim
[
1
])
<=
1
||
abs
(
j
-
jj
+
cdim
[
1
])
<=
1
)
&&
abs
(
j
-
jj
+
cdim
[
1
])
<=
1
)
&&
(
abs
(
k
-
kk
)
<=
1
||
abs
(
k
-
kk
-
cdim
[
2
])
<=
1
||
(
abs
(
k
-
kk
)
<=
1
||
abs
(
k
-
kk
-
cdim
[
2
])
<=
1
||
abs
(
k
-
kk
+
cdim
[
2
])
<=
1
)))
abs
(
k
-
kk
+
cdim
[
2
])
<=
1
)))
proxy_type
|=
proxy_cell_type_hydro
;
proxy_type
|=
proxy_cell_type_hydro
;
}
}
/* Abort if not in range at all */
/* Abort if not in range at all */
if
(
proxy_type
==
proxy_cell_type_none
)
if
(
proxy_type
==
proxy_cell_type_none
)
continue
;
continue
;
/* Add to proxies? */
/* Add to proxies? */
if
(
cells
[
cid
].
nodeID
==
nodeID
&&
if
(
cells
[
cid
].
nodeID
==
nodeID
&&
cells
[
cjd
].
nodeID
!=
nodeID
)
{
cells
[
cjd
].
nodeID
!=
nodeID
)
{
/* Do we already have a relationship with this node? */
/* Do we already have a relationship with this node? */
int
pid
=
e
->
proxy_ind
[
cells
[
cjd
].
nodeID
];
int
pid
=
e
->
proxy_ind
[
cells
[
cjd
].
nodeID
];
if
(
pid
<
0
)
{
if
(
pid
<
0
)
{
if
(
e
->
nr_proxies
==
engine_maxproxies
)
if
(
e
->
nr_proxies
==
engine_maxproxies
)
error
(
"Maximum number of proxies exceeded."
);
error
(
"Maximum number of proxies exceeded."
);
/* Ok, start a new proxy for this pair of nodes */
/* Ok, start a new proxy for this pair of nodes */
proxy_init
(
&
proxies
[
e
->
nr_proxies
],
e
->
nodeID
,
proxy_init
(
&
proxies
[
e
->
nr_proxies
],
e
->
nodeID
,
cells
[
cjd
].
nodeID
);
cells
[
cjd
].
nodeID
);
/* Store the information */
/* Store the information */
e
->
proxy_ind
[
cells
[
cjd
].
nodeID
]
=
e
->
nr_proxies
;
e
->
proxy_ind
[
cells
[
cjd
].
nodeID
]
=
e
->
nr_proxies
;
pid
=
e
->
nr_proxies
;
pid
=
e
->
nr_proxies
;
e
->
nr_proxies
+=
1
;
e
->
nr_proxies
+=
1
;
}
}
/* Add the cell to the proxy */
/* Add the cell to the proxy */
proxy_addcell_in
(
&
proxies
[
pid
],
&
cells
[
cjd
],
proxy_type
);
proxy_addcell_in
(
&
proxies
[
pid
],
&
cells
[
cjd
],
proxy_type
);
proxy_addcell_out
(
&
proxies
[
pid
],
&
cells
[
cid
],
proxy_type
);
proxy_addcell_out
(
&
proxies
[
pid
],
&
cells
[
cid
],
proxy_type
);
/* Store info about where to send the cell */
/* Store info about where to send the cell */
cells
[
cid
].
sendto
|=
(
1ULL
<<
pid
);
cells
[
cid
].
sendto
|=
(
1ULL
<<
pid
);
}
}
/* Same for the symmetric case? */
/* Same for the symmetric case? */
if
(
cells
[
cjd
].
nodeID
==
nodeID
&&
if
(
cells
[
cjd
].
nodeID
==
nodeID
&&
cells
[
cid
].
nodeID
!=
nodeID
)
{
cells
[
cid
].
nodeID
!=
nodeID
)
{
/* Do we already have a relationship with this node? */
/* Do we already have a relationship with this node? */
int
pid
=
e
->
proxy_ind
[
cells
[
cid
].
nodeID
];
int
pid
=
e
->
proxy_ind
[
cells
[
cid
].
nodeID
];
if
(
pid
<
0
)
{
if
(
pid
<
0
)
{
if
(
e
->
nr_proxies
==
engine_maxproxies
)
if
(
e
->
nr_proxies
==
engine_maxproxies
)
error
(
"Maximum number of proxies exceeded."
);
error
(
"Maximum number of proxies exceeded."
);
/* Ok, start a new proxy for this pair of nodes */
/* Ok, start a new proxy for this pair of nodes */
proxy_init
(
&
proxies
[
e
->
nr_proxies
],
e
->
nodeID
,
proxy_init
(
&
proxies
[
e
->
nr_proxies
],
e
->
nodeID
,
cells
[
cid
].
nodeID
);
cells
[
cid
].
nodeID
);
/* Store the information */
/* Store the information */
e
->
proxy_ind
[
cells
[
cid
].
nodeID
]
=
e
->
nr_proxies
;
e
->
proxy_ind
[
cells
[
cid
].
nodeID
]
=
e
->
nr_proxies
;
pid
=
e
->
nr_proxies
;
pid
=
e
->
nr_proxies
;
e
->
nr_proxies
+=
1
;
e
->
nr_proxies
+=
1
;
}
}
/* Add the cell to the proxy */
/* Add the cell to the proxy */
proxy_addcell_in
(
&
proxies
[
pid
],
&
cells
[
cid
],
proxy_type
);
proxy_addcell_in
(
&
proxies
[
pid
],
&
cells
[
cid
],
proxy_type
);
proxy_addcell_out
(
&
proxies
[
pid
],
&
cells
[
cjd
],
proxy_type
);
proxy_addcell_out
(
&
proxies
[
pid
],
&
cells
[
cjd
],
proxy_type
);
/* Store info about where to send the cell */
/* Store info about where to send the cell */
cells
[
cjd
].
sendto
|=
(
1ULL
<<
pid
);
cells
[
cjd
].
sendto
|=
(
1ULL
<<
pid
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/parallel_io.c
+
10
−
10
View file @
da5b1073
...
@@ -279,9 +279,9 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
...
@@ -279,9 +279,9 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
#ifdef IO_SPEED_MEASUREMENT
#ifdef IO_SPEED_MEASUREMENT
MPI_Barrier
(
MPI_COMM_WORLD
);
MPI_Barrier
(
MPI_COMM_WORLD
);
if
(
engine_rank
==
0
)
if
(
engine_rank
==
0
)
message
(
"Copying for '%s' took %.3f %s."
,
props
.
name
,
message
(
"Copying for '%s' took %.3f %s."
,
props
.
name
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
#endif
#endif
/* Create data space */
/* Create data space */
...
@@ -324,9 +324,9 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
...
@@ -324,9 +324,9 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
H5Sselect_none
(
h_filespace
);
H5Sselect_none
(
h_filespace
);
}
}
/* message("Writing %lld '%s', %zd elements = %zd bytes (int=%d) at offset
/* message("Writing %lld '%s', %zd elements = %zd bytes (int=%d) at offset
* %zd", N, props.name, N * props.dimension, N * props.dimension * typeSize, */
* %zd", N, props.name, N * props.dimension, N * props.dimension * typeSize, */
/* (int)(N * props.dimension * typeSize), offset); */
/* (int)(N * props.dimension * typeSize), offset); */
#ifdef IO_SPEED_MEASUREMENT
#ifdef IO_SPEED_MEASUREMENT
MPI_Barrier
(
MPI_COMM_WORLD
);
MPI_Barrier
(
MPI_COMM_WORLD
);
...
@@ -502,9 +502,9 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
...
@@ -502,9 +502,9 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
#ifdef IO_SPEED_MEASUREMENT
#ifdef IO_SPEED_MEASUREMENT
MPI_Barrier
(
MPI_COMM_WORLD
);
MPI_Barrier
(
MPI_COMM_WORLD
);
if
(
engine_rank
==
0
)
if
(
engine_rank
==
0
)
message
(
"'%s' took %.3f %s."
,
props
.
name
,
message
(
"'%s' took %.3f %s."
,
props
.
name
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
#endif
#endif
}
}
...
@@ -847,7 +847,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
...
@@ -847,7 +847,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
/* Activate parallel i/o */
/* Activate parallel i/o */
hid_t
h_err
=
H5Pset_fapl_mpio
(
plist_id
,
comm
,
info
);
hid_t
h_err
=
H5Pset_fapl_mpio
(
plist_id
,
comm
,
info
);
if
(
h_err
<
0
)
error
(
"Error setting parallel i/o"
);
if
(
h_err
<
0
)
error
(
"Error setting parallel i/o"
);
/* Align on 4k pages. */
/* Align on 4k pages. */
h_err
=
H5Pset_alignment
(
plist_id
,
1024
,
4096
);
h_err
=
H5Pset_alignment
(
plist_id
,
1024
,
4096
);
if
(
h_err
<
0
)
error
(
"Error setting Hdf5 alignment"
);
if
(
h_err
<
0
)
error
(
"Error setting Hdf5 alignment"
);
...
...
This diff is collapsed.
Click to expand it.
src/partition.c
+
5
−
4
View file @
da5b1073
...
@@ -578,10 +578,11 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
...
@@ -578,10 +578,11 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
/* Different weights for different tasks. */
/* Different weights for different tasks. */
if
(
t
->
type
==
task_type_drift_part
||
t
->
type
==
task_type_drift_gpart
||
if
(
t
->
type
==
task_type_drift_part
||
t
->
type
==
task_type_drift_gpart
||
t
->
type
==
task_type_ghost
||
t
->
type
==
task_type_extra_ghost
||
t
->
type
==
task_type_ghost
||
t
->
type
==
task_type_extra_ghost
||
t
->
type
==
task_type_kick1
||
t
->
type
==
task_type_kick2
||
t
->
type
==
task_type_kick1
||
t
->
type
==
task_type_kick2
||
t
->
type
==
task_type_timestep
||
t
->
type
==
task_type_init_grav
||
t
->
type
==
task_type_timestep
||
t
->
type
==
task_type_init_grav
||
t
->
type
==
task_type_grav_down
||
t
->
type
==
task_type_grav_long_range
)
{
t
->
type
==
task_type_grav_down
||
t
->
type
==
task_type_grav_long_range
)
{
/* Particle updates add only to vertex weight. */
/* Particle updates add only to vertex weight. */
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
...
...
This diff is collapsed.
Click to expand it.
src/proxy.c
+
2
−
2
View file @
da5b1073
...
@@ -456,8 +456,8 @@ void proxy_init(struct proxy *p, int mynodeID, int nodeID) {
...
@@ -456,8 +456,8 @@ void proxy_init(struct proxy *p, int mynodeID, int nodeID) {
if
((
p
->
cells_in
=
if
((
p
->
cells_in
=
(
struct
cell
**
)
malloc
(
sizeof
(
void
*
)
*
p
->
size_cells_in
))
==
NULL
)
(
struct
cell
**
)
malloc
(
sizeof
(
void
*
)
*
p
->
size_cells_in
))
==
NULL
)
error
(
"Failed to allocate cells_in buffer."
);
error
(
"Failed to allocate cells_in buffer."
);
if
((
p
->
cells_in_type
=
if
((
p
->
cells_in_type
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
p
->
size_cells_in
))
==
(
char
*
)
malloc
(
sizeof
(
char
)
*
p
->
size_cells_in
))
==
NULL
)
NULL
)
error
(
"Failed to allocate cells_in_type buffer."
);
error
(
"Failed to allocate cells_in_type buffer."
);
}
}
p
->
nr_cells_in
=
0
;
p
->
nr_cells_in
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/proxy.h
+
2
−
2
View file @
da5b1073
...
@@ -41,8 +41,8 @@
...
@@ -41,8 +41,8 @@
*/
*/
enum
proxy_cell_type
{
enum
proxy_cell_type
{
proxy_cell_type_none
=
0
,
proxy_cell_type_none
=
0
,
proxy_cell_type_hydro
=
(
1
<<
0
),
proxy_cell_type_hydro
=
(
1
<<
0
),
proxy_cell_type_gravity
=
(
1
<<
1
)
proxy_cell_type_gravity
=
(
1
<<
1
)
};
};
/* Data structure for the proxy. */
/* Data structure for the proxy. */
...
...
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