Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
2df4bac8
Commit
2df4bac8
authored
Mar 01, 2018
by
Matthieu Schaller
Browse files
Print the engine policy to the snapshots.
parent
73e4beb4
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/common_io.c
View file @
2df4bac8
...
...
@@ -375,9 +375,8 @@ void io_write_unit_system(hid_t h_file, const struct unit_system* us,
* @param h_file The (opened) HDF5 file in which to write
*/
void
io_write_code_description
(
hid_t
h_file
)
{
hid_t
h_grpcode
=
0
;
h_grpcode
=
H5Gcreate1
(
h_file
,
"/Code"
,
0
);
const
hid_t
h_grpcode
=
H5Gcreate1
(
h_file
,
"/Code"
,
0
);
if
(
h_grpcode
<
0
)
error
(
"Error while creating code group"
);
io_write_attribute_s
(
h_grpcode
,
"Code"
,
"SWIFT"
);
...
...
@@ -409,6 +408,25 @@ void io_write_code_description(hid_t h_file) {
H5Gclose
(
h_grpcode
);
}
/**
* @brief Write the #engine policy to the file.
* @param h_file File to write to.
* @param e The #engine to read the policy from.
*/
void
io_write_engine_policy
(
hid_t
h_file
,
const
struct
engine
*
e
)
{
const
hid_t
h_grp
=
H5Gcreate1
(
h_file
,
"/Policy"
,
0
);
if
(
h_grp
<
0
)
error
(
"Error while creating policy group"
);
for
(
int
i
=
1
;
i
<=
engine_maxpolicy
;
++
i
)
if
(
e
->
policy
&
(
1
<<
i
))
io_write_attribute_i
(
h_grp
,
engine_policy_names
[
i
+
1
],
1
);
else
io_write_attribute_i
(
h_grp
,
engine_policy_names
[
i
+
1
],
0
);
H5Gclose
(
h_grp
);
}
#endif
/* HAVE_HDF5 */
/**
...
...
src/common_io.h
View file @
2df4bac8
...
...
@@ -73,6 +73,7 @@ void io_write_attribute_l(hid_t grp, const char* name, long data);
void
io_write_attribute_s
(
hid_t
grp
,
const
char
*
name
,
const
char
*
str
);
void
io_write_code_description
(
hid_t
h_file
);
void
io_write_engine_policy
(
hid_t
h_file
,
const
struct
engine
*
e
);
void
io_read_unit_system
(
hid_t
h_file
,
struct
unit_system
*
us
,
int
mpi_rank
);
void
io_write_unit_system
(
hid_t
h_grp
,
const
struct
unit_system
*
us
,
...
...
src/engine.c
View file @
2df4bac8
...
...
@@ -87,15 +87,15 @@ const char *engine_policy_names[] = {"none",
"steal"
,
"keep"
,
"block"
,
"cpu
_
tight"
,
"cpu
tight"
,
"mpi"
,
"numa
_
affinity"
,
"numa
affinity"
,
"hydro"
,
"self
_
gravity"
,
"external
_
gravity"
,
"cosmolog
y_
integration"
,
"drift
_all
"
,
"reconstruct
_m
poles"
,
"self
gravity"
,
"external
gravity"
,
"cosmolog
ical
integration"
,
"drift
everything
"
,
"reconstruct
multi-
poles"
,
"cooling"
,
"sourceterms"
,
"stars"
};
...
...
@@ -5759,7 +5759,7 @@ void engine_print_policy(struct engine *e) {
printf
(
"[0000] %s engine_policy: engine policies are [ "
,
clocks_get_timesincestart
());
for
(
int
k
=
0
;
k
<=
engine_maxpolicy
;
k
++
)
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
" %s "
,
engine_policy_names
[
k
+
1
]);
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
"
'
%s
'
"
,
engine_policy_names
[
k
+
1
]);
printf
(
" ]
\n
"
);
fflush
(
stdout
);
}
...
...
@@ -5767,7 +5767,7 @@ void engine_print_policy(struct engine *e) {
printf
(
"%s engine_policy: engine policies are [ "
,
clocks_get_timesincestart
());
for
(
int
k
=
0
;
k
<=
engine_maxpolicy
;
k
++
)
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
" %s "
,
engine_policy_names
[
k
+
1
]);
if
(
e
->
policy
&
(
1
<<
k
))
printf
(
"
'
%s
'
"
,
engine_policy_names
[
k
+
1
]);
printf
(
" ]
\n
"
);
fflush
(
stdout
);
#endif
...
...
src/parallel_io.c
View file @
2df4bac8
...
...
@@ -899,6 +899,9 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
/* Print the code version */
io_write_code_description
(
h_file
);
/* Print the run's policy */
io_write_engine_policy
(
h_file
,
e
);
/* Print the SPH parameters */
if
(
e
->
policy
&
engine_policy_hydro
)
{
h_grp
=
H5Gcreate
(
h_file
,
"/HydroScheme"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
...
...
src/serial_io.c
View file @
2df4bac8
...
...
@@ -807,6 +807,9 @@ void write_output_serial(struct engine* e, const char* baseName,
/* Print the code version */
io_write_code_description
(
h_file
);
/* Print the run's policy */
io_write_engine_policy
(
h_file
,
e
);
/* Print the SPH parameters */
if
(
e
->
policy
&
engine_policy_hydro
)
{
h_grp
=
H5Gcreate
(
h_file
,
"/HydroScheme"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
...
...
src/single_io.c
View file @
2df4bac8
...
...
@@ -659,6 +659,9 @@ void write_output_single(struct engine* e, const char* baseName,
/* Print the code version */
io_write_code_description
(
h_file
);
/* Print the run's policy */
io_write_engine_policy
(
h_file
,
e
);
/* Print the SPH parameters */
if
(
e
->
policy
&
engine_policy_hydro
)
{
h_grp
=
H5Gcreate
(
h_file
,
"/HydroScheme"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment