Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
SWIFTsim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Milestones
Merge Requests
14
Merge Requests
14
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SWIFT
SWIFTsim
Commits
d6e9e073
Commit
d6e9e073
authored
Apr 15, 2020
by
Matthieu Schaller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restart fixes
parent
4dd854a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
12 deletions
+50
-12
examples/main.c
examples/main.c
+5
-2
examples/main_fof.c
examples/main_fof.c
+1
-1
src/engine.c
src/engine.c
+43
-8
src/engine.h
src/engine.h
+1
-1
No files found.
examples/main.c
View file @
d6e9e073
...
...
@@ -780,6 +780,9 @@ int main(int argc, char *argv[]) {
/* Just one restart file. */
strcpy
(
restart_file
,
restart_files
[
0
]);
/* Finished with the list. */
restart_locate_free
(
1
,
restart_files
);
#endif
/* Now read it. */
...
...
@@ -1235,7 +1238,7 @@ int main(int argc, char *argv[]) {
#endif
if
(
myrank
==
0
)
message
(
"Time integration ready to start. End of dry-run."
);
engine_clean
(
&
e
,
/*fof=*/
0
);
engine_clean
(
&
e
,
/*fof=*/
0
,
/*restart=*/
0
);
free
(
params
);
return
0
;
}
...
...
@@ -1524,7 +1527,7 @@ int main(int argc, char *argv[]) {
if
(
with_self_gravity
)
pm_mesh_clean
(
e
.
mesh
);
if
(
with_cooling
||
with_temperature
)
cooling_clean
(
e
.
cooling_func
);
if
(
with_feedback
)
feedback_clean
(
e
.
feedback_props
);
engine_clean
(
&
e
,
/*fof=*/
0
);
engine_clean
(
&
e
,
/*fof=*/
0
,
restart
);
free
(
params
);
#ifdef WITH_MPI
...
...
examples/main_fof.c
View file @
d6e9e073
...
...
@@ -698,7 +698,7 @@ int main(int argc, char *argv[]) {
/* Clean everything */
cosmology_clean
(
&
cosmo
);
pm_mesh_clean
(
&
mesh
);
engine_clean
(
&
e
,
/*fof=*/
1
);
engine_clean
(
&
e
,
/*fof=*/
1
,
/*restart=*/
0
);
free
(
params
);
/* Say goodbye. */
...
...
src/engine.c
View file @
d6e9e073
...
...
@@ -1878,7 +1878,7 @@ void engine_prepare(struct engine *e) {
/* Perform particle splitting. Only if there is a rebuild coming and no
repartitioning. */
if
(
e
->
forcerebuild
&&
!
e
->
forcerepart
&&
e
->
step
>
1
)
{
if
(
!
e
->
restarting
&&
e
->
forcerebuild
&&
!
e
->
forcerepart
&&
e
->
step
>
1
)
{
/* Let's start by drifting everybody to the current time */
if
(
!
drifted_all
)
engine_drift_all
(
e
,
/*drift_mpole=*/
0
);
...
...
@@ -5182,8 +5182,9 @@ void engine_recompute_displacement_constraint(struct engine *e) {
*
* @param e The #engine to clean.
* @param fof Was this a stand-alone FOF run?
* @param restart Was this a run that was restarted from check-point files?
*/
void
engine_clean
(
struct
engine
*
e
,
const
int
fof
)
{
void
engine_clean
(
struct
engine
*
e
,
const
int
fof
,
const
int
restart
)
{
/* Start by telling the runners to stop. */
e
->
step_props
=
engine_step_prop_done
;
swift_barrier_wait
(
&
e
->
run_barrier
);
...
...
@@ -5241,6 +5242,39 @@ void engine_clean(struct engine *e, const int fof) {
fclose
(
e
->
sfh_logger
);
}
}
/* If the run was restarted, we should also free the memory allocated
in engine_struct_restore() */
if
(
restart
)
{
free
((
void
*
)
e
->
parameter_file
);
free
((
void
*
)
e
->
external_potential
);
free
((
void
*
)
e
->
black_holes_properties
);
free
((
void
*
)
e
->
stars_properties
);
free
((
void
*
)
e
->
gravity_properties
);
free
((
void
*
)
e
->
hydro_properties
);
free
((
void
*
)
e
->
physical_constants
);
free
((
void
*
)
e
->
internal_units
);
free
((
void
*
)
e
->
cosmology
);
free
((
void
*
)
e
->
mesh
);
free
((
void
*
)
e
->
chemistry
);
free
((
void
*
)
e
->
entropy_floor
);
free
((
void
*
)
e
->
cooling_func
);
free
((
void
*
)
e
->
star_formation
);
free
((
void
*
)
e
->
feedback_props
);
#ifdef WITH_FOF
free
((
void
*
)
e
->
fof_properties
);
#endif
#ifdef WITH_MPI
free
((
void
*
)
e
->
reparttype
);
#endif
if
(
e
->
output_list_snapshots
)
free
((
void
*
)
e
->
output_list_snapshots
);
if
(
e
->
output_list_stats
)
free
((
void
*
)
e
->
output_list_stats
);
if
(
e
->
output_list_stf
)
free
((
void
*
)
e
->
output_list_stf
);
#ifdef WITH_LOGGER
if
(
e
->
policy
&
engine_policy_logger
)
free
((
void
*
)
e
->
logger
);
#endif
free
(
e
->
s
);
}
}
/**
...
...
@@ -5324,14 +5358,15 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e
->
s
=
s
;
s
->
e
=
e
;
struct
unit_system
*
us
=
struct
unit_system
*
internal_
us
=
(
struct
unit_system
*
)
malloc
(
sizeof
(
struct
unit_system
));
units_struct_restore
(
us
,
stream
);
e
->
internal_units
=
us
;
units_struct_restore
(
internal_
us
,
stream
);
e
->
internal_units
=
internal_
us
;
us
=
(
struct
unit_system
*
)
malloc
(
sizeof
(
struct
unit_system
));
units_struct_restore
(
us
,
stream
);
e
->
snapshot_units
=
us
;
struct
unit_system
*
snap_us
=
(
struct
unit_system
*
)
malloc
(
sizeof
(
struct
unit_system
));
units_struct_restore
(
snap_us
,
stream
);
e
->
snapshot_units
=
snap_us
;
struct
cosmology
*
cosmo
=
(
struct
cosmology
*
)
malloc
(
sizeof
(
struct
cosmology
));
...
...
src/engine.h
View file @
d6e9e073
...
...
@@ -565,7 +565,7 @@ void engine_print_policy(struct engine *e);
int
engine_is_done
(
struct
engine
*
e
);
void
engine_pin
(
void
);
void
engine_unpin
(
void
);
void
engine_clean
(
struct
engine
*
e
,
const
int
fof
);
void
engine_clean
(
struct
engine
*
e
,
const
int
fof
,
const
int
restart
);
int
engine_estimate_nr_tasks
(
const
struct
engine
*
e
);
void
engine_print_task_counts
(
const
struct
engine
*
e
);
void
engine_fof
(
struct
engine
*
e
,
const
int
dump_results
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment