Skip to content
Snippets Groups Projects
Commit d8c53b32 authored by Pedro Gonnet's avatar Pedro Gonnet Committed by Matthieu Schaller
Browse files

align allocated pcells correctly.

parent f27422ab
No related branches found
No related tags found
No related merge requests found
...@@ -65,8 +65,8 @@ void proxy_cells_exch1(struct proxy *p) { ...@@ -65,8 +65,8 @@ void proxy_cells_exch1(struct proxy *p) {
/* Allocate and fill the pcell buffer. */ /* Allocate and fill the pcell buffer. */
if (p->pcells_out != NULL) free(p->pcells_out); if (p->pcells_out != NULL) free(p->pcells_out);
if ((p->pcells_out = malloc(sizeof(struct pcell) * p->size_pcells_out)) == if (posix_memalign((void **)&p->pcells_out, SWIFT_STRUCT_ALIGNMENT,
NULL) sizeof(struct pcell) * p->size_pcells_out) != 0)
error("Failed to allocate pcell_out buffer."); error("Failed to allocate pcell_out buffer.");
for (int ind = 0, k = 0; k < p->nr_cells_out; k++) { for (int ind = 0, k = 0; k < p->nr_cells_out; k++) {
memcpy(&p->pcells_out[ind], p->cells_out[k]->pcell, memcpy(&p->pcells_out[ind], p->cells_out[k]->pcell,
...@@ -102,8 +102,8 @@ void proxy_cells_exch2(struct proxy *p) { ...@@ -102,8 +102,8 @@ void proxy_cells_exch2(struct proxy *p) {
/* Re-allocate the pcell_in buffer. */ /* Re-allocate the pcell_in buffer. */
if (p->pcells_in != NULL) free(p->pcells_in); if (p->pcells_in != NULL) free(p->pcells_in);
if ((p->pcells_in = (struct pcell *)malloc(sizeof(struct pcell) * if (posix_memalign((void **)p->pcells_in, SWIFT_STRUCT_ALIGNMENT,
p->size_pcells_in)) == NULL) sizeof(struct pcell) * p->size_pcells_in) != 0)
error("Failed to allocate pcell_in buffer."); error("Failed to allocate pcell_in buffer.");
/* Receive the particle buffers. */ /* Receive the particle buffers. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment