From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- volk/lib/qa_utils.cc | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index bb37801c9..c15979b3f 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -46,7 +46,7 @@ void load_random_data(void *data, volk_type_t type, unsigned int n) { case 4: if(type.is_signed) ((int32_t *)data)[i] = (int32_t) scaled_rand; else ((uint32_t *)data)[i] = (uint32_t) scaled_rand; - break; + break; case 2: if(type.is_signed) ((int16_t *)data)[i] = (int16_t) scaled_rand; else ((uint16_t *)data)[i] = (uint16_t) scaled_rand; @@ -69,7 +69,7 @@ static std::vector get_arch_list(struct volk_func_desc desc) { //if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc archlist.push_back(std::string(desc.indices[i])); } - + return archlist; } @@ -81,15 +81,15 @@ volk_type_t volk_type_from_string(std::string name) { type.is_signed = false; type.size = 0; type.str = 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); } - + //get the data size size_t last_size_pos = name.find_last_of("0123456789"); if(last_size_pos < 0) throw std::string("no size spec in type ").append(name); @@ -98,7 +98,7 @@ volk_type_t volk_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]) { case 'f': @@ -117,19 +117,19 @@ volk_type_t volk_type_from_string(std::string name) { throw; } } - + return type; } -static void get_signatures_from_name(std::vector &inputsig, - std::vector &outputsig, +static void get_signatures_from_name(std::vector &inputsig, + std::vector &outputsig, std::string name) { boost::char_separator sep("_"); boost::tokenizer > tok(name, sep); std::vector toked; tok.assign(name); toked.assign(tok.begin(), tok.end()); - + assert(toked[0] == "volk"); toked.erase(toked.begin()); @@ -143,7 +143,7 @@ static void get_signatures_from_name(std::vector &inputsig, try { type = volk_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 (...){ @@ -160,7 +160,7 @@ static void get_signatures_from_name(std::vector &inputsig, side = SIDE_NAME; fn_name.append("_"); fn_name.append(token); - } + } else if(side == SIDE_OUTPUT) { if(token != toked.back()) throw; //the last token in the name is the alignment } @@ -223,7 +223,7 @@ bool fcompare(t *in1, t *in2, unsigned int vlen, float tol) { } } } - + return fail; } @@ -239,7 +239,7 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) { } } } - + return fail; } @@ -264,10 +264,10 @@ bool run_volk_tests(struct volk_func_desc desc, std::vector *best_arch_vector = 0 ) { std::cout << "RUN_VOLK_TESTS: " << name << std::endl; - + //first let's get a list of available architectures for the test std::vector arch_list = get_arch_list(desc); - + if(arch_list.size() < 2) { std::cout << "no architectures to test" << std::endl; return false; @@ -279,7 +279,7 @@ bool run_volk_tests(struct volk_func_desc desc, //now we have to get a function signature by parsing the name std::vector inputsig, outputsig; get_signatures_from_name(inputsig, outputsig, name); - + //pull the input scalars into their own vector std::vector inputsc; for(size_t i=0; i > test_data; for(size_t i=0; i both_sigs; both_sigs.insert(both_sigs.end(), outputsig.begin(), outputsig.end()); both_sigs.insert(both_sigs.end(), inputsig.begin(), inputsig.end()); @@ -326,7 +326,7 @@ bool run_volk_tests(struct volk_func_desc desc, switch(both_sigs.size()) { case 1: if(inputsc.size() == 0) { - run_cast_test1((volk_fn_1arg)(manual_func), test_data[i], vlen, iter, arch_list[i]); + run_cast_test1((volk_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) { run_cast_test1_s32fc((volk_fn_1arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]); @@ -364,23 +364,23 @@ bool run_volk_tests(struct volk_func_desc desc, throw "no function handler for this signature"; break; } - + end = clock(); double arch_time = (double)(end-start)/(double)CLOCKS_PER_SEC; std::cout << arch_list[i] << " completed in " << arch_time << "s" << std::endl; profile_times.push_back(arch_time); } - + //and now compare each output to the generic output //first we have to know which output is the generic one, they aren't in order... size_t generic_offset=0; - for(size_t i=0; i arch_results; @@ -438,7 +438,7 @@ bool run_volk_tests(struct volk_func_desc desc, } arch_results.push_back(!fail); } - + double best_time = std::numeric_limits::max(); std::string best_arch = "generic"; for(size_t i=0; i < arch_list.size(); i++) { @@ -447,7 +447,7 @@ bool run_volk_tests(struct volk_func_desc desc, best_arch = arch_list[i]; } } - + std::cout << "Best arch: " << best_arch << std::endl; if(best_arch_vector) { best_arch_vector->push_back(name + std::string(" ") + best_arch); -- cgit