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
edaa3ba1
Commit
edaa3ba1
authored
Aug 23, 2016
by
Matthieu Schaller
Browse files
Define a constant for the cell memory allocation alignment.
parent
12e4a201
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cell.h
View file @
edaa3ba1
...
...
@@ -44,6 +44,8 @@ struct space;
* The maximum was lowered by a further factor of 2 to be on the safe side.*/
#define cell_max_tag (1 << 29)
#define cell_align 32
/* Global variables. */
extern
int
cell_next_tag
;
...
...
@@ -198,7 +200,7 @@ struct cell {
#endif
}
__attribute__
((
aligned
(
64
)));
}
__attribute__
((
aligned
(
cell_align
)));
/* Convert cell location to ID. */
#define cell_getid(cdim, i, j, k) \
...
...
src/engine.c
View file @
edaa3ba1
...
...
@@ -3126,7 +3126,7 @@ void engine_init(struct engine *e, struct space *s,
e
->
timeStep
=
0
.;
e
->
timeBase
=
0
.;
e
->
timeBase_inv
=
0
.;
e
->
drift_all
=
0
;
e
->
drift_all
=
(
policy
&
engine_policy_drift_all
)
;
e
->
internalUnits
=
internal_units
;
e
->
timeFirstSnapshot
=
parser_get_param_double
(
params
,
"Snapshots:time_first"
);
...
...
src/space.c
View file @
edaa3ba1
...
...
@@ -272,7 +272,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
/* Allocate the highest level of cells. */
s
->
tot_cells
=
s
->
nr_cells
=
cdim
[
0
]
*
cdim
[
1
]
*
cdim
[
2
];
if
(
posix_memalign
((
void
*
)
&
s
->
cells
,
64
,
if
(
posix_memalign
((
void
*
)
&
s
->
cells
,
cell_align
,
s
->
nr_cells
*
sizeof
(
struct
cell
))
!=
0
)
error
(
"Failed to allocate cells."
);
bzero
(
s
->
cells
,
s
->
nr_cells
*
sizeof
(
struct
cell
));
...
...
@@ -1406,7 +1406,7 @@ struct cell *space_getcell(struct space *s) {
/* Is the buffer empty? */
if
(
s
->
cells_new
==
NULL
)
{
if
(
posix_memalign
((
void
*
)
&
s
->
cells_new
,
64
,
if
(
posix_memalign
((
void
*
)
&
s
->
cells_new
,
cell_align
,
space_cellallocchunk
*
sizeof
(
struct
cell
))
!=
0
)
error
(
"Failed to allocate more cells."
);
bzero
(
s
->
cells_new
,
space_cellallocchunk
*
sizeof
(
struct
cell
));
...
...
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