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
545f384c
Commit
545f384c
authored
Mar 04, 2016
by
Matthieu Schaller
Browse files
Code formatting
parent
d527f532
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/error.h
View file @
545f384c
...
...
@@ -56,25 +56,25 @@ extern int engine_rank;
* followed by the MPI error string and aborts.
*
*/
#define mpi_error(res,s, ...)
\
#define mpi_error(res,
s, ...) \
{ \
fprintf(stderr, "[%03i] %s:%s():%i: " s "\n", engine_rank, __FILE__, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); \
int len = 1024; \
char buf[len]; \
MPI_Error_string(
res, buf, &len
); \
fprintf(stderr, "%s\n\n", buf
); \
MPI_Error_string(res, buf, &len);
\
fprintf(stderr, "%s\n\n", buf);
\
MPI_Abort(MPI_COMM_WORLD, -1); \
}
#define mpi_error_string(res,s, ...)
\
#define mpi_error_string(res,
s, ...) \
{ \
fprintf(stderr, "[%03i] %s:%s():%i: " s "\n", engine_rank, __FILE__, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); \
int len = 1024; \
char buf[len]; \
MPI_Error_string(
res, buf, &len
); \
fprintf(stderr, "%s\n\n", buf
); \
MPI_Error_string(res, buf, &len);
\
fprintf(stderr, "%s\n\n", buf);
\
}
#endif
...
...
src/partition.c
View file @
545f384c
...
...
@@ -58,11 +58,8 @@
/* Simple descriptions of initial partition types for reports. */
const
char
*
initial_partition_name
[]
=
{
"gridded cells"
,
"vectorized point associated cells"
,
"METIS particle weighted cells"
,
"METIS unweighted cells"
};
"gridded cells"
,
"vectorized point associated cells"
,
"METIS particle weighted cells"
,
"METIS unweighted cells"
};
/* Simple descriptions of repartition types for reports. */
const
char
*
repartition_name
[]
=
{
...
...
@@ -70,8 +67,7 @@ const char *repartition_name[] = {
"METIS edge and vertex time weighted cells"
,
"METIS particle count vertex weighted cells"
,
"METIS time edge weighted cells"
,
"METIS particle count vertex and time edge cells"
};
"METIS particle count vertex and time edge cells"
};
/* Local functions, if needed. */
static
int
check_complete
(
struct
space
*
s
,
int
verbose
,
int
nregions
);
...
...
@@ -229,7 +225,6 @@ static void graph_init_metis(struct space *s, idx_t *adjncy, idx_t *xadj) {
if
(
xadj
!=
NULL
)
{
xadj
[
0
]
=
0
;
for
(
int
k
=
0
;
k
<
s
->
nr_cells
;
k
++
)
xadj
[
k
+
1
]
=
xadj
[
k
]
+
26
;
}
}
#endif
...
...
@@ -283,8 +278,7 @@ static void accumulate_counts(struct space *s, int *counts) {
*/
static
void
split_metis
(
struct
space
*
s
,
int
nregions
,
int
*
celllist
)
{
for
(
int
i
=
0
;
i
<
s
->
nr_cells
;
i
++
)
s
->
cells
[
i
].
nodeID
=
celllist
[
i
];
for
(
int
i
=
0
;
i
<
s
->
nr_cells
;
i
++
)
s
->
cells
[
i
].
nodeID
=
celllist
[
i
];
}
#endif
...
...
@@ -404,7 +398,6 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew,
free
(
xadj
);
free
(
adjncy
);
free
(
regionid
);
}
#endif
...
...
@@ -423,10 +416,9 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew,
* @param tasks the completed tasks from the last engine step for our node.
* @param nr_tasks the number of tasks.
*/
static
void
repart_edge_metis
(
int
partweights
,
int
bothweights
,
int
nodeID
,
int
nr_nodes
,
struct
space
*
s
,
struct
task
*
tasks
,
int
nr_tasks
)
{
static
void
repart_edge_metis
(
int
partweights
,
int
bothweights
,
int
nodeID
,
int
nr_nodes
,
struct
space
*
s
,
struct
task
*
tasks
,
int
nr_tasks
)
{
/* Create weight arrays using task ticks for vertices and edges (edges
* assume the same graph structure as used in the part_ calls). */
...
...
@@ -453,7 +445,7 @@ static void repart_edge_metis(int partweights, int bothweights,
bzero
(
weights_v
,
sizeof
(
int
)
*
nr_cells
);
}
if
((
weights_e
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
26
*
nr_cells
))
==
NULL
)
error
(
"Failed to allocate edge weights arrays."
);
error
(
"Failed to allocate edge weights arrays."
);
bzero
(
weights_e
,
sizeof
(
int
)
*
26
*
nr_cells
);
/* Generate task weights for vertices. */
...
...
@@ -503,18 +495,15 @@ static void repart_edge_metis(int partweights, int bothweights,
if
(
t
->
type
==
task_type_ghost
||
t
->
type
==
task_type_drift
||
t
->
type
==
task_type_kick
)
{
/* Particle updates add only to vertex weight. */
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
}
/* Self interaction? */
else
if
((
t
->
type
==
task_type_self
&&
ci
->
nodeID
==
nodeID
)
||
(
t
->
type
==
task_type_sub
&&
cj
==
NULL
&&
ci
->
nodeID
==
nodeID
))
{
(
t
->
type
==
task_type_sub
&&
cj
==
NULL
&&
ci
->
nodeID
==
nodeID
))
{
/* Self interactions add only to vertex weight. */
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
}
...
...
@@ -524,8 +513,7 @@ static void repart_edge_metis(int partweights, int bothweights,
/* In-cell pair? */
if
(
ci
==
cj
)
{
/* Add weight to vertex for ci. */
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
}
...
...
@@ -585,8 +573,8 @@ static void repart_edge_metis(int partweights, int bothweights,
}
if
((
res
=
MPI_Reduce
((
nodeID
==
0
)
?
MPI_IN_PLACE
:
weights_e
,
weights_e
,
26
*
nr_cells
,
MPI_INT
,
MPI_SUM
,
0
,
MPI_COMM_WORLD
))
!=
MPI_SUCCESS
)
26
*
nr_cells
,
MPI_INT
,
MPI_SUM
,
0
,
MPI_COMM_WORLD
))
!=
MPI_SUCCESS
)
mpi_error
(
res
,
"Failed to allreduce edge weights."
);
/* Allocate cell list for the partition. */
...
...
@@ -655,8 +643,9 @@ static void repart_edge_metis(int partweights, int bothweights,
/* If partition failed continue with the current one, but make this
* clear. */
if
(
failed
)
{
message
(
"WARNING: METIS repartition has failed, continuing with "
"the current partition, load balance will not be optimal"
);
message
(
"WARNING: METIS repartition has failed, continuing with "
"the current partition, load balance will not be optimal"
);
for
(
int
k
=
0
;
k
<
nr_cells
;
k
++
)
celllist
[
k
]
=
cells
[
k
].
nodeID
;
}
}
...
...
@@ -697,16 +686,15 @@ static void repart_vertex_metis(struct space *s, int nodeID, int nr_nodes) {
/* Get all the counts from all the nodes. */
int
res
;
if
((
res
=
MPI_Allreduce
(
MPI_IN_PLACE
,
weights
,
s
->
nr_cells
,
MPI_INT
,
MPI_SUM
,
MPI_COMM_WORLD
))
!=
MPI_SUCCESS
)
if
((
res
=
MPI_Allreduce
(
MPI_IN_PLACE
,
weights
,
s
->
nr_cells
,
MPI_INT
,
MPI_SUM
,
MPI_COMM_WORLD
))
!=
MPI_SUCCESS
)
mpi_error
(
res
,
"Failed to allreduce particle cell weights."
);
/* Main node does the partition calculation. */
int
*
celllist
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
s
->
nr_cells
);
if
(
celllist
==
NULL
)
error
(
"Failed to allocate celllist"
);
if
(
nodeID
==
0
)
pick_metis
(
s
,
nr_nodes
,
weights
,
NULL
,
celllist
);
if
(
nodeID
==
0
)
pick_metis
(
s
,
nr_nodes
,
weights
,
NULL
,
celllist
);
/* Distribute the celllist partition and apply. */
if
((
res
=
MPI_Bcast
(
celllist
,
s
->
nr_cells
,
MPI_INT
,
0
,
MPI_COMM_WORLD
))
!=
...
...
@@ -721,14 +709,14 @@ static void repart_vertex_metis(struct space *s, int nodeID, int nr_nodes) {
}
#endif
/**
* @brief Repartition the space using the given repartition type.
*
* Note that at the end of this process all the cells will be re-distributed
* across the nodes, but the particles themselves will not be.
*
* @param reparttype the type of repartition to attempt, see the repart_type enum.
* @param reparttype the type of repartition to attempt, see the repart_type
*enum.
* @param nodeID our nodeID.
* @param nr_nodes the number of nodes.
* @param s the space of cells holding our local particles.
...
...
@@ -797,8 +785,8 @@ void partition_initial_partition(struct partition *initial_partition,
struct
cell
*
c
;
/* If we've got the wrong number of nodes, fail. */
if
(
nr_nodes
!=
initial_partition
->
grid
[
0
]
*
initial_partition
->
grid
[
1
]
*
initial_partition
->
grid
[
2
])
if
(
nr_nodes
!=
initial_partition
->
grid
[
0
]
*
initial_partition
->
grid
[
1
]
*
initial_partition
->
grid
[
2
])
error
(
"Grid size does not match number of nodes."
);
/* Run through the cells and set their nodeID. */
...
...
@@ -806,9 +794,9 @@ void partition_initial_partition(struct partition *initial_partition,
for
(
k
=
0
;
k
<
s
->
nr_cells
;
k
++
)
{
c
=
&
s
->
cells
[
k
];
for
(
j
=
0
;
j
<
3
;
j
++
)
ind
[
j
]
=
c
->
loc
[
j
]
/
s
->
dim
[
j
]
*
initial_partition
->
grid
[
j
];
ind
[
j
]
=
c
->
loc
[
j
]
/
s
->
dim
[
j
]
*
initial_partition
->
grid
[
j
];
c
->
nodeID
=
ind
[
0
]
+
initial_partition
->
grid
[
0
]
*
(
ind
[
1
]
+
initial_partition
->
grid
[
1
]
*
ind
[
2
]);
(
ind
[
1
]
+
initial_partition
->
grid
[
1
]
*
ind
[
2
]);
// message("cell at [%e,%e,%e]: ind = [%i,%i,%i], nodeID = %i", c->loc[0],
// c->loc[1], c->loc[2], ind[0], ind[1], ind[2], c->nodeID);
}
...
...
@@ -833,7 +821,7 @@ void partition_initial_partition(struct partition *initial_partition,
* not. */
int
*
weights
=
NULL
;
if
(
initial_partition
->
type
==
INITPART_METIS_WEIGHT
)
{
if
((
weights
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
s
->
nr_cells
))
==
NULL
)
if
((
weights
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
s
->
nr_cells
))
==
NULL
)
error
(
"Failed to allocate weights buffer."
);
bzero
(
weights
,
sizeof
(
int
)
*
s
->
nr_cells
);
...
...
@@ -864,14 +852,12 @@ void partition_initial_partition(struct partition *initial_partition,
if
(
MPI_Allreduce
(
MPI_IN_PLACE
,
weights
,
s
->
nr_cells
,
MPI_INT
,
MPI_SUM
,
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
error
(
"Failed to allreduce particle cell weights."
);
}
/* Main node does the partition calculation. */
int
*
celllist
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
s
->
nr_cells
);
if
(
celllist
==
NULL
)
error
(
"Failed to allocate celllist"
);
if
(
nodeID
==
0
)
pick_metis
(
s
,
nr_nodes
,
weights
,
NULL
,
celllist
);
if
(
nodeID
==
0
)
pick_metis
(
s
,
nr_nodes
,
weights
,
NULL
,
celllist
);
/* Distribute the celllist partition and apply. */
int
res
=
MPI_Bcast
(
celllist
,
s
->
nr_cells
,
MPI_INT
,
0
,
MPI_COMM_WORLD
);
...
...
@@ -908,8 +894,7 @@ void partition_initial_partition(struct partition *initial_partition,
}
/* Share the samplecells around all the nodes. */
int
res
=
MPI_Bcast
(
samplecells
,
nr_nodes
*
3
,
MPI_INT
,
0
,
MPI_COMM_WORLD
);
int
res
=
MPI_Bcast
(
samplecells
,
nr_nodes
*
3
,
MPI_INT
,
0
,
MPI_COMM_WORLD
);
if
(
res
!=
MPI_SUCCESS
)
mpi_error
(
res
,
"Failed to bcast the partition sample cells."
);
...
...
src/partition.h
View file @
545f384c
...
...
@@ -51,8 +51,8 @@ enum repartition_type {
extern
const
char
*
repartition_name
[];
void
partition_repartition
(
enum
repartition_type
reparttype
,
int
nodeID
,
int
nr_nodes
,
struct
space
*
s
,
struct
task
*
tasks
,
int
nr_tasks
);
int
nr_nodes
,
struct
space
*
s
,
struct
task
*
tasks
,
int
nr_tasks
);
void
partition_initial_partition
(
struct
partition
*
initial_partition
,
int
nodeID
,
int
nr_nodes
,
struct
space
*
s
);
...
...
tests/testReading.c
View file @
545f384c
...
...
@@ -31,7 +31,7 @@ int main() {
const
double
boxSize
=
1
.;
const
int
L
=
4
;
const
double
rho
=
2
.;
/* Read data */
read_ic_single
(
"input.hdf5"
,
dim
,
&
parts
,
&
N
,
&
periodic
);
...
...
tests/testSPHStep.c
View file @
545f384c
...
...
@@ -22,43 +22,45 @@
#include
<stdlib.h>
#include
<string.h>
/**
/**
* @brief Constructs a cell with N SPH particles
*/
struct
cell
*
make_cell
(
size_t
N
,
float
cellSize
,
int
offset
[
3
],
int
id_offset
)
{
size_t
count
=
N
*
N
*
N
;
struct
cell
*
cell
=
malloc
(
sizeof
(
struct
cell
)
);
size_t
count
=
N
*
N
*
N
;
struct
cell
*
cell
=
malloc
(
sizeof
(
struct
cell
));
struct
part
*
part
;
struct
xpart
*
xpart
;
float
h
;
size_t
x
,
y
,
z
,
size
;
size
=
count
*
sizeof
(
struct
part
);
if
(
posix_memalign
((
void
**
)
&
cell
->
parts
,
32
,
size
)
!=
0
)
{
size
=
count
*
sizeof
(
struct
part
);
if
(
posix_memalign
((
void
**
)
&
cell
->
parts
,
32
,
size
)
!=
0
)
{
error
(
"couldn't allocate particles"
);
}
size
=
count
*
sizeof
(
struct
xpart
);
if
(
posix_memalign
((
void
**
)
&
cell
->
xparts
,
32
,
size
)
!=
0
)
{
size
=
count
*
sizeof
(
struct
xpart
);
if
(
posix_memalign
((
void
**
)
&
cell
->
xparts
,
32
,
size
)
!=
0
)
{
error
(
"couldn't allocate extended particles"
);
}
h
=
1
.
127
*
cellSize
/
N
;
part
=
cell
->
parts
;
xpart
=
cell
->
xparts
;
memset
(
part
,
0
,
count
*
sizeof
(
struct
part
));
memset
(
xpart
,
0
,
count
*
sizeof
(
struct
xpart
));
memset
(
part
,
0
,
count
*
sizeof
(
struct
part
));
memset
(
xpart
,
0
,
count
*
sizeof
(
struct
xpart
));
for
(
x
=
0
;
x
<
N
;
++
x
)
{
for
(
y
=
0
;
y
<
N
;
++
y
)
{
for
(
z
=
0
;
z
<
N
;
++
z
)
{
part
->
x
[
0
]
=
offset
[
0
]
*
cellSize
+
x
*
cellSize
/
N
+
cellSize
/
(
2
*
N
);
part
->
x
[
1
]
=
offset
[
1
]
*
cellSize
+
y
*
cellSize
/
N
+
cellSize
/
(
2
*
N
);
part
->
x
[
2
]
=
offset
[
2
]
*
cellSize
+
z
*
cellSize
/
N
+
cellSize
/
(
2
*
N
);
part
->
h
=
h
;
part
->
id
=
x
*
N
*
N
+
y
*
N
+
z
+
id_offset
;
++
part
;
part
->
x
[
0
]
=
offset
[
0
]
*
cellSize
+
x
*
cellSize
/
N
+
cellSize
/
(
2
*
N
);
part
->
x
[
1
]
=
offset
[
1
]
*
cellSize
+
y
*
cellSize
/
N
+
cellSize
/
(
2
*
N
);
part
->
x
[
2
]
=
offset
[
2
]
*
cellSize
+
z
*
cellSize
/
N
+
cellSize
/
(
2
*
N
);
part
->
h
=
h
;
part
->
id
=
x
*
N
*
N
+
y
*
N
+
z
+
id_offset
;
++
part
;
}
}
}
...
...
@@ -69,7 +71,7 @@ struct cell *make_cell(size_t N, float cellSize, int offset[3], int id_offset) {
cell
->
h
[
0
]
=
cellSize
;
cell
->
h
[
1
]
=
cellSize
;
cell
->
h
[
2
]
=
cellSize
;
return
cell
;
}
...
...
@@ -78,37 +80,38 @@ struct cell *make_cell(size_t N, float cellSize, int offset[3], int id_offset) {
/* Run a full time step integration for one cell */
int
main
()
{
int
i
,
j
,
k
,
offset
[
3
];
int
i
,
j
,
k
,
offset
[
3
];
struct
part
*
p
;
int
N
=
10
;
float
dim
=
1
.;
float
rho
=
2
.;
float
P
=
1
.;
/* Create cells */
struct
cell
*
cells
[
27
];
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
for
(
k
=
0
;
k
<
3
;
k
++
)
{
offset
[
0
]
=
i
;
offset
[
1
]
=
j
;
offset
[
2
]
=
k
;
cells
[
i
*
9
+
j
*
3
+
k
]
=
make_cell
(
N
,
dim
,
offset
,
(
i
*
9
+
j
*
3
+
k
)
*
N
*
N
*
N
);
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
for
(
k
=
0
;
k
<
3
;
k
++
)
{
offset
[
0
]
=
i
;
offset
[
1
]
=
j
;
offset
[
2
]
=
k
;
cells
[
i
*
9
+
j
*
3
+
k
]
=
make_cell
(
N
,
dim
,
offset
,
(
i
*
9
+
j
*
3
+
k
)
*
N
*
N
*
N
);
}
/* Set particle properties */
for
(
j
=
0
;
j
<
27
;
++
j
)
for
(
i
=
0
;
i
<
cells
[
j
]
->
count
;
++
i
)
{
cells
[
j
]
->
parts
[
i
].
mass
=
dim
*
dim
*
dim
*
rho
/
(
N
*
N
*
N
);
cells
[
j
]
->
parts
[
i
].
u
=
P
/
((
const_hydro_gamma
-
1
.)
*
rho
);
for
(
j
=
0
;
j
<
27
;
++
j
)
for
(
i
=
0
;
i
<
cells
[
j
]
->
count
;
++
i
)
{
cells
[
j
]
->
parts
[
i
].
mass
=
dim
*
dim
*
dim
*
rho
/
(
N
*
N
*
N
);
cells
[
j
]
->
parts
[
i
].
u
=
P
/
((
const_hydro_gamma
-
1
.)
*
rho
);
}
message
(
"m=%f"
,
dim
*
dim
*
dim
*
rho
/
(
N
*
N
*
N
));
/* Pick the central cell */
struct
cell
*
ci
=
cells
[
13
];
/* Create the infrastructure */
struct
engine
e
;
struct
runner
r
;
...
...
@@ -123,40 +126,35 @@ int main() {
e
.
dt_max
=
1e10
;
/* The tracked particle */
p
=
&
(
ci
->
parts
[
N
*
N
*
N
/
2
+
N
*
N
/
2
+
N
/
2
]);
p
=
&
(
ci
->
parts
[
N
*
N
*
N
/
2
+
N
*
N
/
2
+
N
/
2
]);
message
(
"Studying particle p->id=%lld"
,
p
->
id
);
/* Initialise the particles */
for
(
j
=
0
;
j
<
27
;
++
j
)
{
runner_doinit
(
&
r
,
cells
[
j
]);
}
for
(
j
=
0
;
j
<
27
;
++
j
)
{
runner_doinit
(
&
r
,
cells
[
j
]);
}
/* Compute density */
runner_doself1_density
(
&
r
,
ci
);
runner_doghost
(
&
r
,
ci
);
message
(
"h=%f rho=%f N_ngb=%f"
,
p
->
h
,
p
->
rho
,
p
->
density
.
wcount
);
message
(
"c=%f"
,
p
->
force
.
c
);
runner_doself2_force
(
&
r
,
ci
);
runner_dokick
(
&
r
,
ci
,
1
);
message
(
"t_end=%f"
,
p
->
t_end
);
free
(
ci
->
parts
);
free
(
ci
->
xparts
);
return
0
;
}
#else
int
main
()
{
return
0
;
}
int
main
()
{
return
0
;
}
#endif
tests/testTimeIntegration.c
View file @
545f384c
...
...
@@ -41,14 +41,13 @@ int main() {
float
v_max
=
30287
.;
/* [m/s] */
// float v_min = 29291.; /* [m/s] */
/* Derived quantities */
float
e
=
(
r_max
-
r_min
)
/
(
r_max
+
r_min
);
/* Eccentricity */
float
b
=
sqrtf
(
r_max
*
r_min
);
/* Semi-minor axis */
float
p
=
b
*
sqrtf
(
1
-
e
*
e
);
/* Semi-lactus rectum */
float
a
=
p
/
(
1
-
e
*
e
);
/* Semi-major axis */
float
T
=
sqrtf
(
4
*
M_PI
*
M_PI
*
a
*
a
*
a
/
(
G
*
(
M_sun
+
M_earth
)));
/* Period [s] */
(
G
*
(
M_sun
+
M_earth
)));
/* Period [s] */
/* Print some info */
message
(
"Semi-major axis: a=%e [m]"
,
a
);
...
...
@@ -98,8 +97,8 @@ int main() {
eng
.
time
=
0
.;
eng
.
timeBegin
=
0
.;
eng
.
timeEnd
=
N_orbits
*
T
;
eng
.
dt_min
=
dt
;
/* This forces the time-step to be dt */
eng
.
dt_max
=
dt
;
/* irrespective of the state of the particle */
eng
.
dt_min
=
dt
;
/* This forces the time-step to be dt */
eng
.
dt_max
=
dt
;
/* irrespective of the state of the particle */
/* Simulate ! */
for
(
i
=
0
;
i
<
N
;
i
++
)
{
...
...
tests/testVectorize.c
View file @
545f384c
...
...
@@ -34,8 +34,8 @@ struct cell *make_cell(size_t n, double *offset, double h,
part
->
h
=
h
;
part
->
id
=
++
(
*
partId
);
part
->
mass
=
1
.
0
f
;
part
->
t_begin
=
0
.
f
;
part
->
t_end
=
0
.
1
f
;
part
->
t
i
_begin
=
0
;
part
->
t
i
_end
=
1
;
++
part
;
}
}
...
...
@@ -177,13 +177,13 @@ int main(int argc, char *argv[]) {
toc
=
getticks
();
time
+=
toc
-
tic
;
/* Dump if necessary */
if
(
i
%
50
==
0
)
dump_particle_fields
(
"swift_dopair.dat"
,
ci
,
cj
);
}
/* Output timing */
message
(
"SWIFT calculation took %lli ticks."
,
time
/
runs
);
message
(
"SWIFT calculation took %lli ticks."
,
time
/
runs
);
/* Now perform a brute-force version for accuracy tests */
...
...
@@ -202,7 +202,7 @@ int main(int argc, char *argv[]) {
dump_particle_fields
(
"brute_force.dat"
,
ci
,
cj
);
/* Output timing */
message
(
"Brute force calculation took %lli ticks."
,
toc
-
tic
);
message
(
"Brute force calculation took %lli ticks."
,
toc
-
tic
);
/* Clean things to make the sanitizer happy ... */
clean_up
(
ci
);
...
...
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