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

Fixed comparison between signed and unsigned integer expressions

parent 7bfc1271
......@@ -122,7 +122,7 @@ TEST(GatedSpectrometer, countBitSet) {
psrdada_cpp::effelsberg::edd::
countBitSet<<<(_sideChannelData.size() + 255) / 256, 256>>>(
sideCD, nBlocks, 0, 1, 0, thrust::raw_pointer_cast(res.data()));
EXPECT_EQ(res[0], 0);
EXPECT_EQ(res[0], 0u);
res[0] = 0;
thrust::fill(_sideChannelData.begin(), _sideChannelData.end(), 1L);
......@@ -139,7 +139,7 @@ TEST(GatedSpectrometer, countBitSet) {
psrdada_cpp::effelsberg::edd::countBitSet<<<(_sideChannelData.size() + 255) / 256, 256>>>(
sideCD, nBlocks, 0, nSideChannels, 3,
thrust::raw_pointer_cast(res.data()));
EXPECT_EQ(res[0], 0);
EXPECT_EQ(res[0], 0u);
res[0] = 0;
psrdada_cpp::effelsberg::edd::countBitSet<<<(_sideChannelData.size() + 255) / 256, 256>>>(
......
......@@ -218,7 +218,7 @@ TEST_F(UnpackerTester, 12_bit_unpack_test)
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(1,1<<31);
InputType host_input(n);
for (int ii = 0; ii < n; ++ii)
for (size_t ii = 0; ii < n; ++ii)
{
host_input[ii] = distribution(generator);
}
......@@ -237,7 +237,7 @@ TEST_F(UnpackerTester, 8_bit_unpack_test)
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(1,1<<31);
InputType host_input(n);
for (int ii = 0; ii < n; ++ii)
for (size_t ii = 0; ii < n; ++ii)
{
host_input[ii] = distribution(generator);
}
......
......@@ -139,7 +139,7 @@ void CoherentBeamformerTester::compare_against_host(
_config.npol(),
_config.cb_power_scaling(),
_config.cb_power_offset());
for (int ii = 0; ii < btf_powers_host.size(); ++ii)
for (size_t ii = 0; ii < btf_powers_host.size(); ++ii)
{
ASSERT_TRUE(std::abs(static_cast<int>(btf_powers_host[ii]) - btf_powers_cuda[ii]) <= 1);
}
......@@ -164,13 +164,13 @@ TEST_F(CoherentBeamformerTester, representative_noise_test)
int nsamples = _config.nsamples_per_heap() * ntimestamps;
std::size_t weights_size = _config.cb_nantennas() * _config.nchans() * _config.cb_nbeams();
HostVoltageVectorType ftpa_voltages_host(input_size);
for (int ii = 0; ii < ftpa_voltages_host.size(); ++ii)
for (size_t ii = 0; ii < ftpa_voltages_host.size(); ++ii)
{
ftpa_voltages_host[ii].x = static_cast<int8_t>(std::lround(normal_dist(generator)));
ftpa_voltages_host[ii].y = static_cast<int8_t>(std::lround(normal_dist(generator)));
}
HostWeightsVectorType fbpa_weights_host(weights_size);
for (int ii = 0; ii < fbpa_weights_host.size(); ++ii)
for (size_t ii = 0; ii < fbpa_weights_host.size(); ++ii)
{
// Build complex weight as C * exp(i * theta).
std::complex<double> val = 127.0f * std::exp(std::complex<float>(0.0f, uniform_dist(generator)));
......
......@@ -115,10 +115,10 @@ void IncoherentBeamformerTester::compare_against_host(
_config.nsamples_per_heap(),
_config.ib_power_scaling(),
_config.ib_power_offset());
for (int ii = 0; ii < tf_powers_host.size(); ++ii)
for (size_t ii = 0; ii < tf_powers_host.size(); ++ii)
{
ASSERT_TRUE(std::abs(static_cast<int>(tf_powers_host[ii]) - tf_powers_cuda[ii]) <= 1);
}
}
}
TEST_F(IncoherentBeamformerTester, ib_representative_noise_test)
......@@ -133,7 +133,7 @@ TEST_F(IncoherentBeamformerTester, ib_representative_noise_test)
std::size_t input_size = (ntimestamps * _config.ib_nantennas()
* _config.nchans() * _config.nsamples_per_heap() * _config.npol());
HostVoltageVectorType taftp_voltages_host(input_size);
for (int ii = 0; ii < taftp_voltages_host.size(); ++ii)
for (size_t ii = 0; ii < taftp_voltages_host.size(); ++ii)
{
taftp_voltages_host[ii].x = static_cast<int8_t>(std::lround(normal_dist(generator)));
taftp_voltages_host[ii].y = static_cast<int8_t>(std::lround(normal_dist(generator)));
......
......@@ -57,9 +57,9 @@ void SplitTransposeTester::transpose_c_reference(
int input_antenna_idx = antenna_idx + start_antenna;
for (int chan_idx = 0; chan_idx < nchans; ++chan_idx)
{
for (int samp_idx = 0; samp_idx < _config.nsamples_per_heap(); ++samp_idx)
for (size_t samp_idx = 0; samp_idx < _config.nsamples_per_heap(); ++samp_idx)
{
for (int pol_idx = 0; pol_idx < _config.npol(); ++pol_idx)
for (size_t pol_idx = 0; pol_idx < _config.npol(); ++pol_idx)
{
int input_idx = (timestamp_idx * aftp + input_antenna_idx
* ftp + chan_idx * tp + samp_idx * _config.npol() + pol_idx);
......@@ -86,7 +86,7 @@ void SplitTransposeTester::compare_against_host(
_config.total_nantennas(), _config.cb_nantennas(),
_config.cb_antenna_offset(), _config.nchans(),
ntimestamps);
for (int ii = 0; ii < host_output.size(); ++ii)
for (size_t ii = 0; ii < host_output.size(); ++ii)
{
ASSERT_EQ(host_output[ii].x, cuda_output[ii].x);
ASSERT_EQ(host_output[ii].y, cuda_output[ii].y);
......@@ -101,7 +101,7 @@ TEST_F(SplitTransposeTester, cycling_prime_test)
* _config.nchans() * _config.nsamples_per_heap() * _config.npol());
HostVoltageType host_gpu_input(input_size);
for (int ii = 0; ii < input_size; ++ii)
for (size_t ii = 0; ii < input_size; ++ii)
{
host_gpu_input[ii].x = (ii % 113);
host_gpu_input[ii].y = (ii % 107);
......
......@@ -85,7 +85,7 @@ void WeightsManagerTester::compare_against_host(
_config.channel_frequencies(), _config.cb_nantennas(),
_config.cb_nbeams(), _config.channel_frequencies().size(),
epoch, 0.0, 1);
for (int ii = 0; ii < cuda_weights.size(); ++ii)
for (size_t ii = 0; ii < cuda_weights.size(); ++ii)
{
ASSERT_EQ(c_weights[ii].x, cuda_weights[ii].x);
ASSERT_EQ(c_weights[ii].y, cuda_weights[ii].y);
......
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