mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 19:50:34 +00:00
Better VOLK usage
This commit is contained in:
parent
e6f7af6f4c
commit
47f9929aa8
@ -116,8 +116,8 @@ TEST(Conjugate_Test, ArmadilloComplexImplementation)
|
||||
|
||||
TEST(Conjugate_Test, VolkComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_conjugate_test];
|
||||
std::complex<float>* output = new std::complex<float>[FLAGS_size_conjugate_test];
|
||||
std::complex<float>* input = (std::complex<float>*)volk_malloc(FLAGS_size_conjugate_test * sizeof(std::complex<float>), volk_get_alignment());
|
||||
std::complex<float>* output = (std::complex<float>*)volk_malloc(FLAGS_size_conjugate_test * sizeof(std::complex<float>), volk_get_alignment());
|
||||
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_conjugate_test);
|
||||
|
||||
struct timeval tv;
|
||||
@ -132,6 +132,6 @@ TEST(Conjugate_Test, VolkComplexImplementation)
|
||||
<< "-length complex float vector using VOLK finished in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
volk_free(input);
|
||||
volk_free(output);
|
||||
}
|
||||
|
@ -116,9 +116,9 @@ TEST(MagnitudeSquared_Test, ArmadilloComplexImplementation)
|
||||
|
||||
TEST(MagnitudeSquared_Test, VolkComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_magnitude_test];
|
||||
std::complex<float>* input = (std::complex<float>*)volk_malloc(FLAGS_size_magnitude_test * sizeof(std::complex<float>), volk_get_alignment());
|
||||
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_magnitude_test);
|
||||
float* output = new float[FLAGS_size_magnitude_test];
|
||||
float* output = (float*)volk_malloc(FLAGS_size_magnitude_test * sizeof(float), volk_get_alignment());
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
@ -131,8 +131,8 @@ TEST(MagnitudeSquared_Test, VolkComplexImplementation)
|
||||
<< "-length vector using VOLK computed in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
volk_free(input);
|
||||
volk_free(output);
|
||||
}
|
||||
|
||||
// volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size);
|
||||
|
@ -181,8 +181,8 @@ TEST(Multiply_Test, ArmadilloComplexImplementation)
|
||||
|
||||
TEST(Multiply_Test, VolkComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_multiply_test];
|
||||
std::complex<float>* output = new std::complex<float>[FLAGS_size_multiply_test];
|
||||
std::complex<float>* input = (std::complex<float>*)volk_malloc(FLAGS_size_multiply_test * sizeof(std::complex<float>), volk_get_alignment());
|
||||
std::complex<float>* output = (std::complex<float>*)volk_malloc(FLAGS_size_multiply_test * sizeof(std::complex<float>), volk_get_alignment());
|
||||
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_multiply_test);
|
||||
|
||||
struct timeval tv;
|
||||
@ -198,8 +198,9 @@ TEST(Multiply_Test, VolkComplexImplementation)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
|
||||
float* mag = new float [FLAGS_size_multiply_test];
|
||||
float* mag = (float*)volk_malloc(FLAGS_size_multiply_test * sizeof(float), volk_get_alignment());
|
||||
volk_32fc_magnitude_32f(mag, output, FLAGS_size_multiply_test);
|
||||
|
||||
float* result = new float(0);
|
||||
volk_32f_accumulator_s32f(result, mag, FLAGS_size_multiply_test);
|
||||
// Comparing floating-point numbers is tricky.
|
||||
@ -207,8 +208,8 @@ TEST(Multiply_Test, VolkComplexImplementation)
|
||||
// See http://code.google.com/p/googletest/wiki/AdvancedGuide#Floating-Point_Comparison
|
||||
float expected = 0;
|
||||
ASSERT_FLOAT_EQ(expected, result[0]);
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
delete [] mag;
|
||||
volk_free(input);
|
||||
volk_free(output);
|
||||
volk_free(mag);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user