1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-28 07:53:15 +00:00

Code cleaning

This commit is contained in:
Carles Fernandez 2014-11-22 10:19:06 +01:00
parent 7a90027989
commit 1fadab3d08
34 changed files with 1487 additions and 1329 deletions

View File

@ -0,0 +1,20 @@
########################################################################
# Adding proto-kernels to the module
########################################################################
1) Add your proto-kernels inside the kernels/ folder, and the ORC implementations inside the orc/ folder. Add the macros implementations inside the /kernels/CommonMacros folder. (those folders are found in the root of the volk_gnsssdr module)
2) Add one profiling line for each of the proto-kernels inside the /apps/volk_gnsssdr_profile.cc file.
3) Add one test line for each of the proto-kernels inside the /lib/testqa.cc file. ########################################################################
# Modifications to allow profiling of some proto-kernels with special parameters
######################################################################## Some of the proto-kernels that GNSS-SDR needs are not supported by the profiling environment of the volk_gnsssdr module. In order to profile them some modifications need to be done to two files: 1) src/algorithms/libs/volk_gnsssdr/lib/qa_utils.cc At the first part of this file there are defined the parameters supported by the environment. The number after run_cast_test indicates the total number of parameters passed to the proto-kernel (input +output parameters). The other part indicates the type of the data passed. Inside func(....) you will need to add the same number of buffs[ ] that the one specified after run_cast_test.
2) src/algorithms/libs/volk_gnsssdr/lib/qa_utils.h In the header you will need to add typedefs for the new definitions made in the .cc file. Take care: you will need to add the same number of void * that the one specified after run_cast_test.
3) To be able to use volk_gnsssdr and default volk functions at the same time in the same file, it is required to add the template files that volk_gnsssdr module uses at build time to generate some headers.
The files are found inside tmpl/: volk_gnsssdr.tmpl.h
volk_gnsssdr_typedefs.tmpl.h
volk_gnsssdr_machines.tmpl.h
volk_gnsssdr_cpu.tmpl.h
volk_gnsssdr_config_fixed.tmpl.h

View File

@ -27,7 +27,7 @@ Processors providing SIMD instruction sets compute with multiple processing elem
\.TP
Check http://gnss-sdr.org for more information.
.SH HISTORY
This library was originally developed by Andres Cecilia Luque in the framework of the Summer of Code in Space program (SOCIS 2014) by the European Space Agency (ESA), and then integrated into \fBgnss-sdr\fR.
This library was originally developed by Andres Cecilia Luque in the framework of the Summer of Code in Space program (SOCIS 2014) by the European Space Agency (ESA), and then integrated into \fBgnss-sdr\fR. This software is based on the VOLK library available at https://gnuradio.org/redmine/projects/gnuradio/wiki/Volk
.SH BUGS
No known bugs.
.SH AUTHOR

View File

@ -1,5 +1,9 @@
/* -*- c++ -*- */
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*!
* \file constants.h
* \brief volk_gnsssdr constants
* \author Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*
@ -17,8 +21,8 @@
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_VOLK_CONSTANTS_H
#define INCLUDED_VOLK_CONSTANTS_H
#ifndef GNSS_SDR_VOLK_GNSSSDR_CONSTANTS_H
#define GNSS_SDR_VOLK_GNSSSDR_CONSTANTS_H
#include <volk_gnsssdr/volk_gnsssdr_common.h>
@ -33,4 +37,4 @@ VOLK_API char* volk_gnsssdr_available_machines();
__VOLK_DECL_END
#endif /* INCLUDED_VOLK_CONSTANTS_H */
#endif /* GNSS_SDR_VOLK_GNSSSDR_CONSTANTS_H */

View File

@ -1,4 +1,9 @@
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*!
* \file volk_gnsssdr_common.h
* \brief Cross-platform attribute macros
* \author Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*
@ -111,4 +116,4 @@ union bit128{
#define bit128_p(x) ((union bit128 *)(x))
#endif /*INCLUDED_LIBVOLK_COMMON_H*/
#endif /* INCLUDED_LIBVOLK_COMMON_H */

View File

@ -1,4 +1,9 @@
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*!
* \file volk_gnsssdr_complex.h
* \brief Provide typedefs and operators for all complex types in C and C++.
* \author Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*

View File

@ -1,5 +1,10 @@
/* -*- c -*- */
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*!
* \file volk_gnsssdr_malloc.h
* \brief The volk_gnsssdr_malloc function behaves like malloc in that it
* returns a pointer to the allocated memory.
* \author Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*
@ -34,7 +39,7 @@ __VOLK_DECL_BEGIN
* memory that are guaranteed to be on an alignment, VOLK handles this
* itself. The volk_gnsssdr_malloc function behaves like malloc in that it
* returns a pointer to the allocated memory. However, it also takes
* in an alignment specfication, which is usually something like 16 or
* in an alignment specification, which is usually something like 16 or
* 32 to ensure that the aligned memory is located on a particular
* byte boundary for use with SIMD.
*
@ -55,7 +60,7 @@ VOLK_API void *volk_gnsssdr_malloc(size_t size, size_t alignment);
/*!
* \brief Free's memory allocated by volk_gnsssdr_malloc.
* \param aptr The aligned pointer allocaed by volk_gnsssdr_malloc.
* \param aptr The aligned pointer allocated by volk_gnsssdr_malloc.
*/
VOLK_API void volk_gnsssdr_free(void *aptr);

View File

@ -1,4 +1,10 @@
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*!
* \file volk_gnsssdr_prefs.h
* \brief Gets path to volk_gnsssdr_config profiling info and loads
* prefs into global prefs struct
* \author Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*
@ -31,16 +37,16 @@ typedef struct volk_gnsssdr_arch_pref
char impl_u[128]; //best unaligned impl
} volk_gnsssdr_arch_pref_t;
////////////////////////////////////////////////////////////////////////
// get path to volk_gnsssdr_config profiling info
////////////////////////////////////////////////////////////////////////
/*!
* \brief get path to volk_gnsssdr_config profiling info
*/
VOLK_API void volk_gnsssdr_get_config_path(char *);
////////////////////////////////////////////////////////////////////////
// load prefs into global prefs struct
////////////////////////////////////////////////////////////////////////
/*!
* \brief load prefs into global prefs struct
*/
VOLK_API size_t volk_gnsssdr_load_preferences(volk_gnsssdr_arch_pref_t **);
__VOLK_DECL_END
#endif //INCLUDED_VOLK_PREFS_H
#endif /* INCLUDED_VOLK_PREFS_H */

View File

@ -9,13 +9,13 @@ Inline functions have been tested, and they introduce a really small time penalt
Syntax
####################################################################
In order to allow better understanding of the code I created the macros with an specific syntax.
In order to allow better understanding of the code we created the macros with a specific syntax:
1) Inside CommonMacros.h you will find macros for common operations. I will explain the syntax with an example:
1) Inside CommonMacros.h you will find macros for common operations. we will explain the syntax with an example:
example: CM_16IC_X4_SCALAR_PRODUCT_16IC_X2_U_SSE2(realx, imagx, realy, imagy, realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy, real_output, imag_output)
First of all, you find the characters “CM”, which means CommonMacros. After that the type and the amount of inputs is placed: “_16IC_X4” (16 bits complex integers, four inputs). The syntax for type is the same as the one used with volk protokernels, refer to GNURadio documentation for more help. The it comes the name of the macro (“_SCALAR_PRODUCT”), and after that the type and the amount of outputs (“_16IC_X2”). Finally it is placed the SSE minimum version needed to run (“_U_SSE2”). In the arguments you will find (from left to right) the inputs (four inputs: realx, imagx, realy, imagy), some variables that the macro needs to work (realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy) and finally the outputs (two outputs: real_output, imag_output).
First of all, you find the characters â"CM", which means CommonMacros. After that the type and the amount of inputs is placed: "_16IC_X4" (16 bits complex integers, four inputs). The syntax for type is the same as the one used with volk protokernels, refer to GNURadio documentation for more help. The it comes the name of the macro ("_SCALAR_PRODUCT"), and after that the type and the amount of outputs ("_16IC_X2"). Finally it is placed the SSE minimum version needed to run ("_U_SSE2"). In the arguments you will find (from left to right) the inputs (four inputs: realx, imagx, realy, imagy), some variables that the macro needs to work (realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy) and finally the outputs (two outputs: real_output, imag_output).
The variables that the macro needs are specified when calling it in order to avoid after-compile problems: if you want to use a macro you will need to declare all the variables it needs before, or you will not be able to compile.
2) Inside all the other headers, CommonMacros_XXXXXX.h you will find macros for a specific group of proto-kernels. The syntax is the same as the CommonMacros.h
@ -24,11 +24,11 @@ The variables that the macro needs are specified when calling it in order to avo
Workflow
####################################################################
In order to use the macros easily, I usually test the code without macros inside a testing proto-kernel, where you are able to test it, debug it and use breakpoints.
When it works I place code inside a macro an I test it again.
In order to use the macros easily, we usually test the code without macros inside a testing proto-kernel, where you are able to test it, debug it and use breakpoints.
When it works we place code inside a macro an I test it again.
####################################################################
Why macros
####################################################################
1) They are the only way I could find for sharing code between proto-kernels without performance penalty.
1) They are the only way we could find for sharing code between proto-kernels without performance penalty.
2) It is true that they are really difficult to debug, but if you work with them responsibly it is not so hard. Volk_gnsssdr checks all the SSE proto-kernels implementations results against the generic implementation results, so if your macro is not working you will appreciate it after profiling it.

