I do some operations on array using SIMD
, so I need to have them aligned in memory. When I place arrays on the stack
, I simply do this and it works:
#define BUFFER_SIZE 10000
alignas(16) float approxFreqMuls_Float[BUFFER_SIZE];
alignas(16) double approxFreqMuls_Double[BUFFER_SIZE];
But now I need to allocate more memory (such as 96k double
s, or more): so I think the heap
is the way; but when I do this:
int numSteps = 96000;
alignas(16) float *approxFreqMuls_Float = new float[numSteps];
alignas(16) double *approxFreqMuls_Double = new double[numSteps];
It thrown error on ostream
. Not really sure about the message (I'm on MSVC
, nothing appair).
How would you allocate aligned arrays on heap
?