Commit 2fd93d82 authored by sakthipriyas's avatar sakthipriyas
Browse files

updated sk kernel test

parent d38973a0
......@@ -122,8 +122,9 @@ void SpectralKurtosisCuda::compute_sk_k(thrust::device_vector<thrust::complex<fl
stats.rfi_status.resize(_nwindows);
thrust::complex<float> *k_data = thrust::raw_pointer_cast(data.data());
int *k_rfi_status = thrust::raw_pointer_cast(stats.rfi_status.data());
compute_sk_kernel<<<1, _nwindows>>> (k_data, _sample_size, _window_size, _sk_max, _sk_min, k_rfi_status);
int blockSize = 1024;
int gridSize = _nwindows / blockSize;
compute_sk_kernel<<<gridSize, blockSize>>> (k_data, _sample_size, _window_size, _sk_max, _sk_min, k_rfi_status);
//compute_sk_kernel<<<_nwindows, 1>>> (k_data, _sample_size, _window_size, _sk_max, _sk_min, k_rfi_status); //works.
stats.rfi_fraction = thrust::reduce(stats.rfi_status.begin(), stats.rfi_status.end(), 0.0f) / _nwindows;
BOOST_LOG_TRIVIAL(info) << "RFI fraction: " << stats.rfi_fraction;
......
......@@ -81,7 +81,7 @@ TEST_F(SpectralKurtosisCudaTester, sk_withRFI)
TEST_F(SpectralKurtosisCudaTester, sk_RFIreplacement)
{
std::size_t sample_size = 1024 * 1024;
std::size_t sample_size = 128* 1024 * 1024;
//std::size_t sample_size = 160000000;
std::size_t window_size = 1024 * 2;
//Test vector generation
......@@ -114,9 +114,10 @@ TEST_F(SpectralKurtosisCudaTester, sk_RFIreplacement)
TEST_F(SpectralKurtosisCudaTester, sk_kernel)
{
std::size_t sample_size = 1024 * 1024;
std::size_t sample_size = 128 * 1024 * 1024;
//std::size_t sample_size = 160000000;
std::size_t window_size = 1024 * 2;
std::size_t nwindows = sample_size / window_size;
//Test vector generation
std::vector<int> rfi_window_indices{3, 4, 6, 7, 8, 20, 30, 40, 45, 75};
std::vector<std::complex<float>> samples;
......@@ -128,8 +129,13 @@ TEST_F(SpectralKurtosisCudaTester, sk_kernel)
float sk_min = 0.8;
float sk_max = 1.2;
SpectralKurtosisCuda sk(1, window_size, sk_min, sk_max);
RFIStatistics stat;
sk.compute_sk_k(d_samples, stat);
RFIStatistics stat, stat_k;
sk.compute_sk(d_samples, stat);
sk.compute_sk_k(d_samples, stat_k);
for (int 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);
}
} //test
......
Supports Markdown
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