View File

@ -25,16 +25,15 @@
#ifndef LV_HAVE_SSE2
void qa_16s_add_quad_aligned16::t1() {
void qa_16s_add_quad_aligned16::t1()
{
printf("sse2 not available... no test performed\n");
}
#else
void qa_16s_add_quad_aligned16::t1() {
void qa_16s_add_quad_aligned16::t1()
{
volk_gnsssdr_environment_init();
clock_t start, end;
double total;
@ -55,7 +54,8 @@ void qa_16s_add_quad_aligned16::t1() {
__VOLK_ATTR_ALIGNED(16) short output21[vlen];
__VOLK_ATTR_ALIGNED(16) short output31[vlen];
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
short plus0 = ((short) (rand() - (RAND_MAX/2))) >> 2;
short minus0 = ((short) (rand() - (RAND_MAX/2))) >> 2;
short plus1 = ((short) (rand() - (RAND_MAX/2))) >> 2;
@ -77,25 +77,29 @@ void qa_16s_add_quad_aligned16::t1() {
printf("16s_add_quad_aligned\n");
start = clock();
for(int count = 0; count < ITERS; ++count) {
for(int count = 0; count < ITERS; ++count)
{
volk_gnsssdr_16s_add_quad_aligned16_manual(output0, output1, output2, output3, input0, input1, input2, input3, input4, vlen << 1 , "generic");
}
end = clock();
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("generic_time: %f\n", total);
start = clock();
for(int count = 0; count < ITERS; ++count) {
for(int count = 0; count < ITERS; ++count)
{
volk_gnsssdr_16s_add_quad_aligned16_manual(output01, output11, output21, output31, input0, input1, input2, input3, input4, vlen << 1 , "sse2");
}
end = clock();
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("sse2_time: %f\n", total);
for(int i = 0; i < 1; ++i) {
for(int i = 0; i < 1; ++i)
{
//printf("inputs: %d, %d\n", input0[i*2], input0[i*2 + 1]);
//printf("generic... %d, ssse3... %d\n", output0[i], output1[i]);
}
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
//printf("%d...%d\n", output0[i], output01[i]);
CPPUNIT_ASSERT_EQUAL(output0[i], output01[i]);
CPPUNIT_ASSERT_EQUAL(output1[i], output11[i]);

View File

@ -22,13 +22,13 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCase.h>
class qa_16s_add_quad_aligned16 : public CppUnit::TestCase {
class qa_16s_add_quad_aligned16 : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE (qa_16s_add_quad_aligned16);
CPPUNIT_TEST (t1);
CPPUNIT_TEST_SUITE_END ();
private:
private:
void t1 ();
};

View File

@ -25,13 +25,15 @@
#ifndef LV_HAVE_SSSE3
void qa_16s_branch_4_state_8_aligned16::t1() {
void qa_16s_branch_4_state_8_aligned16::t1()
{
printf("ssse3 not available... no test performed\n");
}
#else
void qa_16s_branch_4_state_8_aligned16::t1() {
void qa_16s_branch_4_state_8_aligned16::t1()
{
const int num_iters = 1000000;
const int vlen = 32;
@ -53,7 +55,7 @@ void qa_16s_branch_4_state_8_aligned16::t1() {
__VOLK_ATTR_ALIGNED(16) short src0[vlen];
__VOLK_ATTR_ALIGNED(16) short permute_indexes[vlen] = {
7, 5, 2, 0, 6, 4, 3, 1, 6, 4, 3, 1, 7, 5, 2, 0, 1, 3, 4, 6, 0, 2, 5, 7, 0, 2, 5, 7, 1, 3, 4, 6 };
7, 5, 2, 0, 6, 4, 3, 1, 6, 4, 3, 1, 7, 5, 2, 0, 1, 3, 4, 6, 0, 2, 5, 7, 0, 2, 5, 7, 1, 3, 4, 6 };
__VOLK_ATTR_ALIGNED(16) short cntl0[vlen] = {
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
__VOLK_ATTR_ALIGNED(16) short cntl1[vlen] = {
@ -64,19 +66,16 @@ void qa_16s_branch_4_state_8_aligned16::t1() {
0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff };
__VOLK_ATTR_ALIGNED(16) short scalars[4] = {1, 2, 3, 4};
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
src0[i] = i;
}
printf("16s_branch_4_state_8_aligned\n");
start = clock();
for(int i = 0; i < num_iters; ++i) {
for(int i = 0; i < num_iters; ++i)
{
volk_gnsssdr_16s_permute_and_scalar_add_aligned16_manual(target, src0, permute_indexes, cntl0, cntl1, cntl2, cntl3, scalars, num_bytes, "sse2");
}
end = clock();
@ -85,10 +84,9 @@ void qa_16s_branch_4_state_8_aligned16::t1() {
printf("permute_and_scalar_add_time: %f\n", total);
start = clock();
for(int i = 0; i < num_iters; ++i) {
for(int i = 0; i < num_iters; ++i)
{
volk_gnsssdr_16s_branch_4_state_8_aligned16_manual(target2, src0, permuters, cntl2, cntl3, scalars, "ssse3");
}
end = clock();
@ -98,7 +96,8 @@ void qa_16s_branch_4_state_8_aligned16::t1() {
printf("branch_4_state_8_time, ssse3: %f\n", total);
start = clock();
for(int i = 0; i < num_iters; ++i) {
for(int i = 0; i < num_iters; ++i)
{
volk_gnsssdr_16s_branch_4_state_8_aligned16_manual(target3, src0, permuters, cntl2, cntl3, scalars, "generic");
}
end = clock();
@ -107,13 +106,13 @@ void qa_16s_branch_4_state_8_aligned16::t1() {
printf("permute_and_scalar_add_time, generic: %f\n", total);
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
printf("psa... %d, b4s8... %d\n", target[i], target3[i]);
}
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
CPPUNIT_ASSERT(target[i] == target2[i]);
CPPUNIT_ASSERT(target[i] == target3[i]);

View File

@ -27,13 +27,15 @@
#ifndef LV_HAVE_SSE2
void qa_16s_permute_and_scalar_add_aligned16::t1() {
void qa_16s_permute_and_scalar_add_aligned16::t1()
{
printf("sse2 not available... no test performed\n");
}
#else
void qa_16s_permute_and_scalar_add_aligned16::t1() {
void qa_16s_permute_and_scalar_add_aligned16::t1()
{
const int vlen = 64;
unsigned int num_bytes = vlen << 1;
@ -52,7 +54,8 @@ void qa_16s_permute_and_scalar_add_aligned16::t1() {
__VOLK_ATTR_ALIGNED(16) short cntl3[vlen];
__VOLK_ATTR_ALIGNED(16) short scalars[4] = {1, 2, 3, 4};
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
src0[i] = i;
permute_indexes[i] = (3 * i)%vlen;
cntl0[i] = 0xff;
@ -64,7 +67,8 @@ void qa_16s_permute_and_scalar_add_aligned16::t1() {
printf("16s_permute_and_scalar_add_aligned\n");
start = clock();
for(int i = 0; i < 100000; ++i) {
for(int i = 0; i < 100000; ++i)
{
volk_gnsssdr_16s_permute_and_scalar_add_aligned16_manual(target, src0, permute_indexes, cntl0, cntl1, cntl2, cntl3, scalars, num_bytes, "generic");
}
end = clock();
@ -74,7 +78,8 @@ void qa_16s_permute_and_scalar_add_aligned16::t1() {
printf("generic_time: %f\n", total);
start = clock();
for(int i = 0; i < 100000; ++i) {
for(int i = 0; i < 100000; ++i)
{
volk_gnsssdr_16s_permute_and_scalar_add_aligned16_manual(target2, src0, permute_indexes, cntl0, cntl1, cntl2, cntl3, scalars, num_bytes, "sse2");
}
end = clock();
@ -83,13 +88,12 @@ void qa_16s_permute_and_scalar_add_aligned16::t1() {
printf("sse2_time: %f\n", total);
for(int i = 0; i < vlen; ++i) {
//for(int i = 0; i < vlen; ++i) {
//printf("generic... %d, sse2... %d\n", target[i], target2[i]);
}
for(int i = 0; i < vlen; ++i) {
//}
for(int i = 0; i < vlen; ++i)
{
CPPUNIT_ASSERT(target[i] == target2[i]);
}
}

View File

@ -26,13 +26,15 @@
#ifndef LV_HAVE_SSE2
void qa_16s_quad_max_star_aligned16::t1() {
void qa_16s_quad_max_star_aligned16::t1()
{
printf("sse2 not available... no test performed\n");
}
#else
void qa_16s_quad_max_star_aligned16::t1() {
void qa_16s_quad_max_star_aligned16::t1()
{
const int vlen = 34;
__VOLK_ATTR_ALIGNED(16) short input0[vlen];
@ -43,7 +45,8 @@ void qa_16s_quad_max_star_aligned16::t1() {
__VOLK_ATTR_ALIGNED(16) short output0[vlen];
__VOLK_ATTR_ALIGNED(16) short output1[vlen];
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
short plus0 = (short) (rand() - (RAND_MAX/2));
short plus1 = (short) (rand() - (RAND_MAX/2));
short plus2 = (short) (rand() - (RAND_MAX/2));
@ -65,12 +68,13 @@ void qa_16s_quad_max_star_aligned16::t1() {
volk_gnsssdr_16s_quad_max_star_aligned16_manual(output1, input0, input1, input2, input3, 2*vlen, "sse2");
printf("16s_quad_max_star_aligned\n");
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
printf("generic... %d, sse2... %d, inputs: %d, %d, %d, %d\n", output0[i], output1[i], input0[i], input1[i], input2[i], input3[i]);
}
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
CPPUNIT_ASSERT_EQUAL(output0[i], output1[i]);
}
}

View File

@ -27,14 +27,15 @@
#ifndef LV_HAVE_SSE
void qa_32f_fm_detect_aligned16::t1() {
void qa_32f_fm_detect_aligned16::t1()
{
printf("sse not available... no test performed\n");
}
#else
void qa_32f_fm_detect_aligned16::t1() {
void qa_32f_fm_detect_aligned16::t1()
{
volk_gnsssdr_environment_init();
clock_t start, end;
double total;
@ -45,14 +46,16 @@ void qa_32f_fm_detect_aligned16::t1() {
__VOLK_ATTR_ALIGNED(16) float output0[vlen];
__VOLK_ATTR_ALIGNED(16) float output01[vlen];
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
input0[i] = ((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2));
}
printf("32f_fm_detect_aligned\n");
start = clock();
float save = 0.1;
for(int count = 0; count < ITERS; ++count) {
for(int count = 0; count < ITERS; ++count)
{
volk_gnsssdr_32f_fm_detect_aligned16_manual(output0, input0, 1.0, &save, vlen, "generic");
}
end = clock();
@ -60,18 +63,21 @@ void qa_32f_fm_detect_aligned16::t1() {
printf("generic_time: %f\n", total);
start = clock();
save = 0.1;
for(int count = 0; count < ITERS; ++count) {
for(int count = 0; count < ITERS; ++count)
{
volk_gnsssdr_32f_fm_detect_aligned16_manual(output01, input0, 1.0, &save, vlen, "sse");
}
end = clock();
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("sse_time: %f\n", total);
for(int i = 0; i < 1; ++i) {
//for(int i = 0; i < 1; ++i)
// {
//printf("inputs: %d, %d\n", input0[i*2], input0[i*2 + 1]);
//printf("generic... %d, ssse3... %d\n", output0[i], output1[i]);
}
//}
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
//printf("%d...%d\n", output0[i], output01[i]);
CPPUNIT_ASSERT_DOUBLES_EQUAL(output0[i], output01[i], fabs(output0[i]) * 1e-4);
}

View File

@ -26,7 +26,9 @@
#define ERR_DELTA (1e-4)
#define NUM_ITERS 1000000
#define VEC_LEN 3097
static float uniform() {
static float uniform()
{
return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
}
@ -34,28 +36,27 @@ static void
random_floats (float *buf, unsigned n)
{
unsigned int i = 0;
for (; i < n; i++) {
for (; i < n; i++)
{
buf[i] = uniform () * 32767;
}
}
#ifndef LV_HAVE_SSE
void qa_32f_index_max_aligned16::t1(){
void qa_32f_index_max_aligned16::t1()
{
printf("sse not available... no test performed\n");
}
#else
void qa_32f_index_max_aligned16::t1(){
void qa_32f_index_max_aligned16::t1()
{
const int vlen = VEC_LEN;
volk_gnsssdr_runtime_init();
volk_gnsssdr_environment_init();
@ -66,7 +67,6 @@ void qa_32f_index_max_aligned16::t1(){
unsigned int* target_generic;
float* src0 ;
unsigned int i_target_sse4_1;
target_sse4_1 = &i_target_sse4_1;
unsigned int i_target_sse;
@ -83,9 +83,9 @@ void qa_32f_index_max_aligned16::t1(){
clock_t start, end;
double total;
start = clock();
for(int k = 0; k < NUM_ITERS; ++k) {
for(int k = 0; k < NUM_ITERS; ++k)
{
volk_gnsssdr_32f_index_max_aligned16_manual(target_generic, src0, vlen, "generic");
}
end = clock();
@ -93,7 +93,8 @@ void qa_32f_index_max_aligned16::t1(){
printf("generic time: %f\n", total);
start = clock();
for(int k = 0; k < NUM_ITERS; ++k) {
for(int k = 0; k < NUM_ITERS; ++k)
{
volk_gnsssdr_32f_index_max_aligned16_manual(target_sse, src0, vlen, "sse2");
}
@ -102,7 +103,8 @@ void qa_32f_index_max_aligned16::t1(){
printf("sse time: %f\n", total);
start = clock();
for(int k = 0; k < NUM_ITERS; ++k) {
for(int k = 0; k < NUM_ITERS; ++k)
{
get_volk_gnsssdr_runtime()->volk_gnsssdr_32f_index_max_aligned16(target_sse4_1, src0, vlen);
}
@ -110,7 +112,6 @@ void qa_32f_index_max_aligned16::t1(){
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("sse4.1 time: %f\n", total);
printf("generic: %u, sse: %u, sse4.1: %u\n", target_generic[0], target_sse[0], target_sse4_1[0]);
CPPUNIT_ASSERT_EQUAL(target_generic[0], target_sse[0]);
CPPUNIT_ASSERT_EQUAL(target_generic[0], target_sse4_1[0]);

View File

@ -25,7 +25,9 @@
#define ERR_DELTA (1e-4)
#define NUM_ITERS 1000000
#define VEC_LEN 3096
static float uniform() {
static float uniform()
{
return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
}
@ -33,8 +35,8 @@ static void
random_floats (float *buf, unsigned n)
{
unsigned int i = 0;
for (; i < n; i++) {
for (; i < n; i++)
{
buf[i] = uniform () * 32767;
}
@ -43,15 +45,15 @@ random_floats (float *buf, unsigned n)
#ifndef LV_HAVE_SSE3
void qa_32fc_index_max_aligned16::t1(){
void qa_32fc_index_max_aligned16::t1()
{
printf("sse3 not available... no test performed\n");
}
#else
void qa_32fc_index_max_aligned16::t1(){
void qa_32fc_index_max_aligned16::t1()
{
const int vlen = VEC_LEN;
volk_gnsssdr_environment_init();
@ -61,7 +63,6 @@ void qa_32fc_index_max_aligned16::t1(){
unsigned int* target_generic;
std::complex<float>* src0 ;
unsigned int i_target;
target = &i_target;
unsigned int i_target_generic;
@ -75,9 +76,9 @@ void qa_32fc_index_max_aligned16::t1(){
clock_t start, end;
double total;
start = clock();
for(int k = 0; k < NUM_ITERS; ++k) {
for(int k = 0; k < NUM_ITERS; ++k)
{
volk_gnsssdr_32fc_index_max_aligned16_manual(target_generic, src0, vlen << 3, "generic");
}
end = clock();
@ -85,7 +86,8 @@ void qa_32fc_index_max_aligned16::t1(){
printf("generic time: %f\n", total);
start = clock();
for(int k = 0; k < NUM_ITERS; ++k) {
for(int k = 0; k < NUM_ITERS; ++k)
{
volk_gnsssdr_32fc_index_max_aligned16_manual(target, src0, vlen << 3, "sse3");
}
@ -93,14 +95,9 @@ void qa_32fc_index_max_aligned16::t1(){
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("sse3 time: %f\n", total);
printf("generic: %u, sse3: %u\n", target_generic[0], target[0]);
CPPUNIT_ASSERT_DOUBLES_EQUAL(target_generic[0], target[0], 1.1);
free(src0);
}

View File

@ -26,14 +26,15 @@
#ifndef LV_HAVE_SSE3
void qa_32fc_power_spectral_density_32f_aligned16::t1() {
void qa_32fc_power_spectral_density_32f_aligned16::t1()
{
printf("sse3 not available... no test performed\n");
}
#else
void qa_32fc_power_spectral_density_32f_aligned16::t1() {
void qa_32fc_power_spectral_density_32f_aligned16::t1()
{
volk_gnsssdr_environment_init();
clock_t start, end;
double total;
@ -48,32 +49,36 @@ void qa_32fc_power_spectral_density_32f_aligned16::t1() {
const float rbw = 1.7;
float* inputLoad = (float*)input0;
for(int i = 0; i < 2*vlen; ++i) {
for(int i = 0; i < 2*vlen; ++i)
{
inputLoad[i] = (((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2)));
}
printf("32fc_power_spectral_density_32f_aligned\n");
start = clock();
for(int count = 0; count < ITERS; ++count) {
for(int count = 0; count < ITERS; ++count)
{
volk_gnsssdr_32fc_power_spectral_density_32f_aligned16_manual(output_generic, input0, scalar, rbw, vlen, "generic");
}
end = clock();
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("generic_time: %f\n", total);
start = clock();
for(int count = 0; count < ITERS; ++count) {
for(int count = 0; count < ITERS; ++count)
{
volk_gnsssdr_32fc_power_spectral_density_32f_aligned16_manual(output_sse3, input0, scalar, rbw, vlen, "sse3");
}
end = clock();
total = (double)(end-start)/(double)CLOCKS_PER_SEC;
printf("sse3_time: %f\n", total);
for(int i = 0; i < 1; ++i) {
//for(int i = 0; i < 1; ++i) {
//printf("inputs: %d, %d\n", input0[i*2], input0[i*2 + 1]);
//printf("generic... %d, ssse3... %d\n", output0[i], output1[i]);
}
//}
for(int i = 0; i < vlen; ++i) {
for(int i = 0; i < vlen; ++i)
{
//printf("%d...%d\n", output0[i], output01[i]);
CPPUNIT_ASSERT_DOUBLES_EQUAL(output_generic[i], output_sse3[i], fabs(output_generic[i]*1e-4));
}

View File

@ -39,7 +39,8 @@
#include <boost/type_traits.hpp>
#include <stdio.h>
float uniform() {
float uniform()
{
return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
}
@ -50,18 +51,24 @@ void random_floats (t *buf, unsigned n)
buf[i] = uniform ();
}
void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n) {
void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n)
{
if(type.is_complex) n *= 2;
if(type.is_float) {
if(type.is_float)
{
if(type.size == 8) random_floats<double>((double *)data, n);
else random_floats<float>((float *)data, n);
} else {
}
else
{
float int_max = float(uint64_t(2) << (type.size*8));
if(type.is_signed) int_max /= 2.0;
for(unsigned int i=0; i<n; i++) {
for(unsigned int i=0; i<n; i++)
{
float scaled_rand = (((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2))) * int_max;
//man i really don't know how to do this in a more clever way, you have to cast down at some point
switch(type.size) {
switch(type.size)
{
case 8:
if(type.is_signed) ((int64_t *)data)[i] = (int64_t) scaled_rand;
else ((uint64_t *)data)[i] = (uint64_t) scaled_rand;
@ -85,10 +92,12 @@ void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n) {
}
}
static std::vector<std::string> get_arch_list(volk_gnsssdr_func_desc_t desc) {
static std::vector<std::string> get_arch_list(volk_gnsssdr_func_desc_t desc)
{
std::vector<std::string> archlist;
for(size_t i = 0; i < desc.n_impls; i++) {
for(size_t i = 0; i < desc.n_impls; i++)
{
//if(!(archs[i+1] & volk_gnsssdr_get_lvarch())) continue; //this arch isn't available on this pc
archlist.push_back(std::string(desc.impl_names[i]));
}
@ -96,7 +105,8 @@ static std::vector<std::string> get_arch_list(volk_gnsssdr_func_desc_t desc) {
return archlist;
}
volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string name) {
volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string name)
{
volk_gnsssdr_type_t type;
type.is_float = false;
type.is_scalar = false;
@ -108,7 +118,8 @@ volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string name) {
if(name.size() < 2) throw std::string("name too short to be a datatype");
//is it a scalar?
if(name[0] == 's') {
if(name[0] == 's')
{
type.is_scalar = true;
name = name.substr(1, name.size()-1);
}
@ -123,8 +134,10 @@ volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string name) {
assert(((size % 8) == 0) && (size <= 64) && (size != 0));
type.size = size/8; //in bytes
for(size_t i=last_size_pos+1; i < name.size(); i++) {
switch (name[i]) {
for(size_t i=last_size_pos+1; i < name.size(); i++)
{
switch (name[i])
{
case 'f':
type.is_float = true;
break;
@ -147,7 +160,8 @@ volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string name) {
static void get_signatures_from_name(std::vector<volk_gnsssdr_type_t> &inputsig,
std::vector<volk_gnsssdr_type_t> &outputsig,
std::string name) {
std::string name)
{
boost::char_separator<char> sep("_");
boost::tokenizer<boost::char_separator<char> > tok(name, sep);
std::vector<std::string> toked;
@ -163,140 +177,173 @@ static void get_signatures_from_name(std::vector<volk_gnsssdr_type_t> &inputsig,
enum { SIDE_INPUT, SIDE_NAME, SIDE_OUTPUT } side = SIDE_INPUT;
std::string fn_name;
volk_gnsssdr_type_t type;
BOOST_FOREACH(std::string token, toked) {
try {
BOOST_FOREACH(std::string token, toked)
{
try
{
type = volk_gnsssdr_type_from_string(token);
if(side == SIDE_NAME) side = SIDE_OUTPUT; //if this is the first one after the name...
if(side == SIDE_INPUT) inputsig.push_back(type);
else outputsig.push_back(type);
} catch (...){
if(token[0] == 'x') { //it's a multiplier
}
catch (...)
{
if(token[0] == 'x')
{ //it's a multiplier
if(side == SIDE_INPUT) assert(inputsig.size() > 0);
else assert(outputsig.size() > 0);
int multiplier = boost::lexical_cast<int>(token.substr(1, token.size()-1)); //will throw if invalid
for(int i=1; i<multiplier; i++) {
for(int i=1; i<multiplier; i++)
{
if(side == SIDE_INPUT) inputsig.push_back(inputsig.back());
else outputsig.push_back(outputsig.back());
}
}
else if(side == SIDE_INPUT) { //it's the function name, at least it better be
else if(side == SIDE_INPUT)
{ //it's the function name, at least it better be
side = SIDE_NAME;
fn_name.append("_");
fn_name.append(token);
}
else if(side == SIDE_OUTPUT) {
else if(side == SIDE_OUTPUT)
{
if(token != toked.back()) throw; //the last token in the name is the alignment
}
}
}
//we don't need an output signature (some fn's operate on the input data, "in place"), but we do need at least one input!
assert(inputsig.size() != 0);
}
inline void run_cast_test1(volk_gnsssdr_fn_1arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test1(volk_gnsssdr_fn_1arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], vlen, arch.c_str());
}
inline void run_cast_test2(volk_gnsssdr_fn_2arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test2(volk_gnsssdr_fn_2arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], vlen, arch.c_str());
}
inline void run_cast_test3(volk_gnsssdr_fn_3arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test3(volk_gnsssdr_fn_3arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], vlen, arch.c_str());
}
inline void run_cast_test4(volk_gnsssdr_fn_4arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test4(volk_gnsssdr_fn_4arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], vlen, arch.c_str());
}
inline void run_cast_test1_s32f(volk_gnsssdr_fn_1arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test1_s32f(volk_gnsssdr_fn_1arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], scalar, vlen, arch.c_str());
}
inline void run_cast_test2_s32f(volk_gnsssdr_fn_2arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test2_s32f(volk_gnsssdr_fn_2arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str());
}
inline void run_cast_test3_s32f(volk_gnsssdr_fn_3arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test3_s32f(volk_gnsssdr_fn_3arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str());
}
inline void run_cast_test1_s32fc(volk_gnsssdr_fn_1arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test1_s32fc(volk_gnsssdr_fn_1arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], scalar, vlen, arch.c_str());
}
inline void run_cast_test2_s32fc(volk_gnsssdr_fn_2arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test2_s32fc(volk_gnsssdr_fn_2arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str());
}
inline void run_cast_test3_s32fc(volk_gnsssdr_fn_3arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test3_s32fc(volk_gnsssdr_fn_3arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str());
}
//ADDED BY GNSS-SDR. START
inline void run_cast_test1_s8i(volk_gnsssdr_fn_1arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test1_s8i(volk_gnsssdr_fn_1arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], scalar, vlen, arch.c_str());
}
inline void run_cast_test2_s8i(volk_gnsssdr_fn_2arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test2_s8i(volk_gnsssdr_fn_2arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str());
}
inline void run_cast_test3_s8i(volk_gnsssdr_fn_3arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test3_s8i(volk_gnsssdr_fn_3arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str());
}
inline void run_cast_test1_s8ic(volk_gnsssdr_fn_1arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test1_s8ic(volk_gnsssdr_fn_1arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], scalar, vlen, arch.c_str());
}
inline void run_cast_test2_s8ic(volk_gnsssdr_fn_2arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test2_s8ic(volk_gnsssdr_fn_2arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str());
}
inline void run_cast_test3_s8ic(volk_gnsssdr_fn_3arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test3_s8ic(volk_gnsssdr_fn_3arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str());
}
inline void run_cast_test8(volk_gnsssdr_fn_8arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test8(volk_gnsssdr_fn_8arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], vlen, arch.c_str());
}
inline void run_cast_test8_s8i(volk_gnsssdr_fn_8arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test8_s8i(volk_gnsssdr_fn_8arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], scalar, vlen, arch.c_str());
}
inline void run_cast_test8_s8ic(volk_gnsssdr_fn_8arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test8_s8ic(volk_gnsssdr_fn_8arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], scalar, vlen, arch.c_str());
}
inline void run_cast_test8_s32f(volk_gnsssdr_fn_8arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test8_s32f(volk_gnsssdr_fn_8arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], scalar, vlen, arch.c_str());
}
inline void run_cast_test8_s32fc(volk_gnsssdr_fn_8arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test8_s32fc(volk_gnsssdr_fn_8arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], scalar, vlen, arch.c_str());
}
inline void run_cast_test12(volk_gnsssdr_fn_12arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test12(volk_gnsssdr_fn_12arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], buffs[8], buffs[9], buffs[10], buffs[11], vlen, arch.c_str());
}
inline void run_cast_test12_s8i(volk_gnsssdr_fn_12arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test12_s8i(volk_gnsssdr_fn_12arg_s8i func, std::vector<void *> &buffs, char scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], buffs[8], buffs[9], buffs[10], buffs[11], scalar, vlen, arch.c_str());
}
inline void run_cast_test12_s8ic(volk_gnsssdr_fn_12arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test12_s8ic(volk_gnsssdr_fn_12arg_s8ic func, std::vector<void *> &buffs, lv_8sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], buffs[8], buffs[9], buffs[10], buffs[11], scalar, vlen, arch.c_str());
}
inline void run_cast_test12_s32f(volk_gnsssdr_fn_12arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test12_s32f(volk_gnsssdr_fn_12arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], buffs[8], buffs[9], buffs[10], buffs[11], scalar, vlen, arch.c_str());
}
inline void run_cast_test12_s32fc(volk_gnsssdr_fn_12arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
inline void run_cast_test12_s32fc(volk_gnsssdr_fn_12arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch)
{
while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], buffs[4], buffs[5], buffs[6], buffs[7], buffs[8], buffs[9], buffs[10], buffs[11], scalar, vlen, arch.c_str());
}
//ADDED BY GNSS-SDR. END
@ -315,25 +362,31 @@ void lv_force_cast_hf( int tol_i, float tol_f)
}
template <class t>
bool fcompare(t *in1, t *in2, unsigned int vlen, float tol) {
bool fcompare(t *in1, t *in2, unsigned int vlen, float tol)
{
bool fail = false;
int print_max_errs = 10;
for(unsigned int i=0; i<vlen; i++) {
for(unsigned int i=0; i<vlen; i++)
{
// for very small numbers we'll see round off errors due to limited
// precision. So a special test case...
if(fabs(((t *)(in1))[i]) < 1e-30) {
if(fabs(((t *)(in1))[i]) < 1e-30)
{
if( fabs( ((t *)(in2))[i] ) > tol )
{
fail=true;
if(print_max_errs-- > 0) {
fail = true;
if(print_max_errs-- > 0)
{
std::cout << "offset " << i << " in1: " << t(((t *)(in1))[i]) << " in2: " << t(((t *)(in2))[i]) << std::endl;
}
}
}
// the primary test is the percent different greater than given tol
else if(fabs(((t *)(in1))[i] - ((t *)(in2))[i])/(((t *)in1)[i]) > tol) {
fail=true;
if(print_max_errs-- > 0) {
else if(fabs(((t *)(in1))[i] - ((t *)(in2))[i])/(((t *)in1)[i]) > tol)
{
fail = true;
if(print_max_errs-- > 0)
{
std::cout << "offset " << i << " in1: " << t(((t *)(in1))[i]) << " in2: " << t(((t *)(in2))[i]) << std::endl;
}
}
@ -343,29 +396,34 @@ bool fcompare(t *in1, t *in2, unsigned int vlen, float tol) {
}
template <class t>
bool ccompare(t *in1, t *in2, unsigned int vlen, float tol) {
bool ccompare(t *in1, t *in2, unsigned int vlen, float tol)
{
bool fail = false;
int print_max_errs = 10;
for(unsigned int i=0; i<2*vlen; i+=2) {
for(unsigned int i=0; i<2*vlen; i+=2)
{
t diff[2] = { in1[i] - in2[i], in1[i+1] - in2[i+1] };
t err = std::sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
t norm = std::sqrt(in1[i] * in1[i] + in1[i+1] * in1[i+1]);
// for very small numbers we'll see round off errors due to limited
// precision. So a special test case...
if (norm < 1e-30) {
if (norm < 1e-30)
{
if (err > tol)
{
fail=true;
fail = true;
if(print_max_errs-- > 0) {
std::cout << "offset " << i/2 << " in1: " << in1[i] << " + " << in1[i+1] << "j in2: " << in2[i] << " + " << in2[i+1] << "j" << std::endl;
}
}
}
// the primary test is the percent different greater than given tol
else if((err / norm) > tol) {
fail=true;
if(print_max_errs-- > 0) {
else if((err / norm) > tol)
{
fail = true;
if(print_max_errs-- > 0)
{
std::cout << "offset " << i/2 << " in1: " << in1[i] << " + " << in1[i+1] << "j in2: " << in2[i] << " + " << in2[i+1] << "j" << std::endl;
}
}
@ -375,13 +433,17 @@ bool ccompare(t *in1, t *in2, unsigned int vlen, float tol) {
}
template <class t>
bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) {
bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol)
{
bool fail = false;
int print_max_errs = 10;
for(unsigned int i=0; i<vlen; i++) {
if(abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i])) > tol) {
fail=true;
if(print_max_errs-- > 0) {
for(unsigned int i=0; i<vlen; i++)
{
if(abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i])) > tol)
{
fail = true;
if(print_max_errs-- > 0)
{
std::cout << "offset " << i << " in1: " << static_cast<int>(t(((t *)(in1))[i])) << " in2: " << static_cast<int>(t(((t *)(in2))[i])) << std::endl;
}
}
@ -390,17 +452,21 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) {
return fail;
}
class volk_gnsssdr_qa_aligned_mem_pool{
class volk_gnsssdr_qa_aligned_mem_pool
{
public:
void *get_new(size_t size){
void *get_new(size_t size)
{
size_t alignment = volk_gnsssdr_get_alignment();
void* ptr = volk_gnsssdr_malloc(size, alignment);
memset(ptr, 0x00, size);
_mems.push_back(ptr);
return ptr;
}
~volk_gnsssdr_qa_aligned_mem_pool() {
for(unsigned int ii = 0; ii < _mems.size(); ++ii) {
~volk_gnsssdr_qa_aligned_mem_pool()
{
for(unsigned int ii = 0; ii < _mems.size(); ++ii)
{
volk_gnsssdr_free(_mems[ii]);
}
}
@ -418,13 +484,16 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
std::string puppet_master_name,
bool benchmark_mode,
std::string kernel_regex
) {
)
{
boost::xpressive::sregex kernel_expression = boost::xpressive::sregex::compile(kernel_regex);
if( !boost::xpressive::regex_search(name, kernel_expression) ) {
if( !boost::xpressive::regex_search(name, kernel_expression) )
{
// in this case we have a regex and are only looking to test one kernel
return false;
}
if(results) {
if(results)
{
results->push_back(volk_gnsssdr_test_results_t());
results->back().name = name;
results->back().vlen = vlen;
@ -445,7 +514,8 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
//first let's get a list of available architectures for the test
std::vector<std::string> arch_list = get_arch_list(desc);
if((!benchmark_mode) && (arch_list.size() < 2)) {
if((!benchmark_mode) && (arch_list.size() < 2))
{
std::cout << "no architectures to test" << std::endl;
return false;
}
@ -459,8 +529,10 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
//pull the input scalars into their own vector
std::vector<volk_gnsssdr_type_t> inputsc;
for(size_t i=0; i<inputsig.size(); i++) {
if(inputsig[i].is_scalar) {
for(size_t i=0; i<inputsig.size(); i++)
{
if(inputsig[i].is_scalar)
{
inputsc.push_back(inputsig[i]);
inputsig.erase(inputsig.begin() + i);
i -= 1;
@ -469,22 +541,27 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
//for(int i=0; i<inputsig.size(); i++) std::cout << "Input: " << inputsig[i].str << std::endl;
//for(int i=0; i<outputsig.size(); i++) std::cout << "Output: " << outputsig[i].str << std::endl;
std::vector<void *> inbuffs;
BOOST_FOREACH(volk_gnsssdr_type_t sig, inputsig) {
BOOST_FOREACH(volk_gnsssdr_type_t sig, inputsig)
{
if(!sig.is_scalar) //we don't make buffers for scalars
inbuffs.push_back(mem_pool.get_new(vlen*sig.size*(sig.is_complex ? 2 : 1)));
}
for(size_t i=0; i<inbuffs.size(); i++) {
for(size_t i=0; i<inbuffs.size(); i++)
{
load_random_data(inbuffs[i], inputsig[i], vlen);
}
//ok let's make a vector of vector of void buffers, which holds the input/output vectors for each arch
std::vector<std::vector<void *> > test_data;
for(size_t i=0; i<arch_list.size(); i++) {
for(size_t i=0; i<arch_list.size(); i++)
{
std::vector<void *> arch_buffs;
for(size_t j=0; j<outputsig.size(); j++) {
for(size_t j=0; j<outputsig.size(); j++)
{
arch_buffs.push_back(mem_pool.get_new(vlen*outputsig[j].size*(outputsig[j].is_complex ? 2 : 1)));
}
for(size_t j=0; j<inputsig.size(); j++) {
for(size_t j=0; j<inputsig.size(); j++)
{
arch_buffs.push_back(inbuffs[j]);
}
test_data.push_back(arch_buffs);
@ -497,25 +574,37 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
//now run the test
clock_t start, end;
std::vector<double> profile_times;
for(size_t i = 0; i < arch_list.size(); i++) {
for(size_t i = 0; i < arch_list.size(); i++)
{
start = clock();
switch(both_sigs.size()) {
switch(both_sigs.size())
{
case 1:
if(inputsc.size() == 0) {
if(inputsc.size() == 0)
{
run_cast_test1((volk_gnsssdr_fn_1arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
} else if(inputsc.size() == 1 && inputsc[0].is_float) {
if(inputsc[0].is_complex) {
}
else if(inputsc.size() == 1 && inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test1_s32fc((volk_gnsssdr_fn_1arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test1_s32f((volk_gnsssdr_fn_1arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
//ADDED BY GNSS-SDR. START
else if(inputsc.size() == 1 && !inputsc[0].is_float) {
if(inputsc[0].is_complex) {
else if(inputsc.size() == 1 && !inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test1_s8ic((volk_gnsssdr_fn_1arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test1_s8i((volk_gnsssdr_fn_1arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
@ -523,20 +612,30 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
else throw "unsupported 1 arg function >1 scalars";
break;
case 2:
if(inputsc.size() == 0) {
if(inputsc.size() == 0)
{
run_cast_test2((volk_gnsssdr_fn_2arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
} else if(inputsc.size() == 1 && inputsc[0].is_float) {
if(inputsc[0].is_complex) {
}
else if(inputsc.size() == 1 && inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test2_s32fc((volk_gnsssdr_fn_2arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test2_s32f((volk_gnsssdr_fn_2arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
//ADDED BY GNSS-SDR. START
else if(inputsc.size() == 1 && !inputsc[0].is_float) {
if(inputsc[0].is_complex) {
else if(inputsc.size() == 1 && !inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test2_s8ic((volk_gnsssdr_fn_2arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test2_s8i((volk_gnsssdr_fn_2arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
@ -544,20 +643,30 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
else throw "unsupported 2 arg function >1 scalars";
break;
case 3:
if(inputsc.size() == 0) {
if(inputsc.size() == 0)
{
run_cast_test3((volk_gnsssdr_fn_3arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
} else if(inputsc.size() == 1 && inputsc[0].is_float) {
if(inputsc[0].is_complex) {
}
else if(inputsc.size() == 1 && inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test3_s32fc((volk_gnsssdr_fn_3arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test3_s32f((volk_gnsssdr_fn_3arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
//ADDED BY GNSS-SDR. START
else if(inputsc.size() == 1 && !inputsc[0].is_float) {
if(inputsc[0].is_complex) {
else if(inputsc.size() == 1 && !inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test3_s8ic((volk_gnsssdr_fn_3arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test3_s8i((volk_gnsssdr_fn_3arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
@ -569,36 +678,54 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
break;
//ADDED BY GNSS-SDR. START
case 8:
if(inputsc.size() == 0) {
if(inputsc.size() == 0)
{
run_cast_test8((volk_gnsssdr_fn_8arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
} else if(inputsc.size() == 1 && inputsc[0].is_float) {
if(inputsc[0].is_complex) {
}
else if(inputsc.size() == 1 && inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test8_s32fc((volk_gnsssdr_fn_8arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test8_s32f((volk_gnsssdr_fn_8arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
else if(inputsc.size() == 1 && !inputsc[0].is_float) {
if(inputsc[0].is_complex) {
else if(inputsc.size() == 1 && !inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test8_s8ic((volk_gnsssdr_fn_8arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test8_s8i((volk_gnsssdr_fn_8arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
else throw "unsupported 8 arg function >1 scalars";
break;
case 12:
if(inputsc.size() == 0) {
if(inputsc.size() == 0)
{
run_cast_test12((volk_gnsssdr_fn_12arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
} else if(inputsc.size() == 1 && inputsc[0].is_float) {
if(inputsc[0].is_complex) {
}
else if(inputsc.size() == 1 && inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test12_s32fc((volk_gnsssdr_fn_12arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
}
else
{
run_cast_test12_s32f((volk_gnsssdr_fn_12arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
}
else if(inputsc.size() == 1 && !inputsc[0].is_float) {
if(inputsc[0].is_complex) {
else if(inputsc.size() == 1 && !inputsc[0].is_float)
{
if(inputsc[0].is_complex)
{
run_cast_test12_s8ic((volk_gnsssdr_fn_12arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
} else {
run_cast_test12_s8i((volk_gnsssdr_fn_12arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
@ -615,7 +742,8 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
end = clock();
double arch_time = 1000.0 * (double)(end-start)/(double)CLOCKS_PER_SEC;
std::cout << arch_list[i] << " completed in " << arch_time << "ms" << std::endl;
if(results) {
if(results)
{
volk_gnsssdr_test_time_t result;
result.name = arch_list[i];
result.time = arch_time;
@ -638,53 +766,81 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
bool fail = false;
bool fail_global = false;
std::vector<bool> arch_results;
for(size_t i=0; i<arch_list.size(); i++) {
for(size_t i=0; i<arch_list.size(); i++)
{
fail = false;
if(i != generic_offset) {
for(size_t j=0; j<both_sigs.size(); j++) {
if(both_sigs[j].is_float) {
if(both_sigs[j].size == 8) {
if (both_sigs[j].is_complex) {
if(i != generic_offset)
{
for(size_t j=0; j<both_sigs.size(); j++)
{
if(both_sigs[j].is_float)
{
if(both_sigs[j].size == 8)
{
if (both_sigs[j].is_complex)
{
fail = ccompare((double *) test_data[generic_offset][j], (double *) test_data[i][j], vlen, tol_f);
} else {
}
else
{
fail = fcompare((double *) test_data[generic_offset][j], (double *) test_data[i][j], vlen, tol_f);
}
} else {
if (both_sigs[j].is_complex) {
}
else
{
if (both_sigs[j].is_complex)
{
fail = ccompare((float *) test_data[generic_offset][j], (float *) test_data[i][j], vlen, tol_f);
} else {
}
else
{
fail = fcompare((float *) test_data[generic_offset][j], (float *) test_data[i][j], vlen, tol_f);
}
}
} else {
}
else
{
//i could replace this whole switch statement with a memcmp if i wasn't interested in printing the outputs where they differ
switch(both_sigs[j].size) {
switch(both_sigs[j].size)
{
case 8:
if(both_sigs[j].is_signed) {
if(both_sigs[j].is_signed)
{
fail = icompare((int64_t *) test_data[generic_offset][j], (int64_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
} else {
}
else
{
fail = icompare((uint64_t *) test_data[generic_offset][j], (uint64_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
}
break;
case 4:
if(both_sigs[j].is_signed) {
if(both_sigs[j].is_signed)
{
fail = icompare((int32_t *) test_data[generic_offset][j], (int32_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
} else {
}
else
{
fail = icompare((uint32_t *) test_data[generic_offset][j], (uint32_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
}
break;
case 2:
if(both_sigs[j].is_signed) {
if(both_sigs[j].is_signed)
{
fail = icompare((int16_t *) test_data[generic_offset][j], (int16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
} else {
}
else
{
fail = icompare((uint16_t *) test_data[generic_offset][j], (uint16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
}
break;
case 1:
if(both_sigs[j].is_signed) {
if(both_sigs[j].is_signed)
{
fail = icompare((int8_t *) test_data[generic_offset][j], (int8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
} else {
}
else
{
fail = icompare((uint8_t *) test_data[generic_offset][j], (uint8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
}
break;
@ -692,7 +848,8 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
fail=1;
}
}
if(fail) {
if(fail)
{
fail_global = true;
std::cout << name << ": fail on arch " << arch_list[i] << std::endl;
}
@ -722,10 +879,14 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
std::cout << "Best aligned arch: " << best_arch_a << std::endl;
std::cout << "Best unaligned arch: " << best_arch_u << std::endl;
if(results) {
if(puppet_master_name == "NULL") {
if(results)
{
if(puppet_master_name == "NULL")
{
results->back().config_name = name;
} else {
}
else
{
results->back().config_name = puppet_master_name;
}
results->back().best_arch_a = best_arch_a;

View File

@ -16,8 +16,8 @@
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VOLK_QA_UTILS_H
#define VOLK_QA_UTILS_H
#ifndef GNSS_SDR_VOLK_QA_UTILS_H
#define GNSS_SDR_VOLK_QA_UTILS_H
#include <cstdlib>
#include <string>
@ -42,15 +42,17 @@ volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string);
float uniform(void);
void random_floats(float *buf, unsigned n);
class volk_gnsssdr_test_time_t {
public:
class volk_gnsssdr_test_time_t
{
public:
std::string name;
double time;
std::string units;
};
class volk_gnsssdr_test_results_t {
public:
class volk_gnsssdr_test_results_t
{
public:
std::string name;
std::string config_name;
int vlen;
@ -117,4 +119,4 @@ typedef void (*volk_gnsssdr_fn_12arg_s8ic)(void *, void *, void *, void *, void
//ADDED BY GNSS-SDR. END
#endif //VOLK_QA_UTILS_H
#endif // GNSS_SDR_VOLK_QA_UTILS_H

View File

@ -1,5 +1,5 @@
/* -*- c++ -*- */
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*

View File

@ -1,5 +1,5 @@
/* -*- c -*- */
/* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
/*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* This file is part of GNSS-SDR.
*
@ -26,7 +26,7 @@
/*
* For #defines used to determine support for allocation functions,
* see: http://linux.die.net/man/3/aligned_alloc
*/
*/
// Disabling use of aligned_alloc. This function requires that size be
// a multiple of alignment, which is too restrictive for many uses of
@ -59,10 +59,12 @@ void *volk_gnsssdr_malloc(size_t size, size_t alignment)
{
void *ptr;
int err = posix_memalign(&ptr, alignment, size);
if(err == 0) {
if(err == 0)
{
return ptr;
}
else {
else
{
fprintf(stderr, "VOLK: Error allocating memory (posix_memalign: %d)\n", err);
return NULL;
}
@ -80,7 +82,8 @@ void volk_gnsssdr_free(void *ptr)
void *volk_gnsssdr_malloc(size_t size, size_t alignment)
{
void *ptr = _aligned_malloc(size, alignment);
if(ptr == NULL) {
if(ptr == NULL)
{
fprintf(stderr, "VOLK: Error allocating memory (_aligned_malloc)\n");
}
return ptr;

View File

@ -31,7 +31,8 @@ void volk_gnsssdr_get_config_path(char *path)
char *home = NULL;
if (home == NULL) home = getenv("HOME");
if (home == NULL) home = getenv("APPDATA");
if (home == NULL){
if (home == NULL)
{
path = NULL;
return;
}

View File

@ -24,10 +24,10 @@
#include <string.h>
#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4
#define __popcnt __builtin_popcount
#define __popcnt __builtin_popcount
#else
inline unsigned __popcnt(unsigned num)
{
inline unsigned __popcnt(unsigned num)
{
unsigned pop = 0;
while(num)
{
@ -35,17 +35,20 @@
num >>= 1;
}
return pop;
}
}
#endif
int volk_gnsssdr_get_index(
const char *impl_names[], //list of implementations by name
const size_t n_impls, //number of implementations available
const char *impl_name //the implementation name to find
){
)
{
unsigned int i;
for (i = 0; i < n_impls; i++) {
if(!strncmp(impl_names[i], impl_name, 20)) {
for (i = 0; i < n_impls; i++)
{
if(!strncmp(impl_names[i], impl_name, 20))
{
return i;
}
}
@ -55,6 +58,7 @@ int volk_gnsssdr_get_index(
return volk_gnsssdr_get_index(impl_names, n_impls, "generic"); //but we'll fake it for now
}
int volk_gnsssdr_rank_archs(
const char *kern_name, //name of the kernel to rank
const char *impl_names[], //list of implementations by name
@ -62,12 +66,14 @@ int volk_gnsssdr_rank_archs(
const bool* alignment, //alignment status of each implementation
size_t n_impls, //number of implementations available
const bool align //if false, filter aligned implementations
){
)
{
size_t i;
static volk_gnsssdr_arch_pref_t *volk_gnsssdr_arch_prefs;
static size_t n_arch_prefs = 0;
static int prefs_loaded = 0;
if(!prefs_loaded) {
if(!prefs_loaded)
{
n_arch_prefs = volk_gnsssdr_load_preferences(&volk_gnsssdr_arch_prefs);
prefs_loaded = 1;
}
@ -75,7 +81,8 @@ int volk_gnsssdr_rank_archs(
// If we've defined VOLK_GENERIC to be anything, always return the
// 'generic' kernel. Used in GR's QA code.
char *gen_env = getenv("VOLK_GENERIC");
if(gen_env) {
if(gen_env)
{
return volk_gnsssdr_get_index(impl_names, n_impls, "generic");
}

View File

@ -16,8 +16,8 @@
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_VOLK_RANK_ARCHS_H
#define INCLUDED_VOLK_RANK_ARCHS_H
#ifndef GNSS_SDR_VOLK_GNSSSDR_RANK_ARCHS_H
#define GNSS_SDR_VOLK_GNSSSDR_RANK_ARCHS_H
#include <stdlib.h>
#include <stdbool.h>
@ -44,4 +44,4 @@ int volk_gnsssdr_rank_archs(
#ifdef __cplusplus
}
#endif
#endif /*INCLUDED_VOLK_RANK_ARCHS_H*/
#endif /* GNSS_SDR_VOLK_GNSSSDR_RANK_ARCHS_H */

View File

@ -1,36 +1,34 @@
#/*!
# * \file volk_gnsssdr_8i_accumulator_s8i.orc
# * \brief ORC implementation: 8 bits (char) scalar accumulator
# * \authors <ul>
# * <li> Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that implements an accumulator of char values
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: 8 bits (char) scalar accumulator
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
# ORC code that implements an accumulator of char values
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8i_accumulator_s8i_a_orc_impl
.source 1 src1

View File

@ -1,36 +1,33 @@
#/*!
# * \file volk_gnsssdr_8i_x2_add_8i.orc
# * \brief ORC implementation: adds pairs of 8 bits (char) scalars
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that adds pairs of 8 bits (char) scalars
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: adds pairs of 8 bits (char) scalars
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8i_x2_add_8i_a_orc_impl
.dest 1 dst

View File

@ -1,38 +1,37 @@
#/*!
# * \file volk_gnsssdr_8ic_conjugate_8ic.orc
# * \brief ORC implementation: calculates the conjugate of a 16 bits vector
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that calculates the conjugate of a
# * 16 bits vector (8 bits the real part and 8 bits the imaginary part)
# * result = (real*real) + (imag*imag)
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: calculates the conjugate of a 16 bits vector
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
# ORC code that calculates the conjugate of a
# 16 bits vector (8 bits the real part and 8 bits the imaginary part)
# result = (real*real) + (imag*imag)
#
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8ic_conjugate_8ic_a_orc_impl
.source 2 src1

View File

@ -1,38 +1,37 @@
#/*!
# * \file volk_gnsssdr_8ic_magnitude_squared_8i.orc
# * \brief ORC implementation: calculates the magnitude squared of a 16 bits vector
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that calculates the magnitude squared of a
# * 16 bits vector (8 bits the real part and 8 bits the imaginary part)
# * result = (real*real) + (imag*imag)
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: calculates the magnitude squared of a 16 bits vector
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# ORC code that calculates the magnitude squared of a
# 16 bits vector (8 bits the real part and 8 bits the imaginary part)
# result = (real*real) + (imag*imag)
#
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8ic_magnitude_squared_8i_a_orc_impl
.source 2 src1

View File

@ -1,37 +1,36 @@
#/*!
# * \file volk_gnsssdr_8ic_s8ic_multiply_8ic.orc
# * \brief ORC implementation: multiplies a group of 16 bits vectors by one constant vector
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that multiplies a group of 16 bits vectors
# * (8 bits the real part and 8 bits the imaginary part) by one constant vector
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: multiplies a group of 16 bits vectors by one constant vector
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# ORC code that multiplies a group of 16 bits vectors
# (8 bits the real part and 8 bits the imaginary part) by one constant vector
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8ic_s8ic_multiply_8ic_a_orc_impl
.source 2 src1

View File

@ -1,37 +1,37 @@
#/*!
# * \file volk_gnsssdr_8ic_x2_dot_prod_8ic.orc
# * \brief ORC implementation: multiplies two 16 bits vectors and accumulates them
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that multiplies two 16 bits vectors (8 bits the real part
# * and 8 bits the imaginary part) and accumulates them
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: multiplies two 16 bits vectors and accumulates them
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# ORC code that multiplies two 16 bits vectors (8 bits the real part
# and 8 bits the imaginary part) and accumulates them
#
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8ic_x2_dot_prod_8ic_a_orc_impl
.source 2 src1

View File

@ -1,37 +1,37 @@
#/*!
# * \file volk_gnsssdr_8ic_x2_multiply_8ic.orc
# * \brief ORC implementation: multiplies two 16 bits vectors
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that multiplies two 16 bits vectors (8 bits the real part
# * and 8 bits the imaginary part)
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: multiplies two 16 bits vectors
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# ORC code that multiplies two 16 bits vectors (8 bits the real part
# and 8 bits the imaginary part)
#
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8ic_x2_multiply_8ic_a_orc_impl
.source 2 src1

View File

@ -1,47 +1,46 @@
#/*!
# * \file volk_gnsssdr_8ic_x5_cw_epl_corr_8ic_x3.orc
# * \brief ORC implementation: performs the carrier wipe-off mixing and the Early, Prompt, and Late correlation with 16 bits vectors
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that performs the carrier wipe-off mixing and the
# * Early, Prompt, and Late correlation with 16 bits vectors (8 bits the
# * real part and 8 bits the imaginary part):
# * - The carrier wipe-off is done by multiplying the input signal by the
# * carrier (multiplication of 16 bits vectors) It returns the input
# * signal in base band (BB)
# * - Early values are calculated by multiplying the input signal in BB by the
# * early code (multiplication of 16 bits vectors), accumulating the results
# * - Prompt values are calculated by multiplying the input signal in BB by the
# * prompt code (multiplication of 16 bits vectors), accumulating the results
# * - Late values are calculated by multiplying the input signal in BB by the
# * late code (multiplication of 16 bits vectors), accumulating the results
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: performs the carrier wipe-off mixing and the Early, Prompt, and Late correlation with 16 bits vectors
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# ORC code that performs the carrier wipe-off mixing and the
# Early, Prompt, and Late correlation with 16 bits vectors (8 bits the
# real part and 8 bits the imaginary part):
# - The carrier wipe-off is done by multiplying the input signal by the
# carrier (multiplication of 16 bits vectors) It returns the input
# signal in base band (BB)
# - Early values are calculated by multiplying the input signal in BB by the
# early code (multiplication of 16 bits vectors), accumulating the results
# - Prompt values are calculated by multiplying the input signal in BB by the
# prompt code (multiplication of 16 bits vectors), accumulating the results
# - Late values are calculated by multiplying the input signal in BB by the
# late code (multiplication of 16 bits vectors), accumulating the results
#
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8ic_x5_cw_epl_corr_8ic_x3_first_a_orc_impl
.source 2 input

View File

@ -1,36 +1,35 @@
#/*!
# * \file volk_gnsssdr_8u_x2_multiply_8u.orc
# * \brief ORC implementation: multiplies unsigned char values
# * \authors <ul>
# * <li> Andrés Cecilia, 2014. a.cecilia.luque(at)gmail.com
# * </ul>
# *
# * ORC code that multiplies unsigned char values (8 bits data)
# *
# * -------------------------------------------------------------------------
# *
# * Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
# *
# * GNSS-SDR is a software defined Global Navigation
# * Satellite Systems receiver
# *
# * This file is part of GNSS-SDR.
# *
# * GNSS-SDR is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * at your option) any later version.
# *
# * GNSS-SDR is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
# *
# * -------------------------------------------------------------------------
# */
#
# ORC implementation: multiplies unsigned char values
#
# Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
#
#
# ORC code that multiplies unsigned char values (8 bits data)
#
# -------------------------------------------------------------------------
#
# Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software defined Global Navigation
# Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------
#
.function volk_gnsssdr_8u_x2_multiply_8u_a_orc_impl
.source 1 src1

View File

@ -1,71 +0,0 @@
########################################################################
# Patching original volk module
########################################################################
In order to fit the GNSS-SDR needs, the original volk module must be patched.
The folder containing this file has some patches to automatize the process and
modify the files quickly. To apply them you will need to run the following command:
$ patch -p5 < /Path/Of/The/Patch/nameOfThePatch.patch
The number after “-p” may change, read the patch documentation for more help.
You may need this information if you want to recreate the volk_gnsssdr module again
or you want to update the volk_gnsssdr module with the improvements introduced by GNURadio.
########################################################################
########################################################################
# Operations apply by the patches and other information (not needed if you know how to apply the patches!!!)
########################################################################
########################################################################
To create the volk module you will need to follow the following steps:
In order to understand and follow the creation and setup of the volk_gnsssdr module I will use some absolute paths: /Users/andres/Github/gnuradio => a cloned repository of the GNURadio project. /Users/andres/Github/gnss-sdr => a cloned repository of the GNSS- SDR project.
########################################################################
#FIRST STEP: using volk_modtool to create a new volk module
########################################################################
GNURadio offers a tool called volk_modtool to create and manage new volk modules and their proto-kernels. The steps to create the volk_gnsssdr module are:
1) Export the PYTHONPATH, that indicates where volk_modtool is:
$ export PYTHONPATH=/Users/andres/Github/gnuradio/volk/python
2) Go to the folder where volk_modtool executable is: $ cd /Users/andres/Github/gnuradio/volk/python/volk_modtool
3) Execute volk_modtool indicating that we want to create a new volk module (-i): $ ./volk_modtool -i
4) volk_modtool will ask us about the name of the newly created module, the destination folder where you want to store it and the base module (the base module is the volk module inside the GNURadio project): name: gnsssdr destination: /Users/andres/Github/gnss-sdr/src/algorithms/libs base: /Users/andres/github/gnuradio/volk
########################################################################
#SECOND STEP: add proto-kernels to the module
########################################################################
After creating the module you will need to add some proto-kernels to it. To accomplish it you will need to: 1) Copy your proto-kernels inside the /kernels folder. Copy the ORC implementations inside the /orc folder. Copy the macros implementations inside the /kernels/CommonMacros folder. (those folders are found in the root of the volk_gnsssdr module)
2) Add one profiling line for each of the proto-kernels inside the /apps/volk_gnsssdr_profile.cc file.
3) Add one test line for each of the proto-kernels inside the /lib/testqa.cc file. ########################################################################
#THIRD STEP: modifications to allow profiling of some proto-kernels with special parameters
######################################################################## Some of the proto-kernels that GNSS-SDR needs are not supported by the profiling environment of the volk_gnsssdr module. In order to profile them some modifications need to be done to two files: 1) Modify /src/algorithms/libs/volk_gnsssdr/lib/qa_utils.cc At the first part of this file there are defined the parameters supported by the environment. The number after run_cast_test indicates the total number of parameters passed to the proto-kernel (input +output parameters). The other part indicates the type of the data passed. Inside func(....) you will need to add the same number of buffs[ ] that the one specified after run_cast_test.
2) Modify /src/algorithms/libs/volk_gnsssdr/lib/qa_utils.h In the header you will need to add typedefs for the new definitions made in the .cc file. Take care: you will need to add the same number of void * that the one specified after run_cast_test.
########################################################################
#FOURTH STEP: optional modifications
########################################################################
1) Modify /src/algorithms/libs/volk_gnsssdr/lib/CMakeLists.txt in order to see kernel files, ORC files and macros when generating the IDE project.
2) To be able to use volk_gnsssdr and default volk functions at the same time i n the same file you will need to modify the template files that volk_gnsssdr module uses at build time to generate some headers.
The files modified are found inside /tmpl: volk_gnsssdr.tmpl.h
volk_gnsssdr_typedefs.tmpl.h
volk_gnsssdr_machines.tmpl.h
volk_gnsssdr_cpu.tmpl.h
volk_gnsssdr_config_fixed.tmpl.h The modifications consist of changing the defines of those files to different ones to allow the definition of the volk_gnsssdr functions although the default volk functions are already defined.
########################################################################
#FIFTH STEP: add volk_gnsssdr module to the GNSS-SDR project
########################################################################
In order to add the volk_gnsssdr module to the GNSS-SDR project the CMakeLists.txt global file needs to be edited.
########################################################################
#SIXTH STEP: using volk_gnsssdr functions
########################################################################
To use the proto-kernels inside volk_gnsssdr project two steps are needed: 1) in the CMakeFiles.txt you will need to add $ {VOLK_GNSSSDR_INCLUDE_DIRS} inside the include_directories function, and also add $ {VOLK_GNSSSDR_LIBRARIES} inside the target_link_libraries function.
2) Add the line #include “volk_gnsssdr.h” at the top of the file.