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
05795237
Commit
05795237
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Plain Diff
Merge branch 'newTimeDefinition' of gitlab.cosma.dur.ac.uk:swift/swiftsim into newTimeDefinition
parents
b3a684df
43719f43
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!79
First version of the multiple time-stepping
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/engine.c
+12
-9
12 additions, 9 deletions
src/engine.c
src/parallel_io.c
+4
-4
4 additions, 4 deletions
src/parallel_io.c
src/serial_io.c
+4
-4
4 additions, 4 deletions
src/serial_io.c
with
20 additions
and
17 deletions
src/engine.c
+
12
−
9
View file @
05795237
...
@@ -361,7 +361,8 @@ void engine_repartition(struct engine *e) {
...
@@ -361,7 +361,8 @@ void engine_repartition(struct engine *e) {
/* Skip un-interesting tasks. */
/* Skip un-interesting tasks. */
if
(
t
->
type
!=
task_type_self
&&
t
->
type
!=
task_type_pair
&&
if
(
t
->
type
!=
task_type_self
&&
t
->
type
!=
task_type_pair
&&
t
->
type
!=
task_type_sub
&&
t
->
type
!=
task_type_ghost
&&
t
->
type
!=
task_type_sub
&&
t
->
type
!=
task_type_ghost
&&
t
->
type
!=
task_type_kick1
&&
t
->
type
!=
task_type_kick
)
t
->
type
!=
task_type_drift
&&
t
->
type
!=
task_type_kick
&&
t
->
type
!=
task_type_init
)
continue
;
continue
;
/* Get the task weight. */
/* Get the task weight. */
...
@@ -391,8 +392,8 @@ void engine_repartition(struct engine *e) {
...
@@ -391,8 +392,8 @@ void engine_repartition(struct engine *e) {
cid
=
ci
-
cells
;
cid
=
ci
-
cells
;
/* Different weights for different tasks. */
/* Different weights for different tasks. */
if
(
t
->
type
==
task_type_ghost
||
t
->
type
==
task_type_
kick1
||
if
(
t
->
type
==
task_type_ghost
||
t
->
type
==
task_type_
drift
||
t
->
type
==
task_type_kick
)
{
t
->
type
==
task_type_kick
||
t
->
type
==
task_type_drift
)
{
/* Particle updates add only to vertex weight. */
/* Particle updates add only to vertex weight. */
weights_v
[
cid
]
+=
w
;
weights_v
[
cid
]
+=
w
;
...
@@ -1800,16 +1801,16 @@ void engine_step(struct engine *e) {
...
@@ -1800,16 +1801,16 @@ void engine_step(struct engine *e) {
/* Aggregate the data from the different nodes. */
/* Aggregate the data from the different nodes. */
#ifdef WITH_MPI
#ifdef WITH_MPI
double
in
[
3
],
out
[
3
];
double
in
[
3
],
out
[
3
];
out
[
0
]
=
d
t_min
;
out
[
0
]
=
t
_end
_min
;
if
(
MPI_Allreduce
(
out
,
in
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
MPI_COMM_WORLD
)
!=
if
(
MPI_Allreduce
(
out
,
in
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
MPI_SUCCESS
)
error
(
"Failed to aggregate dt_min."
);
error
(
"Failed to aggregate dt_min."
);
d
t_min
=
in
[
0
];
t
_end
_min
=
in
[
0
];
out
[
0
]
=
d
t_max
;
out
[
0
]
=
t
_end
_max
;
if
(
MPI_Allreduce
(
out
,
in
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
MPI_COMM_WORLD
)
!=
if
(
MPI_Allreduce
(
out
,
in
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
MPI_SUCCESS
)
error
(
"Failed to aggregate dt_max."
);
error
(
"Failed to aggregate dt_max."
);
d
t_max
=
in
[
0
];
t
_end
_max
=
in
[
0
];
out
[
0
]
=
count
;
out
[
0
]
=
count
;
out
[
1
]
=
ekin
;
out
[
1
]
=
ekin
;
out
[
2
]
=
epot
;
out
[
2
]
=
epot
;
...
@@ -2052,9 +2053,11 @@ void engine_split(struct engine *e, int *grid) {
...
@@ -2052,9 +2053,11 @@ void engine_split(struct engine *e, int *grid) {
* @param dt The initial time step to use.
* @param dt The initial time step to use.
* @param nr_threads The number of threads to spawn.
* @param nr_threads The number of threads to spawn.
* @param nr_queues The number of task queues to create.
* @param nr_queues The number of task queues to create.
* @param nr_nodes The number of MPI ranks
* @param nr_nodes The number of MPI ranks
.
* @param nodeID The MPI rank of this node
* @param nodeID The MPI rank of this node
.
* @param policy The queueing policy to use.
* @param policy The queueing policy to use.
* @param timeBegin Time at the begininning of the simulation.
* @param timeEnd Time at the end of the simulation.
*/
*/
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
float
dt
,
int
nr_threads
,
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
float
dt
,
int
nr_threads
,
...
...
This diff is collapsed.
Click to expand it.
src/parallel_io.c
+
4
−
4
View file @
05795237
...
@@ -274,8 +274,8 @@ void read_ic_parallel(char* fileName, double dim[3], struct part** parts,
...
@@ -274,8 +274,8 @@ void read_ic_parallel(char* fileName, double dim[3], struct part** parts,
COMPULSORY
);
COMPULSORY
);
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
id
,
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
id
,
COMPULSORY
);
COMPULSORY
);
readArray
(
h_grp
,
"TimeStep"
,
FLOAT
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
dt
,
/*
readArray(h_grp, "TimeStep", FLOAT, *N, 1, *parts, N_total, offset, dt,
*/
OPTIONAL
);
/*
OPTIONAL);
*/
readArray
(
h_grp
,
"Acceleration"
,
FLOAT
,
*
N
,
3
,
*
parts
,
N_total
,
offset
,
a
,
readArray
(
h_grp
,
"Acceleration"
,
FLOAT
,
*
N
,
3
,
*
parts
,
N_total
,
offset
,
a
,
OPTIONAL
);
OPTIONAL
);
readArray
(
h_grp
,
"Density"
,
FLOAT
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
rho
,
readArray
(
h_grp
,
"Density"
,
FLOAT
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
rho
,
...
@@ -582,8 +582,8 @@ void write_output_parallel(struct engine* e, struct UnitSystem* us,
...
@@ -582,8 +582,8 @@ void write_output_parallel(struct engine* e, struct UnitSystem* us,
N_total
,
mpi_rank
,
offset
,
u
,
us
,
UNIT_CONV_ENERGY_PER_UNIT_MASS
);
N_total
,
mpi_rank
,
offset
,
u
,
us
,
UNIT_CONV_ENERGY_PER_UNIT_MASS
);
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"ParticleIDs"
,
ULONGLONG
,
N
,
1
,
parts
,
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"ParticleIDs"
,
ULONGLONG
,
N
,
1
,
parts
,
N_total
,
mpi_rank
,
offset
,
id
,
us
,
UNIT_CONV_NO_UNITS
);
N_total
,
mpi_rank
,
offset
,
id
,
us
,
UNIT_CONV_NO_UNITS
);
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"TimeStep"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
/*
writeArray(h_grp, fileName, xmfFile, "TimeStep", FLOAT, N, 1, parts, N_total,
*/
mpi_rank
,
offset
,
dt
,
us
,
UNIT_CONV_TIME
);
/*
mpi_rank, offset, dt, us, UNIT_CONV_TIME);
*/
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"Acceleration"
,
FLOAT
,
N
,
3
,
parts
,
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"Acceleration"
,
FLOAT
,
N
,
3
,
parts
,
N_total
,
mpi_rank
,
offset
,
a
,
us
,
UNIT_CONV_ACCELERATION
);
N_total
,
mpi_rank
,
offset
,
a
,
us
,
UNIT_CONV_ACCELERATION
);
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"Density"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"Density"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
...
...
This diff is collapsed.
Click to expand it.
src/serial_io.c
+
4
−
4
View file @
05795237
...
@@ -314,8 +314,8 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N,
...
@@ -314,8 +314,8 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N,
u
,
COMPULSORY
);
u
,
COMPULSORY
);
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
id
,
COMPULSORY
);
id
,
COMPULSORY
);
readArray
(
h_grp
,
"TimeStep"
,
FLOAT
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
dt
,
/*
readArray(h_grp, "TimeStep", FLOAT, *N, 1, *parts, N_total, offset, dt,
*/
OPTIONAL
);
/*
OPTIONAL);
*/
readArray
(
h_grp
,
"Acceleration"
,
FLOAT
,
*
N
,
3
,
*
parts
,
N_total
,
offset
,
a
,
readArray
(
h_grp
,
"Acceleration"
,
FLOAT
,
*
N
,
3
,
*
parts
,
N_total
,
offset
,
a
,
OPTIONAL
);
OPTIONAL
);
readArray
(
h_grp
,
"Density"
,
FLOAT
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
rho
,
readArray
(
h_grp
,
"Density"
,
FLOAT
,
*
N
,
1
,
*
parts
,
N_total
,
offset
,
rho
,
...
@@ -627,8 +627,8 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
...
@@ -627,8 +627,8 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
us
,
UNIT_CONV_ENERGY_PER_UNIT_MASS
);
us
,
UNIT_CONV_ENERGY_PER_UNIT_MASS
);
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"ParticleIDs"
,
ULONGLONG
,
N_total
,
1
,
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"ParticleIDs"
,
ULONGLONG
,
N_total
,
1
,
us
,
UNIT_CONV_NO_UNITS
);
us
,
UNIT_CONV_NO_UNITS
);
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"TimeStep"
,
FLOAT
,
N_total
,
1
,
us
,
/*
prepareArray(h_grp, fileName, xmfFile, "TimeStep", FLOAT, N_total, 1, us,
*/
UNIT_CONV_TIME
);
/*
UNIT_CONV_TIME);
*/
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"Acceleration"
,
FLOAT
,
N_total
,
3
,
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"Acceleration"
,
FLOAT
,
N_total
,
3
,
us
,
UNIT_CONV_ACCELERATION
);
us
,
UNIT_CONV_ACCELERATION
);
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"Density"
,
FLOAT
,
N_total
,
1
,
us
,
prepareArray
(
h_grp
,
fileName
,
xmfFile
,
"Density"
,
FLOAT
,
N_total
,
1
,
us
,
...
...
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