Skip to content
GitLab
Menu
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
e55a7195
Commit
e55a7195
authored
Dec 18, 2012
by
Pedro Gonnet
Browse files
update front-end with parameter -d to set the maximum dt.
Former-commit-id: b60bf512adce2195d2c1ce244ed9f98bb8e91907
parent
f6e86c59
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/test.c
View file @
e55a7195
...
...
@@ -615,13 +615,15 @@ void kernel_dump ( int N ) {
int
k
;
float
x
,
w
,
dw_dx
;
float
x4
[
4
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
w4
[
4
],
dw_dx4
[
4
]
__attribute__
((
aligned
(
16
)));
float
x4
[
4
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
};
float
w4
[
4
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
};
// float dw_dx4[4] __attribute__ ((aligned (16)));
for
(
k
=
0
;
k
<=
N
;
k
++
)
{
x
=
((
float
)
k
)
/
N
*
kernel_igamma
;
x4
[
3
]
=
x4
[
2
];
x4
[
2
]
=
x4
[
1
];
x4
[
1
]
=
x4
[
0
];
x4
[
0
]
=
x
;
kernel_deval
(
x
,
&
w
,
&
dw_dx
);
kernel_deval_vec
(
(
vector
*
)
x4
,
(
vector
*
)
w4
,
(
vector
*
)
dw_dx4
);
//
kernel_deval_vec( (vector *)x4 , (vector *)w4 , (vector *)dw_dx4 );
printf
(
" %e %e %e %e %e %e %e
\n
"
,
x
,
w
,
dw_dx
,
w4
[
0
]
,
w4
[
1
]
,
w4
[
2
]
,
w4
[
3
]
);
}
...
...
@@ -683,7 +685,7 @@ int main ( int argc , char *argv[] ) {
struct
space
s
;
struct
engine
e
;
char
ICfileName
[
200
];
float
dt
=
1
.
0
f
;
float
dt
_max
=
0
.
0
f
;
ticks
tic
;
/* Init the space. */
...
...
@@ -699,9 +701,9 @@ int main ( int argc , char *argv[] ) {
printf
(
"main: scaling cutoff by %.3f.
\n
"
,
scaling
);
fflush
(
stdout
);
break
;
case
'd'
:
if
(
sscanf
(
optarg
,
"%f"
,
&
dt
)
!=
1
)
if
(
sscanf
(
optarg
,
"%f"
,
&
dt
_max
)
!=
1
)
error
(
"Error parsing timestep."
);
printf
(
"main: dt set to %.3f.
\n
"
,
dt
);
fflush
(
stdout
);
printf
(
"main: dt set to %.3f.
\n
"
,
dt
_max
);
fflush
(
stdout
);
break
;
case
'f'
:
if
(
!
strcpy
(
ICfileName
,
optarg
))
...
...
@@ -879,8 +881,7 @@ int main ( int argc , char *argv[] ) {
printf
(
"main: space_init took %.3f ms.
\n
"
,
((
double
)(
getticks
()
-
tic
))
/
CPU_TPS
*
1000
);
fflush
(
stdout
);
/* Set the default time step to 1.0f. */
s
.
dt
=
dt
;
printf
(
"main: space dt is %f.
\n
"
,
s
.
dt
);
printf
(
"main: dt_max is %f.
\n
"
,
dt_max
);
/* Say a few nice things about the space we just created. */
printf
(
"main: space dimensions are [ %.3f %.3f %.3f ].
\n
"
,
s
.
dim
[
0
]
,
s
.
dim
[
1
]
,
s
.
dim
[
2
]
);
...
...
@@ -889,6 +890,7 @@ int main ( int argc , char *argv[] ) {
printf
(
"main: %i parts in %i cells.
\n
"
,
s
.
nr_parts
,
s
.
tot_cells
);
printf
(
"main: maximum depth is %d.
\n
"
,
s
.
maxdepth
);
printf
(
"main: cutoffs in [ %g %g ].
\n
"
,
s
.
h_min
,
s
.
h_max
);
fflush
(
stdout
);
printf
(
"main: generated %i tasks.
\n
"
,
s
.
nr_tasks
);
/* Verify that each particle is in it's propper cell. */
icount
=
0
;
...
...
@@ -902,12 +904,6 @@ int main ( int argc , char *argv[] ) {
/* Dump the particle positions. */
// space_map_parts( &s , &map_dump , shift );
/* Generate the tasks. */
tic
=
getticks
();
space_maketasks
(
&
s
,
1
);
printf
(
"main: generated %i tasks.
\n
"
,
s
.
nr_tasks
);
printf
(
"main: space_maketasks took %.3f ms.
\n
"
,
((
double
)(
getticks
()
-
tic
))
/
CPU_TPS
*
1000
);
fflush
(
stdout
);
/* Initialize the runner with this space. */
tic
=
getticks
();
engine_init
(
&
e
,
&
s
,
nr_threads
,
nr_queues
,
engine_policy_steal
|
engine_policy_keep
);
...
...
@@ -935,10 +931,10 @@ int main ( int argc , char *argv[] ) {
runner_counter
[
k
]
=
0
;
#endif
tic
=
getticks
();
engine_prepare
(
&
e
,
0
);
engine_prepare
(
&
e
,
1
);
printf
(
"main: engine_prepare took %.3f ms.
\n
"
,
((
double
)(
getticks
()
-
tic
))
/
CPU_TPS
*
1000
);
fflush
(
stdout
);
tic
=
getticks
();
engine_run
(
&
e
,
0
);
engine_run
(
&
e
,
0
,
dt_max
);
#ifdef TIMER
printf
(
"main: runner timers are [ %.3f"
,
runner_timer
[
0
]
/
CPU_TPS
*
1000
);
for
(
k
=
1
;
k
<
runner_timer_count
;
k
++
)
...
...
@@ -1047,6 +1043,10 @@ int main ( int argc , char *argv[] ) {
/* Check for outliers. */
// space_map_parts( &s , &map_check , NULL );
/* Dump the particle dts. */
// for ( k = 0; k < s.nr_parts ; k++ )
// printf( " %lli %e\n" , s.parts[k].id , s.parts[k].dt );
/* All is calm, all is bright. */
return
0
;
...
...
Write
Preview
Supports
Markdown
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