diff --git a/OMPStream.cpp b/OMPStream.cpp index 189cacb..06346e7 100644 --- a/OMPStream.cpp +++ b/OMPStream.cpp @@ -7,6 +7,10 @@ #include "OMPStream.h" +#ifndef ALIGNMENT +#define ALIGNMENT (2*1024*1024) // 2MB +#endif + template OMPStream::OMPStream(const unsigned int ARRAY_SIZE, T *a, T *b, T *c, int device) { @@ -22,9 +26,9 @@ OMPStream::OMPStream(const unsigned int ARRAY_SIZE, T *a, T *b, T *c, int dev {} #else // Allocate on the host - this->a = (T*)malloc(sizeof(T)*array_size); - this->b = (T*)malloc(sizeof(T)*array_size); - this->c = (T*)malloc(sizeof(T)*array_size); + this->a = (T*)aligned_alloc(ALIGNMENT, sizeof(T)*array_size); + this->b = (T*)aligned_alloc(ALIGNMENT, sizeof(T)*array_size); + this->c = (T*)aligned_alloc(ALIGNMENT, sizeof(T)*array_size); #endif }