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
e8c2ac7a
Commit
e8c2ac7a
authored
Dec 23, 2016
by
Matthieu Schaller
Browse files
Apply alignment changes to allocation
parent
d8c53b32
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/align.h
View file @
e8c2ac7a
...
...
@@ -19,9 +19,13 @@
#ifndef SWIFT_ALIGN_H
#define SWIFT_ALIGN_H
/**
* @brief The default struct alignment in SWIFT.
*/
#define SWIFT_STRUCT_ALIGNMENT 32
/**
* @brief Defines alignment of structures
*/
#define SWIFT_STRUCT_ALIGN __attribute__((aligned(
32
)))
#define SWIFT_STRUCT_ALIGN __attribute__((aligned(
SWIFT_STRUCT_ALIGNMENT
)))
#endif
/* SWIFT_ALIGN_H */
src/debug.c
View file @
e8c2ac7a
...
...
@@ -227,21 +227,21 @@ int checkCellhdxmax(const struct cell *c, int *depth) {
if
(
c
->
h_max
!=
h_max
)
{
message
(
"%d Inconsistent h_max: cell %f != parts %f"
,
*
depth
,
c
->
h_max
,
h_max
);
message
(
"location: %f %f %f"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
]);
error
(
"location: %f %f %f"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
]);
result
=
0
;
}
if
(
c
->
dx_max
!=
dx_max
)
{
message
(
"%d Inconsistent dx_max: %f != %f"
,
*
depth
,
c
->
dx_max
,
dx_max
);
message
(
"location: %f %f %f"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
]);
error
(
"location: %f %f %f"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
]);
result
=
0
;
}
/* Check rebuild criterion. */
if
(
h_max
>
c
->
dmin
)
{
/*
if (h_max > c->dmin) {
message("%d Inconsistent c->dmin: %f > %f", *depth, h_max, c->dmin);
message
(
"location: %f %f %f"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
]);
error
("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]);
result = 0;
}
}
*/
return
result
;
}
...
...
src/proxy.c
View file @
e8c2ac7a
...
...
@@ -102,7 +102,7 @@ void proxy_cells_exch2(struct proxy *p) {
/* Re-allocate the pcell_in buffer. */
if
(
p
->
pcells_in
!=
NULL
)
free
(
p
->
pcells_in
);
if
(
posix_memalign
((
void
**
)
p
->
pcells_in
,
SWIFT_STRUCT_ALIGNMENT
,
if
(
posix_memalign
((
void
**
)
&
p
->
pcells_in
,
SWIFT_STRUCT_ALIGNMENT
,
sizeof
(
struct
pcell
)
*
p
->
size_pcells_in
)
!=
0
)
error
(
"Failed to allocate pcell_in buffer."
);
...
...
src/queue.h
View file @
e8c2ac7a
...
...
@@ -30,6 +30,7 @@
#define queue_sizegrow 2
#define queue_search_window 8
#define queue_incoming_size 1024
#define queue_struct_align 64
/* Counters. */
enum
{
...
...
@@ -57,7 +58,7 @@ struct queue {
int
*
tid_incoming
;
volatile
unsigned
int
first_incoming
,
last_incoming
,
count_incoming
;
}
__attribute__
((
aligned
(
64
)));
}
__attribute__
((
aligned
(
queue_struct_align
)));
/* Function prototypes. */
struct
task
*
queue_gettask
(
struct
queue
*
q
,
const
struct
task
*
prev
,
...
...
src/scheduler.c
View file @
e8c2ac7a
...
...
@@ -1413,8 +1413,8 @@ void scheduler_init(struct scheduler *s, struct space *space, int nr_tasks,
lock_init
(
&
s
->
lock
);
/* Allocate the queues. */
if
(
(
s
->
queues
=
(
struct
queue
*
)
malloc
(
sizeof
(
struct
queue
)
*
nr_queues
))
==
NULL
)
if
(
posix_memalign
((
void
**
)
&
s
->
queues
,
queue_struct_align
,
sizeof
(
struct
queue
)
*
nr_queues
)
!=
0
)
error
(
"Failed to allocate queues."
);
/* Initialize each queue. */
...
...
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