diff options
-rw-r--r-- | volk/CMakeLists.txt | 5 | ||||
-rw-r--r-- | volk/apps/CMakeLists.txt | 39 | ||||
-rw-r--r-- | volk/apps/volk_profile.cc (renamed from volk/lib/volk_profile.cc) | 8 | ||||
-rw-r--r-- | volk/gen/make_c.py | 2 | ||||
-rw-r--r-- | volk/gen/make_each_machine_c.py | 1 | ||||
-rw-r--r-- | volk/gen/make_machines_h.py | 1 | ||||
-rw-r--r-- | volk/lib/CMakeLists.txt | 6 | ||||
-rw-r--r-- | volk/lib/volk_rank_archs.c | 15 | ||||
-rw-r--r-- | volk/lib/volk_rank_archs.h | 8 |
9 files changed, 64 insertions, 21 deletions
diff --git a/volk/CMakeLists.txt b/volk/CMakeLists.txt index ab65f8791..9c95fe6cd 100644 --- a/volk/CMakeLists.txt +++ b/volk/CMakeLists.txt @@ -96,6 +96,11 @@ INSTALL( ADD_SUBDIRECTORY(lib) ######################################################################## +# And the utility apps +######################################################################## +ADD_SUBDIRECTORY(apps) + +######################################################################## # Print summary ######################################################################## MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") diff --git a/volk/apps/CMakeLists.txt b/volk/apps/CMakeLists.txt new file mode 100644 index 000000000..752cbc679 --- /dev/null +++ b/volk/apps/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. +# + +######################################################################## +# Setup profiler +######################################################################## +IF(MSVC) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/msvc) +ENDIF(MSVC) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/lib + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + +ADD_EXECUTABLE(volk_profile + ${CMAKE_CURRENT_SOURCE_DIR}/volk_profile.cc + ${CMAKE_SOURCE_DIR}/lib/qa_utils.cc + ${CMAKE_SOURCE_DIR}/lib/volk_prefs.cc +) + +TARGET_LINK_LIBRARIES(volk_profile volk ${Boost_LIBRARIES}) diff --git a/volk/lib/volk_profile.cc b/volk/apps/volk_profile.cc index c4a04abf2..eb7b70887 100644 --- a/volk/lib/volk_profile.cc +++ b/volk/apps/volk_profile.cc @@ -1,7 +1,6 @@ #include "qa_utils.h" #include <volk/volk.h> -#include <volk_rank_archs.h> -#include <boost/test/unit_test.hpp> +#include <volk/volk_prefs.h> #include <vector> #include <boost/foreach.hpp> #include <iostream> @@ -10,10 +9,7 @@ int main(int argc, char *argv[]) { std::vector<std::string> results; - char path[512]; - get_config_path(path); - std::string config_path(path); - + std::string config_path = get_config_path(); /* //VOLK_PROFILE(volk_16i_x5_add_quad_16i_x4_a16, 1e-4, 2046, 10000, &results); //VOLK_PROFILE(volk_16i_branch_4_state_8_a16, 1e-4, 2046, 10000, &results); diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py index 4e67f31ff..11b614644 100644 --- a/volk/gen/make_c.py +++ b/volk/gen/make_c.py @@ -82,7 +82,7 @@ static unsigned int get_index(const char *indices[], unsigned int n_archs, const for i in range(len(functions)): tempstring += "void get_" + functions[i] + replace_arch.sub("", arched_arglist[i]) + "\n" - tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_arch_defs, get_machine()->%s_n_archs, volk_get_lvarch())];\n" % (functions[i], functions[i], functions[i], functions[i]) + tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_arch_defs, get_machine()->%s_n_archs, get_machine()->%s_name, volk_get_lvarch())];\n" % (functions[i], functions[i], functions[i], functions[i], functions[i]) tempstring += " %s(%s);\n}\n\n" % (functions[i], my_arglist[i]) tempstring += replace_volk.sub("p", functions[i]) + " " + functions[i] + " = &get_" + functions[i] + ";\n\n" tempstring += "void %s_manual%s\n" % (functions[i], arched_arglist[i]) diff --git a/volk/gen/make_each_machine_c.py b/volk/gen/make_each_machine_c.py index a7d3bb752..dfb7011b4 100644 --- a/volk/gen/make_each_machine_c.py +++ b/volk/gen/make_each_machine_c.py @@ -41,6 +41,7 @@ def _make_each_machine_struct(machine_name, archs, functions, fcountlist, taglis #fill in the description for each function for i in range(len(functions)): + tempstring += " \"%s\",\n"%functions[i] tempstring += " {%s},\n"%(', '.join(['"%s"'%tag for tag in machine_taglists[i]])) tempstring += " {%s},\n"%(', '.join([' | '.join(['(1 << LV_%s)'%fc for fc in fcount]) for fcount in machine_fcountlists[i]])) tempstring += " {%s},\n"%(', '.join(['%s_%s'%(functions[i], tag) for tag in machine_taglists[i]])) diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index 09ada3e0d..563de18a6 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -35,6 +35,7 @@ struct volk_machine { const char *name; """ for function in functions: + tempstring += " const char *%s_name;\n"%function tempstring += " const char *%s_indices[%d];\n"%(function, len(archs)) tempstring += " const int %s_arch_defs[%d];\n"%(function, len(archs)) tempstring += " const %s %s_archs[%d];\n"%(replace_volk.sub("p", function), function, len(archs)) diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt index 6198dc0e7..dfb1d4219 100644 --- a/volk/lib/CMakeLists.txt +++ b/volk/lib/CMakeLists.txt @@ -227,10 +227,4 @@ ADD_EXECUTABLE(test_all TARGET_LINK_LIBRARIES(test_all volk ${Boost_LIBRARIES}) ADD_TEST(qa_volk_test_all test_all) -ADD_EXECUTABLE(volk_profile - ${CMAKE_CURRENT_SOURCE_DIR}/volk_profile.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_utils.cc -) -TARGET_LINK_LIBRARIES(volk_profile volk ${Boost_LIBRARIES}) - ENDIF() diff --git a/volk/lib/volk_rank_archs.c b/volk/lib/volk_rank_archs.c index f505abeb6..14f1789da 100644 --- a/volk/lib/volk_rank_archs.c +++ b/volk/lib/volk_rank_archs.c @@ -7,6 +7,8 @@ #include <Windows.h> #endif +//this should be used by the profiler app to find the path as well +//possibly all this stuff should go in a separate volk_prefs.cc void get_config_path(char *path) { const char *suffix = "/.gnuradio/volk_config"; memcpy(path, getenv("HOME"), strlen(getenv("HOME"))+1); @@ -25,8 +27,19 @@ void get_config_path(char *path) { * * also means you don't have to also spec the fn name in qa_utils.h/c, you can * pass it in along with the func_desc + * + * your prefs reader should also have a prefs writer which takes a vector of prefs and writes them + * then your profiler can just write the prefs by passing that out * */ + +struct volk_arch_pref { + const char *name; + const char *arch; +}; + +//if we end up with more this will have to use realloc +struct volk_arch_pref volk_arch_prefs[400]; void load_preferences(void) { static int prefs_loaded = 0; @@ -56,7 +69,7 @@ void load_preferences(void) { prefs_loaded = 1; } -unsigned int volk_rank_archs(const int* arch_defs, unsigned int n_archs, unsigned int arch) { +unsigned int volk_rank_archs(const int* arch_defs, unsigned int n_archs, const char* name, unsigned int arch) { int i = 1; unsigned int best_val = 0; for(; i < n_archs; ++i) { diff --git a/volk/lib/volk_rank_archs.h b/volk/lib/volk_rank_archs.h index 37a0fbc46..ba248aa59 100644 --- a/volk/lib/volk_rank_archs.h +++ b/volk/lib/volk_rank_archs.h @@ -5,13 +5,7 @@ extern "C" { #endif -unsigned int volk_rank_archs(const int* arch_defs, unsigned int n_archs, unsigned int arch); - -//////////////////////////////////////////////////////////////////////// -//get path to volk_config profiling info -//////////////////////////////////////////////////////////////////////// -void get_config_path(char *); -void load_preferences(void); //FIXME DEBUG shouldn't be exported +unsigned int volk_rank_archs(const int* arch_defs, unsigned int n_archs, const char *name, unsigned int arch); #ifdef __cplusplus } |