Same code works fine on ARM linux but reaches segfault on x86 linux
Hi,
I have a piece of code that runs fine on a soc (https://www.khadas.com/vim3) , OS: Linux V32106250633 4.9.241 #18 SMP PREEMPT Fri Jun 25 14:18:34 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
but it always run into segfault on a x86 linux PC, OS: Linux sxm-Latitude-5420 5.13.0-41-generic #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
PSSSearcherOut PSSSearcher(vector<vector<float>> GSCNs, float fc, blaze::DynamicVector<complex<float>> xIn, float fs)
{
TRF_LL_DEBUG("NR::PSSSearcher::xIn.size() = %d \n", xIn.size());
PSSSearcherOut PSSSearcherReturnData; //[GSCNInfo, NID2_hat, x_corrected, cfo_hat, ppPos]
int fSearchMax = 2; //in terms of ssbSCS. Then the coarse frequency offset could be in [-fSearchMax, fSearchMax]*
int NFFT_SSB = 256;
blaze::DynamicVector<float> t_vec;
TRF_LL_DEBUG("NR::PSSSearcher:: blaze t_vec is created without with the default constructor\n");
t_vec = linspace(xIn.size(), 0.0f, (xIn.size() - 1) / fs);
// blaze::CustomVector<complex<float>, unaligned, unpadded, columnVector> xInBlaze(xIn, (size_t) xInSize);
TRF_LL_DEBUG("NR::PSSSearcher:: fc = %f\n", fc);
TRF_LL_DEBUG("NR::PSSSearcher:: t_vec.size() = %d\n", t_vec.size());
// iteration over all unique (SSB SCS, SS_REF) pairs. We know that they are
// unique in GSCNs
float ppVal = 0;
float ppcfoCoarse = 0;
float ppcfoFine = 0;
// blaze::DynamicVector<float> complxAux(t_vec.size());
for (int ii = 0; ii < GSCNs.size(); ii++)
{
//frequency shifting the current GSCN to DC
float fd = (fc - GSCNs[ii].back()) * 1e6;
// complxAux = 2 * PI * fd * t_vec ;
blaze::DynamicVector<complex<float>> cplx;
cplx = blaze::exp(complex<float>(0, 2*PI*fd)*t_vec);
TRF_LL_DEBUG("NR::PSSSearcher:: complex exponential vector is created\n");
// cplx = map(complxAux, [](float v) { return complex<float>(cos(v), sin(v)); });
blaze::DynamicVector<complex<float>, columnVector> x_;
TRF_LL_DEBUG("NR::PSSSearcher:: before freq. shifting &xIn[0] = %x, xIn[0] = (%f,%f) \n", &xIn[0], xIn[0].real(), xIn[0].imag());
TRF_LL_DEBUG("NR::PSSSearcher:: before freq. shifting &cplx[0] = %x, cplx[0] = (%f,%f) \n", &cplx[0], cplx[0].real(), cplx[0].imag());
x_ = xIn * cplx;
The segfault always happens at the last line of the code posted here “x_ = xIn * cplx;”
I have attached a full trace of a core dump ran through gdb “PC_linux_x86_Blaze_issue”
Any suggestions on what might be the issue between both systems will be appreciated.
Comments (3)
-
-
- changed status to wontfix
-
reporter - changed status to closed
Hi, I never got to the exact root cause of this one, I believe it was a weird bug on my end, not Blaze, causing it. We changed how we initialized some of the data vectors we were feeding into Blaze and the issue was resolved.
It was probably some thread concurrency issue or compiler difference between ARM and x86 that caused this different behavior.
- Log in to comment
Hi Luis!
Thanks for taking the time to report this potential problem. Based on the information provided it is unfortunately impossible for us to reproduce the problem: the given code snippet doesn’t compile and we don’t have any information about the size of the involved vectors. Could you please provide us with a minimum example, which compiles and fails on x86? Thank you,
Best regards,
Klaus!