Commit cf709f1d authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Clean up unused variables, throw in destructor and signed unsigned...

Clean up unused variables, throw in destructor and signed unsigned comparisions for debug mode compilation
parent 61fda057
......@@ -19,15 +19,15 @@ public:
void init(RawBytes& block);
bool operator()(RawBytes& block);
public:
private:
std::string _prefix;
std::size_t _counter;
int _nchan;
std::vector<std::ofstream> _output_streams;
size_t _nchan;
char _header[HEADER_SIZE];
char _start_time[START_TIME];
bool first_block;
std::vector<char> _transpose;
std::vector<std::ofstream> _output_streams;
};
} // edd
} // effelsberg
......
......@@ -19,15 +19,15 @@ public:
void init(RawBytes& block);
bool operator()(RawBytes& block);
public:
private:
std::string _prefix;
std::size_t _counter;
int _nthread;
std::vector<std::ofstream> _output_streams;
unsigned int _nthread;
char _header[HEADER_SIZE];
char _start_time[START_TIME];
bool first_block;
std::vector<char> _transpose;
std::vector<std::ofstream> _output_streams;
};
} // edd
} // effelsberg
......
......@@ -381,13 +381,13 @@ void GatedSpectrometer<HandlerType, InputType, OutputType>::process(SinglePolari
1, 0., 1, 0);
// count saturated samples
for(int output_block_number = 0; output_block_number <_nBlocks; output_block_number++)
for(size_t output_block_number = 0; output_block_number <_nBlocks; output_block_number++)
{
outputDataStream->G0._noOfOverflowed.a()[output_block_number] = 0;
outputDataStream->G1._noOfOverflowed.a()[output_block_number] = 0;
const int heaps_per_output_spectra = inputDataStream->_sideChannelData_h.size() / _naccumulate / _nBlocks;
for (int j = output_block_number * heaps_per_output_spectra ; j < (output_block_number+1) * heaps_per_output_spectra * _dadaBufferLayout.getNSideChannels(); j+=_dadaBufferLayout.getNSideChannels())
for (size_t j = output_block_number * heaps_per_output_spectra ; j < (output_block_number+1) * heaps_per_output_spectra * _dadaBufferLayout.getNSideChannels(); j+=_dadaBufferLayout.getNSideChannels())
{
if (TEST_BIT(inputDataStream->_sideChannelData_h.a().data()[j], 3))
{ // heap was lost
......@@ -420,7 +420,7 @@ void GatedSpectrometer<HandlerType, InputType, OutputType>::process(DualPolariza
gated_fft(inputDataStream->polarization0, outputDataStream->G0._noOfBitSets.a(), outputDataStream->G1._noOfBitSets.a());
gated_fft(inputDataStream->polarization1, outputDataStream->G0._noOfBitSets.a(), outputDataStream->G1._noOfBitSets.a());
for(int output_block_number = 0; output_block_number < outputDataStream->G0._noOfBitSets.size(); output_block_number++)
for(size_t output_block_number = 0; output_block_number < outputDataStream->G0._noOfBitSets.size(); output_block_number++)
{
size_t input_offset = output_block_number * inputDataStream->polarization0._channelised_voltage_G0.size() / outputDataStream->G0._noOfBitSets.size();
size_t output_offset = output_block_number * outputDataStream->G0.I.a().size() / outputDataStream->G0._noOfBitSets.size();
......@@ -452,7 +452,7 @@ void GatedSpectrometer<HandlerType, InputType, OutputType>::process(DualPolariza
size_t lostHeaps = 0;
const int heaps_per_output_spectra = inputDataStream->polarization0._sideChannelData_h.size() / _naccumulate / _nBlocks;
for (int j = output_block_number * heaps_per_output_spectra ; j < (output_block_number+1) * heaps_per_output_spectra * _dadaBufferLayout.getNSideChannels(); j+=_dadaBufferLayout.getNSideChannels())
for (size_t j = output_block_number * heaps_per_output_spectra ; j < (output_block_number+1) * heaps_per_output_spectra * _dadaBufferLayout.getNSideChannels(); j+=_dadaBufferLayout.getNSideChannels())
{
if (TEST_BIT(inputDataStream->polarization0._sideChannelData_h.a().data()[j], 3) || TEST_BIT(inputDataStream->polarization1._sideChannelData_h.a().data()[j], 3))
{
......
......@@ -7,7 +7,7 @@ namespace psrdada_cpp {
namespace effelsberg {
namespace edd {
DadaBufferLayout::DadaBufferLayout() {};
DadaBufferLayout::DadaBufferLayout() {}
DadaBufferLayout::DadaBufferLayout(key_t input_key, size_t heapSize, size_t nSideChannels)
{
......
......@@ -21,7 +21,7 @@ void merge2pol(char const *buf, char *out)
uint8_t *qword0 = (uint8_t*)(buf);
uint8_t *qword1 = (uint8_t*)(buf) + HEAP_SIZE;
uint64_t* D = reinterpret_cast<uint64_t*>(out);
for (int i = 0; i < HEAP_SIZE / sizeof(uint32_t); i++)
for (size_t i = 0; i < HEAP_SIZE / sizeof(uint32_t); i++)
{
uint32_t* S0 = reinterpret_cast<uint32_t*>(qword0);
uint32_t* S1 = reinterpret_cast<uint32_t*>(qword1);
......@@ -63,7 +63,6 @@ void EDDPolnMerge::init(RawBytes& block)
BOOST_LOG_TRIVIAL(debug) << "this is sync_time " << sync_time;
BOOST_LOG_TRIVIAL(debug) << "this is sample_clock_start / sample_clock " << sample_clock_start / sample_clock;
long double unix_time = sync_time + (sample_clock_start / sample_clock);
long double mjd_time = unix_time / 86400 - 40587.5;
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
......@@ -90,7 +89,6 @@ void EDDPolnMerge::init(RawBytes& block)
bool EDDPolnMerge::operator()(RawBytes& block)
{
std: size_t nheap_groups = block.used_bytes() / _npol / HEAP_SIZE;
/**
if (block.used_bytes() < block.total_bytes())
{
......
......@@ -81,7 +81,6 @@ uint64_t *unpack5(uint64_t *qword, uint8_t *out)
void handle_packet_numbers_4096x10_s(char const *buf, char *out)
{ // Print 4096 numbers of 10 bit signed integers.
uint64_t val, rest;
uint8_t S0_8bit[32];
uint8_t S1_8bit[32];
uint64_t *qword0 = (uint64_t*)(buf);
......@@ -134,7 +133,6 @@ void EDDPolnMerge10to8::init(RawBytes& block)
BOOST_LOG_TRIVIAL(debug) << "this is sync_time " << sync_time;
BOOST_LOG_TRIVIAL(debug) << "this is sample_clock_start / sample_clock " << sample_clock_start / sample_clock;
long double unix_time = sync_time + (sample_clock_start / sample_clock);
long double mjd_time = unix_time / 86400 - 40587.5;
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
......@@ -159,7 +157,6 @@ void EDDPolnMerge10to8::init(RawBytes& block)
bool EDDPolnMerge10to8::operator()(RawBytes& block)
{
std::cout << "Beginning of the operator" << std::endl;
std: size_t nheap_groups = block.used_bytes() / _npol / HEAP_SIZE_10BIT;
RawBytes& oblock = _writer.data_stream().next();
// if (block.used_bytes() > oblock.total_bytes())
......
......@@ -80,8 +80,6 @@ uint64_t *unpack5(uint64_t *qword, uint8_t *out)
void handle_packet_numbers_4096x10_s(char const *buf, char *out)
{ // Print 4096 numbers of 10 bit signed integers.
uint64_t val, rest;
uint64_t *qword0 = (uint64_t*)(buf);
uint8_t* D = reinterpret_cast<uint8_t*>(out);
for (int i = 0; i < 640 / 5; i++)
......@@ -124,7 +122,6 @@ void EDDPolnMerge10to8_1pol::init(RawBytes& block)
BOOST_LOG_TRIVIAL(debug) << "this is sync_time " << sync_time;
BOOST_LOG_TRIVIAL(debug) << "this is sample_clock_start / sample_clock " << sample_clock_start / sample_clock;
long double unix_time = sync_time + (sample_clock_start / sample_clock);
long double mjd_time = unix_time / 86400 - 40587.5;
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
......@@ -149,7 +146,6 @@ void EDDPolnMerge10to8_1pol::init(RawBytes& block)
bool EDDPolnMerge10to8_1pol::operator()(RawBytes& block)
{
std::cout << "Beginning of the operator" << std::endl;
std: size_t nheap_groups = block.used_bytes() / HEAP_SIZE_10BIT;
RawBytes& oblock = _writer.data_stream().next();
// if (block.used_bytes() > oblock.total_bytes())
......
......@@ -24,7 +24,6 @@ int main(int argc, char** argv)
key_t input_key;
key_t output_key;
std::size_t npol;
std::size_t nsamps_per_heap;
int nthreads;
/** Define and parse the program options
*/
......
......@@ -48,7 +48,6 @@ void EDDRoach::init(RawBytes& block)
BOOST_LOG_TRIVIAL(debug) << "this is sync_time " << sync_time;
BOOST_LOG_TRIVIAL(debug) << "this is sample_clock_start / sample_clock " << sample_clock_start / sample_clock;
long double unix_time = sync_time + (sample_clock_start / sample_clock);
long double mjd_time = unix_time / 86400 - 40587.5;
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
......
......@@ -41,7 +41,6 @@ void EDDRoach_merge::init(RawBytes& block)
BOOST_LOG_TRIVIAL(debug) << "this is sync_time " << sync_time;
BOOST_LOG_TRIVIAL(debug) << "this is sample_clock_start / sample_clock " << sample_clock_start / sample_clock;
long double unix_time = sync_time + (sample_clock_start / sample_clock);
long double mjd_time = unix_time / 86400 - 40587.5;
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
......
......@@ -24,7 +24,6 @@ int main(int argc, char** argv)
key_t input_key;
key_t output_key;
std::size_t nchunck;
std::size_t nsamps_per_heap;
int nthreads;
/** Define and parse the program options
......
......@@ -48,7 +48,6 @@ void EDDRoach_merge_leap::init(RawBytes& block)
BOOST_LOG_TRIVIAL(debug) << "this is sync_time " << sync_time;
BOOST_LOG_TRIVIAL(debug) << "this is sample_clock_start / sample_clock " << sample_clock_start / sample_clock;
long double unix_time = sync_time + (sample_clock_start / sample_clock);
long double mjd_time = unix_time / 86400 - 40587.5;
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
......
......@@ -24,7 +24,6 @@ int main(int argc, char** argv)
key_t input_key;
key_t output_key;
std::size_t nchunck;
std::size_t nsamps_per_heap;
int nthreads;
/** Define and parse the program options
......
......@@ -319,7 +319,7 @@ CUDA_ERROR_CHECK(cudaMemcpy2DAsync(
_dadaBufferLayout.sizeOfSideChannelData() / 2 / sizeof(uint64_t), cudaMemcpyHostToDevice, _h2d_stream));
uint64_t * sci = reinterpret_cast<uint64_t *>(block.ptr() + _dadaBufferLayout.sizeOfData() + _dadaBufferLayout.sizeOfGap());
for(int i =0; i < _dadaBufferLayout.sizeOfSideChannelData() / sizeof(uint64_t); i+=2)
for(size_t i =0; i < _dadaBufferLayout.sizeOfSideChannelData() / sizeof(uint64_t); i+=2)
{
polarization0._sideChannelData_h.a()[i / 2] = sci[i];
polarization1._sideChannelData_h.a()[i / 2] = sci[i + 1];
......
......@@ -102,7 +102,7 @@ void testStokesAccumulateParam(size_t nchans, size_t naccumulate){
// This channel should be left circular polarized
size_t idx0 = 23;
for (int k = 0; k< naccumulate; k++)
for (size_t k = 0; k< naccumulate; k++)
{
size_t idx = idx0 + k * nchans;
P0[idx] = (float2){0.0f, 1.0f/std::sqrt(2)};
......@@ -302,8 +302,8 @@ class GatedTestSinkSinglePol{
EXPECT_EQ(S[2], nHeaps * 4096 / 2);
// Correct number of overflowed samples
EXPECT_EQ(S[1], 27);
EXPECT_EQ(S[3], 23); // First heap has 23 and bit set, thus G1
EXPECT_EQ(S[1], 27uL);
EXPECT_EQ(S[3], 23uL); // First heap has 23 and bit set, thus G1
call_count ++;
return false;
......@@ -344,7 +344,7 @@ TEST(GatedSpectrometer, processingSinglePol)
//// fill sci data
uint64_t* sc_items = reinterpret_cast<uint64_t*>(raw_buffer + nHeaps * 4096);
for (int i = 0; i < nHeaps; i+=2)
for (size_t i = 0; i < nHeaps; i+=2)
{
sc_items[i] = 0;
sc_items[i+1] = 0;
......@@ -387,8 +387,8 @@ class GatedTestSinkFullStokes{
EXPECT_EQ(S[2], nHeaps * 4096) << "G1, S" << i;
// Correct number of overflowed samples
EXPECT_EQ(S[1], 27 + 7) << "G0, S" << i;;
EXPECT_EQ(S[3], 23 + 3) << "G1, S" << i;; // First heap has 23+3 and bit set, thus G1
EXPECT_EQ(S[1], uint64_t(27 + 7)) << "G0, S" << i;;
EXPECT_EQ(S[3], uint64_t(23 + 3)) << "G1, S" << i;; // First heap has 23+3 and bit set, thus G1
}
call_count ++;
......@@ -433,7 +433,7 @@ TEST(GatedSpectrometer, processingFullStokes)
//// fill sci data
uint64_t* sc_items = reinterpret_cast<uint64_t*>(raw_buffer + 2*nHeaps * 4096);
for (int i = 0; i < 2 * nHeaps; i+=4)
for (size_t i = 0; i < 2 * nHeaps; i+=4)
{
sc_items[i] = 0uL;
sc_items[i+1] = 0uL;
......
......@@ -22,7 +22,7 @@ void SpectralKurtosisCudaTester::TearDown()
{
}
void SpectralKurtosisCudaTester::test_vector_generation(std::size_t sample_size, std::size_t window_size,
void SpectralKurtosisCudaTester::test_vector_generation(std::size_t sample_size, std::size_t window_size,
bool with_rfi, float rfi_freq, float rfi_amp,
const std::vector<int> &rfi_window_indices,
std::vector<std::complex<float>> &samples)
......@@ -33,14 +33,14 @@ void SpectralKurtosisCudaTester::test_vector_generation(std::size_t sample_size,
tv.generate_test_vector(rfi_window_indices, samples);
}
void SpectralKurtosisCudaTester::sk_computation(std::size_t nch, std::size_t window_size,
void SpectralKurtosisCudaTester::sk_computation(std::size_t nch, std::size_t window_size,
const std::vector<std::complex<float>> &samples,
RFIStatistics &stat)
{
thrust::host_vector<thrust::complex<float>> h_samples(samples);
thrust::device_vector<thrust::complex<float>> d_samples(h_samples);
float sk_min = 0.8;
float sk_max = 1.2;
float sk_max = 1.2;
SpectralKurtosisCuda sk(nch, window_size, sk_min, sk_max);
sk.compute_sk(d_samples, stat);
}
......@@ -113,7 +113,7 @@ TEST_F(SpectralKurtosisCudaTester, sk_RFIreplacement)
thrust::host_vector<thrust::complex<float>> h_samples(samples);
thrust::device_vector<thrust::complex<float>> d_samples(h_samples);
float sk_min = 0.8;
float sk_max = 1.2;
float sk_max = 1.2;
std::size_t nch = 1;
SpectralKurtosisCuda sk(nch, window_size, sk_min, sk_max);
RFIStatistics stat;
......@@ -148,16 +148,16 @@ TEST_F(SpectralKurtosisCudaTester, sk_kernel)
thrust::host_vector<thrust::complex<float>> h_samples(samples);
thrust::device_vector<thrust::complex<float>> d_samples(h_samples);
std::size_t nch = 1;
std::size_t nch = 1;
SpectralKurtosisCuda sk(nch, window_size);
RFIStatistics stat, stat_k;
sk.compute_sk_thrust(d_samples, stat);
sk.compute_sk(d_samples, stat_k);
for (int ii = 0; ii < nwindows; ii++){
for (size_t ii = 0; ii < nwindows; ii++){
EXPECT_EQ(stat.rfi_status[ii], stat_k.rfi_status[ii]);
}
EXPECT_EQ(stat.rfi_fraction, stat_k.rfi_fraction);
//RFI replacement
BOOST_LOG_TRIVIAL(info) <<"RFI replacement..\n";
SKRfiReplacementCuda rr;
......
......@@ -64,7 +64,7 @@ void RSSpectrometerTester::run_dc_power_test(std::size_t input_nchans, std::size
}
RSSpectrometer spectrometer(input_nchans, fft_length, naccumulate, nskip, "/tmp/dc_power_test.bin");
spectrometer.init(header_block);
for (int ii=0; ii < nblocks; ++ii)
for (size_t ii=0; ii < nblocks; ++ii)
{
if (spectrometer(data_block))
{
......
......@@ -19,7 +19,7 @@ public:
*
*/
explicit DelayEngineSimulator(PipelineConfig const& config);
~DelayEngineSimulator();
~DelayEngineSimulator() noexcept(false);
DelayEngineSimulator(DelayEngineSimulator const&) = delete;
/**
......
......@@ -33,7 +33,7 @@ public:
* models.
*/
DelayManager(PipelineConfig const& config, cudaStream_t stream);
~DelayManager();
~DelayManager() noexcept(false); // Destructotors should not throw, but this one does
DelayManager(DelayManager const&) = delete;
/**
......
......@@ -66,7 +66,7 @@ DelayEngineSimulator::DelayEngineSimulator(PipelineConfig const& config)
sem_post(_mutex_id);
}
DelayEngineSimulator::~DelayEngineSimulator()
DelayEngineSimulator::~DelayEngineSimulator() noexcept(false)
{
if (munmap(_shm_ptr, sizeof(DelayModel)) == -1)
{
......@@ -127,4 +127,4 @@ DelayModel* DelayEngineSimulator::delay_model()
} //namespace fbfuse
} //namespace meerkat
} //namespace psrdada_cpp
\ No newline at end of file
} //namespace psrdada_cpp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment