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
6ee57542
Commit
6ee57542
authored
9 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add command line argument to stop after a fixed number of steps
Useful when profiling.
parent
4b518aaf
No related branches found
No related tags found
1 merge request
!190
Autotools update
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README
+2
-0
2 additions, 0 deletions
README
examples/main.c
+11
-2
11 additions, 2 deletions
examples/main.c
with
13 additions
and
2 deletions
README
+
2
−
0
View file @
6ee57542
...
@@ -26,6 +26,8 @@ Valid options are:
...
@@ -26,6 +26,8 @@ Valid options are:
-f {int} Overwrite the CPU frequency (Hz) to be used for time measurements
-f {int} Overwrite the CPU frequency (Hz) to be used for time measurements
-g Run with an external gravitational potential
-g Run with an external gravitational potential
-G Run with self-gravity
-G Run with self-gravity
-n {int} Execute a fixed number of time steps. Defaults to -1, which means
use the time_end parameter to stop.
-s Run with SPH
-s Run with SPH
-t {int} The number of threads to use on each MPI rank. Defaults to 1 if not specified.
-t {int} The number of threads to use on each MPI rank. Defaults to 1 if not specified.
-v [12] Increase the level of verbosity 1: MPI-rank 0 writes
-v [12] Increase the level of verbosity 1: MPI-rank 0 writes
...
...
This diff is collapsed.
Click to expand it.
examples/main.c
+
11
−
2
View file @
6ee57542
...
@@ -74,6 +74,7 @@ void print_help_message() {
...
@@ -74,6 +74,7 @@ void print_help_message() {
printf
(
" %2s %8s %s
\n
"
,
"-g"
,
""
,
printf
(
" %2s %8s %s
\n
"
,
"-g"
,
""
,
"Run with an external gravitational potential"
);
"Run with an external gravitational potential"
);
printf
(
" %2s %8s %s
\n
"
,
"-G"
,
""
,
"Run with self-gravity"
);
printf
(
" %2s %8s %s
\n
"
,
"-G"
,
""
,
"Run with self-gravity"
);
printf
(
" %2s %8s %s
\n
"
,
"-n"
,
"{int}"
,
"Execute a fixed number of time steps"
);
printf
(
" %2s %8s %s
\n
"
,
"-s"
,
""
,
"Run with SPH"
);
printf
(
" %2s %8s %s
\n
"
,
"-s"
,
""
,
"Run with SPH"
);
printf
(
" %2s %8s %s
\n
"
,
"-t"
,
"{int}"
,
printf
(
" %2s %8s %s
\n
"
,
"-t"
,
"{int}"
,
"The number of threads to use on each MPI rank. Defaults to 1 if not "
"The number of threads to use on each MPI rank. Defaults to 1 if not "
...
@@ -138,6 +139,7 @@ int main(int argc, char *argv[]) {
...
@@ -138,6 +139,7 @@ int main(int argc, char *argv[]) {
int
with_aff
=
0
;
int
with_aff
=
0
;
int
dry_run
=
0
;
int
dry_run
=
0
;
int
dump_tasks
=
0
;
int
dump_tasks
=
0
;
int
nsteps
=
-
1
;
int
with_cosmology
=
0
;
int
with_cosmology
=
0
;
int
with_external_gravity
=
0
;
int
with_external_gravity
=
0
;
int
with_self_gravity
=
0
;
int
with_self_gravity
=
0
;
...
@@ -150,7 +152,7 @@ int main(int argc, char *argv[]) {
...
@@ -150,7 +152,7 @@ int main(int argc, char *argv[]) {
/* Parse the parameters */
/* Parse the parameters */
int
c
;
int
c
;
while
((
c
=
getopt
(
argc
,
argv
,
"acdef:gGhst:v:y:"
))
!=
-
1
)
switch
(
c
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"acdef:gGh
n:
st:v:y:"
))
!=
-
1
)
switch
(
c
)
{
case
'a'
:
case
'a'
:
with_aff
=
1
;
with_aff
=
1
;
break
;
break
;
...
@@ -179,6 +181,13 @@ int main(int argc, char *argv[]) {
...
@@ -179,6 +181,13 @@ int main(int argc, char *argv[]) {
case
'h'
:
case
'h'
:
if
(
myrank
==
0
)
print_help_message
();
if
(
myrank
==
0
)
print_help_message
();
return
0
;
return
0
;
case
'n'
:
if
(
sscanf
(
optarg
,
"%d"
,
&
nsteps
)
!=
1
)
{
if
(
myrank
==
0
)
printf
(
"Error parsing fixed number of steps.
\n
"
);
if
(
myrank
==
0
)
print_help_message
();
return
1
;
}
break
;
case
's'
:
case
's'
:
with_hydro
=
1
;
with_hydro
=
1
;
break
;
break
;
...
@@ -474,7 +483,7 @@ int main(int argc, char *argv[]) {
...
@@ -474,7 +483,7 @@ int main(int argc, char *argv[]) {
"Updates"
,
"g-Updates"
,
"Wall-clock time"
,
clocks_getunit
());
"Updates"
,
"g-Updates"
,
"Wall-clock time"
,
clocks_getunit
());
/* Main simulation loop */
/* Main simulation loop */
for
(
int
j
=
0
;
!
engine_is_done
(
&
e
);
j
++
)
{
for
(
int
j
=
0
;
!
engine_is_done
(
&
e
)
&&
e
.
step
!=
nsteps
;
j
++
)
{
/* Repartition the space amongst the nodes? */
/* Repartition the space amongst the nodes? */
#ifdef WITH_MPI
#ifdef WITH_MPI
...
...
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