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

Added patches to modify volk_gnsssdr

1)Added patches to modify volk_gnsssdr from the original volk
protokernel

2)Updated volk module with the lasts updates from GNURadio
This commit is contained in:
andres 2014-10-17 05:10:30 +02:00
parent 0f7c23bd7e
commit b139f531e5
12 changed files with 57659 additions and 51 deletions

View File

@ -37,25 +37,73 @@
namespace fs = boost::filesystem;
void write_json(std::ofstream &json_file, std::vector<volk_gnsssdr_test_results_t> results) {
json_file << "{" << std::endl;
json_file << " \"volk_tests\": [" << std::endl;
size_t len = results.size();
size_t i = 0;
BOOST_FOREACH(volk_gnsssdr_test_results_t &result, results) {
json_file << " {" << std::endl;
json_file << " \"name\": \"" << result.name << "\"," << std::endl;
json_file << " \"vlen\": " << result.vlen << "," << std::endl;
json_file << " \"iter\": " << result.iter << "," << std::endl;
json_file << " \"best_arch_a\": \"" << result.best_arch_a
<< "\"," << std::endl;
json_file << " \"best_arch_u\": \"" << result.best_arch_u
<< "\"," << std::endl;
json_file << " \"results\": {" << std::endl;
size_t results_len = result.results.size();
size_t ri = 0;
typedef std::pair<std::string, volk_gnsssdr_test_time_t> tpair;
BOOST_FOREACH(tpair pair, result.results) {
volk_gnsssdr_test_time_t time = pair.second;
json_file << " \"" << time.name << "\": {" << std::endl;
json_file << " \"name\": \"" << time.name << "\"," << std::endl;
json_file << " \"time\": " << time.time << "," << std::endl;
json_file << " \"units\": \"" << time.units << "\"" << std::endl;
json_file << " }" ;
if(ri+1 != results_len) {
json_file << ",";
}
json_file << std::endl;
ri++;
}
json_file << " }" << std::endl;
json_file << " }";
if(i+1 != len) {
json_file << ",";
}
json_file << std::endl;
i++;
}
json_file << " ]" << std::endl;
json_file << "}" << std::endl;
}
int main(int argc, char *argv[]) {
// Adding program options
boost::program_options::options_description desc("Options");
desc.add_options()
("help,h", "Print help messages")
("benchmark,b",
boost::program_options::value<bool>()->default_value( false )
->implicit_value( true ),
"Run all kernels (benchmark mode)")
("tests-regex,R",
boost::program_options::value<std::string>(),
"Run tests matching regular expression.")
;
("help,h", "Print help messages")
("benchmark,b",
boost::program_options::value<bool>()->default_value( false )
->implicit_value( true ),
"Run all kernels (benchmark mode)")
("tests-regex,R",
boost::program_options::value<std::string>(),
"Run tests matching regular expression.")
("json,j",
boost::program_options::value<std::string>(),
"JSON output file")
;
// Handle the options that were given
boost::program_options::variables_map vm;
bool benchmark_mode;
std::string kernel_regex;
bool store_results = true;
std::ofstream json_file;
try {
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
boost::program_options::notify(vm);
@ -75,17 +123,22 @@ int main(int argc, char *argv[]) {
return 1;
}
/** --help option
*/
*/
if ( vm.count("help") )
{
std::cout << "The VOLK profiler." << std::endl
<< desc << std::endl;
return 0;
std::cout << "The VOLK profiler." << std::endl
<< desc << std::endl;
return 0;
}
if ( vm.count("json") )
{
json_file.open( vm["json"].as<std::string>().c_str() );
}
// Run tests
std::vector<std::string> results;
std::vector<volk_gnsssdr_test_results_t> results;
//VOLK_PROFILE(volk_gnsssdr_16i_x5_add_quad_16i_x4, 1e-4, 2046, 10000, &results, benchmark_mode, kernel_regex);
//VOLK_PROFILE(volk_gnsssdr_16i_branch_4_state_8, 1e-4, 2046, 10000, &results, benchmark_mode, kernel_regex);
@ -99,9 +152,6 @@ int main(int argc, char *argv[]) {
//VOLK_PROFILE(volk_gnsssdr_32u_popcnt, 0, 0, 2046, 10000, &results, benchmark_mode, kernel_regex);
//VOLK_PROFILE(volk_gnsssdr_64u_popcnt, 0, 0, 2046, 10000, &results, benchmark_mode, kernel_regex);
//VOLK_PROFILE(volk_gnsssdr_32fc_s32fc_multiply_32fc, 1e-4, lv_32fc_t(1.0, 0.5), 204602, 1000, &results, benchmark_mode, kernel_regex);
// Until we can update the config on a kernel by kernel basis
// do not overwrite volk_gnsssdr_config when using a regex.
//GNSS-SDR PROTO-KERNELS
//lv_32fc_t sfv = lv_cmake((float)1, (float)2);
@ -151,31 +201,35 @@ int main(int argc, char *argv[]) {
VOLK_PROFILE(volk_gnsssdr_32f_s32f_convert_16i, 1e-4, 1, 204602, 250, &results, benchmark_mode, kernel_regex);
VOLK_PROFILE(volk_gnsssdr_16i_s32f_convert_32f, 1e-4, 1, 204602, 250, &results, benchmark_mode, kernel_regex);*/
// Until we can update the config on a kernel by kernel basis
// do not overwrite volk_config when using a regex.
if(store_results) {
char path[1024];
volk_gnsssdr_get_config_path(path);
const fs::path config_path(path);
if (not fs::exists(config_path.branch_path()))
{
std::cout << "Creating " << config_path.branch_path() << "..." << std::endl;
fs::create_directories(config_path.branch_path());
}
std::cout << "Writing " << config_path << "..." << std::endl;
std::ofstream config(config_path.string().c_str());
if(!config.is_open()) { //either we don't have write access or we don't have the dir yet
std::cout << "Error opening file " << config_path << std::endl;
}
config << "\
#this file is generated by volk_gnsssdr_profile.\n\
#the function name is followed by the preferred architecture.\n\
";
BOOST_FOREACH(std::string result, results) {
config << result << std::endl;
#this file is generated by volk_profile.\n\
#the function name is followed by the preferred architecture.\n\
";
BOOST_FOREACH(volk_gnsssdr_test_results_t result, results) {
config << result.config_name << " "
<< result.best_arch_a << " "
<< result.best_arch_u << std::endl;
}
config.close();
}

View File

@ -406,10 +406,8 @@ if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
# if we find one that matches our current system architecture
# set up the assembler flags and include the source files
foreach(ARCH ${ASM_ARCHS_AVAILABLE})
message(STATUS "--==>> -CFLAGS1: ${FULL_C_FLAGS}")
string(REGEX MATCH "${ARCH}" ASM_ARCH "${FULL_C_FLAGS}")
if( ASM_ARCH STREQUAL "armv7" )
set(ASM-ATT $ENV{ASM})
message(STATUS "---- Adding ASM files") # we always use ATT syntax
message(STATUS "-- Detected armv7 architecture; enabling ASM")
# setup architecture specific assembler flags
@ -422,13 +420,20 @@ if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
message(STATUS "Adding source file: ${asm_file}")
endforeach(asm_file)
endif()
set(CMAKE_ASM-ATT_FLAGS_INIT ${ARCH_ASM_FLAGS})
enable_language(ASM-ATT) # this must be after flags_init
message(STATUS "asm flags: ${CMAKE_ASM-ATT_FLAGS}")
enable_language(ASM)
set(CMAKE_ASM_FLAGS ${ARCH_ASM_FLAGS})
message(STATUS "c flags: ${FULL_C_FLAGS}")
message(STATUS "asm flags: ${CMAKE_ASM_FLAGS}")
endforeach(ARCH)
else(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
message(STATUS "Not enabling ASM support. CMake >= 2.8.10 required.")
foreach(machine_name ${available_machines})
string(REGEX MATCH "neon" NEON_MACHINE ${machine_name})
if( NEON_MACHINE STREQUAL "neon")
message(FATAL_ERROR "CMake >= 2.8.10 is required for ARM NEON support")
endif()
endforeach()
endif(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
########################################################################
@ -529,7 +534,6 @@ target_link_libraries(volk_gnsssdr ${volk_gnsssdr_libraries})
set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${LIBVER})
set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS")
install(TARGETS volk_gnsssdr
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file

View File

@ -5,7 +5,9 @@
#include <boost/tokenizer.hpp>
#include <boost/xpressive/xpressive.hpp>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <list>
#include <ctime>
#include <cmath>
@ -394,9 +396,9 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
lv_32fc_t scalar,
int vlen,
int iter,
std::vector<std::string> *best_arch_vector = 0,
std::string puppet_master_name = "NULL",
bool benchmark_mode,
std::vector<volk_gnsssdr_test_results_t> *results,
std::string puppet_master_name,
bool benchmark_mode,
std::string kernel_regex
) {
boost::xpressive::sregex kernel_expression = boost::xpressive::sregex::compile(kernel_regex);
@ -404,6 +406,12 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
// in this case we have a regex and are only looking to test one kernel
return false;
}
if(results) {
results->push_back(volk_gnsssdr_test_results_t());
results->back().name = name;
results->back().vlen = vlen;
results->back().iter = iter;
}
std::cout << "RUN_VOLK_TESTS: " << name << "(" << vlen << "," << iter << ")" << std::endl;
// The multiply and lv_force_cast_hf are work arounds for GNU Radio bugs 582 and 583
@ -589,6 +597,13 @@ 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) {
volk_gnsssdr_test_time_t result;
result.name = arch_list[i];
result.time = arch_time;
result.units = "ms";
results->back().results[result.name] = result;
}
profile_times.push_back(arch_time);
}
@ -689,13 +704,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(best_arch_vector) {
if(results) {
if(puppet_master_name == "NULL") {
best_arch_vector->push_back(name + " " + best_arch_a + " " + best_arch_u);
}
else {
best_arch_vector->push_back(puppet_master_name + " " + best_arch_a + " " + best_arch_u);
results->back().config_name = name;
} else {
results->back().config_name = puppet_master_name;
}
results->back().best_arch_a = best_arch_a;
results->back().best_arch_u = best_arch_u;
}
return fail_global;

View File

@ -3,7 +3,10 @@
#include <cstdlib>
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <volk_gnsssdr/volk_gnsssdr_common.h>
@ -21,10 +24,46 @@ volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string);
float uniform(void);
void random_floats(float *buf, unsigned n);
bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t, void(*)(), std::string, float, lv_32fc_t, int, int, std::vector<std::string> *, std::string, bool benchmark_mode=false, std::string kernel_regex="");
class volk_gnsssdr_test_time_t {
public:
std::string name;
double time;
std::string units;
};
class volk_gnsssdr_test_results_t {
public:
std::string name;
std::string config_name;
int vlen;
int iter;
std::map<std::string, volk_gnsssdr_test_time_t> results;
std::string best_arch_a;
std::string best_arch_u;
};
bool run_volk_gnsssdr_tests(
volk_gnsssdr_func_desc_t,
void(*)(),
std::string,
float,
lv_32fc_t,
int,
int,
std::vector<volk_gnsssdr_test_results_t> *results = NULL,
std::string puppet_master_name = "NULL",
bool benchmark_mode=false,
std::string kernel_regex=""
);
#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) BOOST_AUTO_TEST_CASE(func##_test) { BOOST_CHECK_EQUAL(run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, 0, "NULL"), 0); }
#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) \
BOOST_AUTO_TEST_CASE(func##_test) { \
BOOST_CHECK_EQUAL(run_volk_gnsssdr_tests( \
func##_get_func_desc(), (void (*)())func##_manual, \
std::string(#func), tol, scalar, len, iter, 0, "NULL"), \
0); \
}
#define VOLK_PROFILE(func, tol, scalar, len, iter, results, bnmode, kernel_regex) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results, "NULL", bnmode, kernel_regex)
#define VOLK_PUPPET_PROFILE(func, puppet_master_func, tol, scalar, len, iter, results, bnmode, kernel_regex) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results, std::string(#puppet_master_func), bnmode, kernel_regex)
typedef void (*volk_gnsssdr_fn_1arg)(void *, unsigned int, const char*); //one input, operate in place
@ -59,4 +98,5 @@ typedef void (*volk_gnsssdr_fn_12arg_s8i)(void *, void *, void *, void *, void *
typedef void (*volk_gnsssdr_fn_12arg_s8ic)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, lv_8sc_t, unsigned int, const char*);
//ADDED BY GNSS-SDR. END
#endif //VOLK_QA_UTILS_H

View File

@ -0,0 +1,329 @@
diff -rupN /Users/andres/Desktop/volk_gnsssdr/lib/CMakeLists.txt /Users/andres/Desktop/volk_gnsssdr_original/lib/CMakeLists.txt
--- /Users/andres/Desktop/volk_gnsssdr/lib/CMakeLists.txt 2014-10-17 04:26:38.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/lib/CMakeLists.txt 2014-10-17 04:17:37.000000000 +0200
@@ -517,7 +517,19 @@ if(MSVC)
endif()
#create the volk_gnsssdr runtime library
-add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources})
+
+#MODIFICATIONS BY GNSS-SDR
+file(GLOB orc ${CMAKE_SOURCE_DIR}/orc/*.orc)
+file(GLOB CommonMacros ${CMAKE_SOURCE_DIR}/kernels/CommonMacros/*.h ${CMAKE_SOURCE_DIR}/kernels/CommonMacros/README.txt)
+
+#add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources})
+add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources} ${h_files} ${CommonMacros} ${orc})
+
+source_group("Kernels" FILES ${h_files})
+source_group("Common Macros" FILES ${CommonMacros})
+source_group("ORC Files" FILES ${orc})
+#END OF MODIFICATIONS
+
target_link_libraries(volk_gnsssdr ${volk_gnsssdr_libraries})
set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${LIBVER})
set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS")
diff -rupN /Users/andres/Desktop/volk_gnsssdr/lib/qa_utils.cc /Users/andres/Desktop/volk_gnsssdr_original/lib/qa_utils.cc
--- /Users/andres/Desktop/volk_gnsssdr/lib/qa_utils.cc 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/lib/qa_utils.cc 2014-10-17 04:21:03.000000000 +0200
@@ -217,6 +217,72 @@ inline void run_cast_test3_s32fc(volk_gn
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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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) {
+ 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
+
// This function is a nop that helps resolve GNU Radio bugs 582 and 583.
// Without this the cast in run_volk_gnsssdr_tests for tol_i = static_cast<int>(float tol)
// won't happen on armhf (reported on cortex A9 and A15).
@@ -426,7 +492,17 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr
} else {
run_cast_test1_s32f((volk_gnsssdr_fn_1arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
- } else throw "unsupported 1 arg function >1 scalars";
+ }
+ //ADDED BY GNSS-SDR. START
+ 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 {
+ run_cast_test1_s8i((volk_gnsssdr_fn_1arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
+ }
+ }
+ //ADDED BY GNSS-SDR. END
+ else throw "unsupported 1 arg function >1 scalars";
break;
case 2:
if(inputsc.size() == 0) {
@@ -437,7 +513,17 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr
} else {
run_cast_test2_s32f((volk_gnsssdr_fn_2arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
- } else throw "unsupported 2 arg function >1 scalars";
+ }
+ //ADDED BY GNSS-SDR. START
+ 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 {
+ run_cast_test2_s8i((volk_gnsssdr_fn_2arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
+ }
+ }
+ //ADDED BY GNSS-SDR. END
+ else throw "unsupported 2 arg function >1 scalars";
break;
case 3:
if(inputsc.size() == 0) {
@@ -448,11 +534,61 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr
} else {
run_cast_test3_s32f((volk_gnsssdr_fn_3arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
}
- } else throw "unsupported 3 arg function >1 scalars";
+ }
+ //ADDED BY GNSS-SDR. START
+ 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 {
+ run_cast_test3_s8i((volk_gnsssdr_fn_3arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
+ }
+ }
+ //ADDED BY GNSS-SDR. END
+ else throw "unsupported 3 arg function >1 scalars";
break;
case 4:
run_cast_test4((volk_gnsssdr_fn_4arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
break;
+ //ADDED BY GNSS-SDR. START
+ case 8:
+ 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) {
+ run_cast_test8_s32fc((volk_gnsssdr_fn_8arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
+ } 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) {
+ run_cast_test8_s8ic((volk_gnsssdr_fn_8arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
+ } 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) {
+ 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) {
+ run_cast_test12_s32fc((volk_gnsssdr_fn_12arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
+ } 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) {
+ 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]);
+ }
+ }
+ else throw "unsupported 12 arg function >1 scalars";
+ break;
+ //ADDED BY GNSS-SDR. END
default:
throw "no function handler for this signature";
break;
diff -rupN /Users/andres/Desktop/volk_gnsssdr/lib/qa_utils.h /Users/andres/Desktop/volk_gnsssdr_original/lib/qa_utils.h
--- /Users/andres/Desktop/volk_gnsssdr/lib/qa_utils.h 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/lib/qa_utils.h 2014-10-17 04:21:51.000000000 +0200
@@ -77,4 +77,26 @@ typedef void (*volk_gnsssdr_fn_1arg_s32f
typedef void (*volk_gnsssdr_fn_2arg_s32fc)(void *, void *, lv_32fc_t, unsigned int, const char*);
typedef void (*volk_gnsssdr_fn_3arg_s32fc)(void *, void *, void *, lv_32fc_t, unsigned int, const char*);
+//ADDED BY GNSS-SDR. START
+typedef void (*volk_gnsssdr_fn_1arg_s8i)(void *, char, unsigned int, const char*); //one input vector, one scalar char input
+typedef void (*volk_gnsssdr_fn_2arg_s8i)(void *, void *, char, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_3arg_s8i)(void *, void *, void *, char, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_1arg_s8ic)(void *, lv_8sc_t, unsigned int, const char*); //one input vector, one scalar lv_8sc_t vector input
+typedef void (*volk_gnsssdr_fn_2arg_s8ic)(void *, void *, lv_8sc_t, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_3arg_s8ic)(void *, void *, void *, lv_8sc_t, unsigned int, const char*);
+
+typedef void (*volk_gnsssdr_fn_8arg)(void *, void *, void *, void *, void *, void *, void *, void *, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_8arg_s32f)(void *, void *, void *, void *, void *, void *, void *, void *, float, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_8arg_s32fc)(void *, void *, void *, void *, void *, void *, void *, void *, lv_32fc_t, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_8arg_s8i)(void *, void *, void *, void *, void *, void *, void *, void *, char, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_8arg_s8ic)(void *, void *, void *, void *, void *, void *, void *, void *, lv_8sc_t, unsigned int, const char*);
+
+typedef void (*volk_gnsssdr_fn_12arg)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_12arg_s32f)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, float, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_12arg_s32fc)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, lv_32fc_t, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_12arg_s8i)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, char, unsigned int, const char*);
+typedef void (*volk_gnsssdr_fn_12arg_s8ic)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, lv_8sc_t, unsigned int, const char*);
+//ADDED BY GNSS-SDR. END
+
+
#endif //VOLK_QA_UTILS_H
diff -rupN /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr.tmpl.h /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr.tmpl.h
--- /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr.tmpl.h 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr.tmpl.h 2014-10-17 04:23:30.000000000 +0200
@@ -19,8 +19,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_VOLK_RUNTIME
-#define INCLUDED_VOLK_RUNTIME
+#ifndef INCLUDED_VOLK_GNSSSDR_RUNTIME
+#define INCLUDED_VOLK_GNSSSDR_RUNTIME
#include <volk_gnsssdr/volk_gnsssdr_typedefs.h>
#include <volk_gnsssdr/volk_gnsssdr_config_fixed.h>
@@ -91,4 +91,4 @@ extern VOLK_API volk_gnsssdr_func_desc_t
__VOLK_DECL_END
-#endif /*INCLUDED_VOLK_RUNTIME*/
+#endif /*INCLUDED_VOLK_GNSSSDR_RUNTIME*/
diff -rupN /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_config_fixed.tmpl.h /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_config_fixed.tmpl.h
--- /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_config_fixed.tmpl.h 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_config_fixed.tmpl.h 2014-10-17 04:22:58.000000000 +0200
@@ -19,11 +19,11 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_VOLK_CONFIG_FIXED_H
-#define INCLUDED_VOLK_CONFIG_FIXED_H
+#ifndef INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED_H
+#define INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED_H
#for $i, $arch in enumerate($archs)
#define LV_$(arch.name.upper()) $i
#end for
-#endif /*INCLUDED_VOLK_CONFIG_FIXED*/
+#endif /*INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED*/
diff -rupN /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.h /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_cpu.tmpl.h
--- /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.h 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_cpu.tmpl.h 2014-10-17 04:23:07.000000000 +0200
@@ -19,8 +19,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_VOLK_CPU_H
-#define INCLUDED_VOLK_CPU_H
+#ifndef INCLUDED_VOLK_GNSSSDR_CPU_H
+#define INCLUDED_VOLK_GNSSSDR_CPU_H
#include <volk_gnsssdr/volk_gnsssdr_common.h>
@@ -39,4 +39,4 @@ unsigned int volk_gnsssdr_get_lvarch ();
__VOLK_DECL_END
-#endif /*INCLUDED_VOLK_CPU_H*/
+#endif /*INCLUDED_VOLK_GNSSSDR_CPU_H*/
diff -rupN /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_machines.tmpl.h /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_machines.tmpl.h
--- /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_machines.tmpl.h 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_machines.tmpl.h 2014-10-17 04:23:16.000000000 +0200
@@ -19,8 +19,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_LIBVOLK_MACHINES_H
-#define INCLUDED_LIBVOLK_MACHINES_H
+#ifndef INCLUDED_LIBVOLK_GNSSSDR_MACHINES_H
+#define INCLUDED_LIBVOLK_GNSSSDR_MACHINES_H
#include <volk_gnsssdr/volk_gnsssdr_common.h>
#include <volk_gnsssdr/volk_gnsssdr_typedefs.h>
@@ -52,4 +52,4 @@ extern struct volk_gnsssdr_machine volk_
__VOLK_DECL_END
-#endif //INCLUDED_LIBVOLK_MACHINES_H
+#endif //INCLUDED_LIBVOLK_GNSSSDR_MACHINES_H
diff -rupN /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_typedefs.tmpl.h /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_typedefs.tmpl.h
--- /Users/andres/Desktop/volk_gnsssdr/tmpl/volk_gnsssdr_typedefs.tmpl.h 2014-10-17 04:26:39.000000000 +0200
+++ /Users/andres/Desktop/volk_gnsssdr_original/tmpl/volk_gnsssdr_typedefs.tmpl.h 2014-10-17 04:23:23.000000000 +0200
@@ -19,8 +19,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_VOLK_TYPEDEFS
-#define INCLUDED_VOLK_TYPEDEFS
+#ifndef INCLUDED_VOLK_GNSSSDR_TYPEDEFS
+#define INCLUDED_VOLK_GNSSSDR_TYPEDEFS
#include <inttypes.h>
#include <volk_gnsssdr/volk_gnsssdr_complex.h>
@@ -29,4 +29,4 @@
typedef void (*$(kern.pname))($kern.arglist_types);
#end for
-#endif /*INCLUDED_VOLK_TYPEDEFS*/
+#endif /*INCLUDED_VOLK_GNSSSDR_TYPEDEFS*/

View File

@ -0,0 +1,71 @@
########################################################################
# 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.

View File

@ -91,4 +91,4 @@ extern VOLK_API volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void);
__VOLK_DECL_END
#endif /*INCLUDED_VOLK_RUNTIME*/
#endif /*INCLUDED_VOLK_GNSSSDR_RUNTIME*/

View File

@ -26,4 +26,4 @@
#define LV_$(arch.name.upper()) $i
#end for
#endif /*INCLUDED_VOLK_CONFIG_FIXED*/
#endif /*INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED*/

View File

@ -39,4 +39,4 @@ unsigned int volk_gnsssdr_get_lvarch ();
__VOLK_DECL_END
#endif /*INCLUDED_VOLK_CPU_H*/
#endif /*INCLUDED_VOLK_GNSSSDR_CPU_H*/

View File

@ -52,4 +52,4 @@ extern struct volk_gnsssdr_machine volk_gnsssdr_machine_$(machine.name);
__VOLK_DECL_END
#endif //INCLUDED_LIBVOLK_MACHINES_H
#endif //INCLUDED_LIBVOLK_GNSSSDR_MACHINES_H

View File

@ -29,4 +29,4 @@
typedef void (*$(kern.pname))($kern.arglist_types);
#end for
#endif /*INCLUDED_VOLK_TYPEDEFS*/
#endif /*INCLUDED_VOLK_GNSSSDR_TYPEDEFS*/