Valgrind: segmentation fault error

Pages: 12
fftw_malloc() allocates the buffer with alignment suitable for SIMD, which FFTW can make use of.
that negatively impact the propagation and accuracy of GPS signals.

interesting ... for a while (and many years ago) they were looking at *using* generated plasma/wig fields to steer or reduce air resists and such in planes (it takes more energy than made sense back then, dunno if it ever got anywhere). I don't know that anyone thought about gps reception since it was never practical when I was involved...
@lastchance

Why don't you simply use std::vector rather than all those dynamic arrays? Then you will never have to use a malloc or a free (which will reduce the line count in your code by 20% or so to start with, and the likelihood of bugs by a similar amount).

Yeah, I am starting to look into this. Probably will save me a lot of pain.


BTW, there is no point in timing your code with the -g option set (which puts all the debug information in, and turns off optimisation). When you do come to timing, turn -O3 on.


Thanks! I am doing this now.

@jonnin

interesting ... for a while (and many years ago) they were looking at *using* generated plasma/wig fields to steer or reduce air resists and such in planes (it takes more energy than made sense back then, dunno if it ever got anywhere). I don't know that anyone thought about gps reception since it was never practical when I was involved...

Wow that's interesting that you were involved. Yeah there's so much plasma/atmospheric research out there now concerned with GPS accuracy, especially within the military. I am obviously just starting into this field, but it's really fascinating and pretty cool.

yea military R&D decades ago. I was mostly on the sidelines for the plasma side, helped out with a couple of computations and some animations, minimal actual contributions.

If they ever get the ability to project it along a surface consistently without hauling a city sized power supply .. it will be a game changer for commercial aircraft and maybe land/watercraft too. The fuel saved and costs cut would be astonishing. But its like supercomputing at room temp... we know it would be nice to have, but can't seem to get there ..
Last edited on
ne[j + ny*i] = (a * tanh(b*(XX[j + ny*i] + c)) + d + a2 * tanh(b*(XX[j + ny*i] + c2)) + d2 + .02*cos(4*M_PI * YY[j + ny*i]/Ly) *( exp( - bg * pow(XX[j + ny*i] - xg,2)) + exp(-bg* pow( XX[j + ny*i] - Lx + xg,2) ) ) ) * 1.E11;


Since time is a major issue for you, realize that pow(x, 2) is much slower than x*x. So, I would consider something like this:

1
2
3
4
5
6
7
int index = j + ny*i;
double xxValue1 = XX[index ] - xg;
double xxValue2 = XX[index ] - Lx + xg;
ne[index ] =  (a * tanh(b*(XX[index ] + c)) + d +
                 a2 * tanh(b*(XX[index ] + c2)) + d2 +
                 .02*cos(4*M_PI * YY[index ]/Ly) *
                 ( exp( - bg * xxValue1 * xxValue1 ) + exp(-bg * xxValue2 * xxValue2  ) ) ) * 1.E11;

Registered users can post here. Sign in or register to post.
Pages: 12