The failed example on Travis for wtheta doctests results in a seg-fault. This seg-fault occurs when weights are specified and brute-force is used (for all isa in ['avx', 'sse42', 'fallback'])
from __future__ import print_function
import numpy as np
import time
from math import pi
from os.path import dirname, abspath, join as pjoin
import Corrfunc
from Corrfunc.mocks.DDtheta_mocks import DDtheta_mocks
binfile = pjoin(dirname(abspath(Corrfunc.__file__)),
"../mocks/tests/", "angular_bins")
N = 100000
nthreads = 1
seed = 42
np.random.seed(seed)
RA = np.random.uniform(0.0, 2.0*pi, N)*180.0/pi
cos_theta = np.random.uniform(-1.0, 1.0, N)
DEC = 90.0 - np.arccos(cos_theta)*180.0/pi
autocorr = 1
weights = np.ones_like(RA)
results = DDtheta_mocks(autocorr, nthreads, binfile,
RA, DEC,
weights1=weights, weight_type='pair_product',
link_in_ra=False,link_in_dec=False, verbose=True,
isa='avx')
From my initial debugging, the second weights pointer (weights1) is not assigned a proper value for autocorr==1 and correspondingly the local copy (local_w1.weights) remains a NULL pointer. However, this local pointer is de-referenced and results in the seg-fault. Offending line in the fallback case is here:
for(int w = 0; w < pair.num_weights; w++){
pair.weights1[w].d = *local_w1.weights[w]++;
}
@lgarrison since you are much more familiar with the weights - do you mind confirming and fixing this one? Easiest fix in my mind would be to simply assign weights1 to weights0 in case of autocorr==1
The failed example on Travis for wtheta doctests results in a seg-fault. This seg-fault occurs when weights are specified and brute-force is used (for all
isa
in['avx', 'sse42', 'fallback']
)From my initial debugging, the second weights pointer (
weights1
) is not assigned a proper value forautocorr==1
and correspondingly the local copy (local_w1.weights
) remains aNULL
pointer. However, this local pointer is de-referenced and results in the seg-fault. Offending line in thefallback
case is here:@lgarrison since you are much more familiar with the weights - do you mind confirming and fixing this one? Easiest fix in my mind would be to simply assign
weights1
toweights0
in case ofautocorr==1