Closed radonnachie closed 1 year ago
I executed BLADE with 1 coarse channel at a time, but lied in the metadata about the coarse_channel_size
being half as large as it is and so also lied about the num_coarse_channels
being 2 instead of 1... I saw the following. Note that only when a hit is past 131072 does the failure happen...
BLADE [INFO] | [M::DEDOPPLER] num_timesteps: 16
BLADE [INFO] | [M::DEDOPPLER] num_channels: 262144
BLADE [INFO] | [M::DEDOPPLER] coarse_channel_size: 131072
BLADE [INFO] | [M::DEDOPPLER] num_coarse_channels: 2
BLADE [INFO] | [M::DEDOPPLER] Dimensions [A, F, T, P]: [2, 262144, 16, 1] -> N/A
BLADE [INFO] | [M::DEDOPPLER] Coarse Channel Rate: 262144
BLADE [INFO] | [M::DEDOPPLER] Channel Bandwidth: -3.814697265625 Hz
BLADE [INFO] | [M::DEDOPPLER] Channel Timespan: 0.262144 s
.
.
.
BLADE [DEBUG] | [M::DEDOPPLER] Hit: coarse channel = 0, index = 131047, snr = 96.33874, drift rate = 4.85064 (-5 bins)
BLADE [DEBUG] | [M::DEDOPPLER] Hit: coarse channel = 0, index = 131047, snr = 96.33854, drift rate = 4.85064 (-5 bins)
BLADE [DEBUG] | [M::DEDOPPLER] Hit: coarse channel = 0, index = 131156, snr = 75.57085, drift rate = 2.91038 (-3 bins)
terminate called after throwing an instance of 'kj::ExceptionImpl'
[Detaching after vfork from child process 3164492]
what(): capnp/layout.c++:1188: failed: tried to allocate list with too many elements
stack: 7ffff7d7de79 7ffff7d8630a 7ffff7d7df88 7ffff7d7035b 7ffff7ca4622 7ffff7ca418f 7ffff7d67b2c 7ffff7d65aa7 7ffff7c928de 7ffff7b6339f 5555556684f7 555555650549 55555568e186 555555682f40 55555567248b 55555567194e 5555556672c4 5555556528bd 555555637c41 5555555df3f7 5555555df79b 5555555e0fae 5555555a6b4c 7ffff7149082 5555555a555d
??:0: returning here
This is also the case in the first run where there were actually 2 coarse channels, a hit that is in not in the first coarse channel leads to an out-of-bounds index.
Hmm, this sounds like there's some confusion about what the various parameters mean. What function in seticore are you calling that leads to this error, and what are the arguments you're calling it with? The "search" function expects to only be called on precisely one coarse channel at a time, and the hit file writer expects to be called with the same filterbank metadata that the search function was called with.
Oh, that sounds like it'd contend with how I'm using it, for starters I don't search only 1 coarse-channel at a time. I anticipated that the search would work off of num_channels
not distinguishing between coarse-channel boundaries.
Furthermore, the hits-file writer only takes a float*, not a buffer. So it feels like everything is in place to actually have these 2 be agnostic to coarse-channel boundaries... I'm sure we'd only need to tweak a few lines...
The typical normalization to calculate SNR is per coarse channel, ie per the entire search input, so if you just call dedoppler search on multiple coarse channels at once it will be normalizing differently. I'm not sure if that's a big problem though.
Assuming the single coarse channel restriction, I still have the use of the hits-writer taking the full (multi beam) databuffer. It works (no segfaults) but I wonder if some of the odd hits data I am seeing due to my different implmentation.
Instead of what I currently have:
this->output.hits.clear();
const auto inputDims = this->input.buf.dims();
const auto beamByteStride = this->input.buf.size() / inputDims.numberOfAspects();
BL_CHECK(Memory::Copy(this->buf, this->input.buf, stream));
const auto skipLastBeam = this->config.lastBeamIsIncoherent & (!this->config.searchIncoherentBeam);
const auto beamsToSearch = inputDims.numberOfAspects() - (skipLastBeam ? 1 : 0);
for (U64 beam = 0; beam < beamsToSearch; beam++) {
FilterbankBuffer filterbankBuffer = FilterbankBuffer(
inputDims.numberOfTimeSamples(),
inputDims.numberOfFrequencyChannels(),
this->input.buf.data() + beam*beamByteStride
);
dedopplerer.search(
filterbankBuffer,
this->metadata,
beam,
this->input.coarseFrequencyChannelOffset[0],
this->config.maximumDriftRate,
this->config.minimumDriftRate,
this->config.snrThreshold,
&this->output.hits
);
}
if (this->config.lastBeamIsIncoherent) {
FilterbankBuffer filterbankBuffer = FilterbankBuffer(
inputDims.numberOfTimeSamples(),
inputDims.numberOfFrequencyChannels(),
this->input.buf.data() + (inputDims.numberOfAspects()-1)*beamByteStride
);
dedopplerer.addIncoherentPower(filterbankBuffer, this->output.hits);
}
BL_CUDA_CHECK(cudaStreamSynchronize(stream), [&]{
BL_FATAL("Failed to synchronize stream: {}", err);
});
for (const DedopplerHit& hit : this->output.hits) {
hit_recorder->recordHit(hit, this->buf.data());
}
return Result::SUCCESS;
you'd say the following is better (more in line with expected implementation)
this->output.hits.clear();
const auto inputDims = this->input.buf.dims();
const auto beamByteStride = this->input.buf.size() / inputDims.numberOfAspects();
BL_CHECK(Memory::Copy(this->buf, this->input.buf, stream));
const auto skipLastBeam = this->config.lastBeamIsIncoherent & (!this->config.searchIncoherentBeam);
const auto beamsToSearch = inputDims.numberOfAspects() - (skipLastBeam ? 1 : 0);
std::vector<DedopplerHit> beamhits;
FilterbankBuffer incohFilterbankBuffer = FilterbankBuffer(
inputDims.numberOfTimeSamples(),
inputDims.numberOfFrequencyChannels(),
this->input.buf.data() + (inputDims.numberOfAspects()-1)*beamByteStride
);
for (U64 beam = 0; beam < beamsToSearch; beam++) {
FilterbankBuffer beamFilterbankBuffer = FilterbankBuffer(
inputDims.numberOfTimeSamples(),
inputDims.numberOfFrequencyChannels(),
this->input.buf.data() + beam*beamByteStride
);
dedopplerer.search(
beamFilterbankBuffer,
this->metadata,
beam,
this->input.coarseFrequencyChannelOffset[0],
this->config.maximumDriftRate,
this->config.minimumDriftRate,
this->config.snrThreshold,
&beamhits
);
if (this->config.lastBeamIsIncoherent) {
dedopplerer.addIncoherentPower(incohFilterbankBuffer, beamhits);
}
for (const DedopplerHit& hit : beamhits) {
hit_recorder->recordHit(hit, beamFilterbankBuffer.data);
this->output.hits.push_back(hit);
}
beamhits.clear()
}
BL_CUDA_CHECK(cudaStreamSynchronize(stream), [&]{
BL_FATAL("Failed to synchronize stream: {}", err);
});
return Result::SUCCESS;
To handle coarse channels, I would just nest another for loop... 🤷
The above segfaults in the hit-recorder..
Is beamFilterbankBuffer
a contiguous array? I'm a little curious that you're adding something named "byteStride" but it's a float pointer, right? The usage of the hit file writer is pretty simple, you just pass it the same input that the search
function got. Sample usage here is pretty straightforward to understand - https://github.com/lacker/seticore/blob/c2c10e521d7d25233a17d02e677aa05c861c0a12/run_dedoppler.cpp#L43
Closing as inactive
I get this error whenever the number of coarse-channels in the filterbank-metadata is > 1.