Skip to content

Commit

Permalink
Merge branch 'mako' of https://github.com/carlesfernandez/gnss-sdr into
Browse files Browse the repository at this point in the history
no-cheetah

# Conflicts:
#	src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt
  • Loading branch information
carlesfernandez committed Dec 25, 2016
2 parents ec51b6c + 05632aa commit 9664b65
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 177 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This section describes how to set up the compilation environment in GNU/Linux or
GNU/Linux
----------

* Tested distributions: Ubuntu 14.04 LTS and above, Debian 8.0 "jessie" and above, Linaro 15.03
* Tested distributions: Ubuntu 14.04 LTS and [above](http://packages.ubuntu.com/search?keywords=gnss-sdr), Debian 8.0 "jessie" and [above](https://packages.debian.org/search?searchon=names&keywords=gnss-sdr), Linaro 15.03
* Known to work but not continually tested: Arch Linux, Fedora, and openSUSE
* Supported microprocessor architectures:
* i386: Intel x86 instruction set (32-bit microprocessors).
Expand Down Expand Up @@ -46,7 +46,8 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \
libboost-serialization-dev libboost-program-options-dev libboost-test-dev \
liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev \
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev \
python-mako python-six
~~~~~~

Alternatively, and starting from Ubuntu 16.04 LTS, you can install all the required dependencies by adding the line
Expand Down
2 changes: 1 addition & 1 deletion conf/gnss-sdr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GNSS-SDR.SUPL_CI=0x31b0
SignalSource.implementation=File_Signal_Source

;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE
SignalSource.filename=/Users/carlesfernandez/Documents/workspace/code2/trunk/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ;/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE

;#item_type: Type and resolution for each of the signal samples.
SignalSource.item_type=ishort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,17 @@ SET(CROSSCOMPILE_MULTILIB ${CROSSCOMPILE_MULTILIB} CACHE STRING "Define \"true\"
# Python
include(VolkPython) #sets PYTHON_EXECUTABLE and PYTHON_DASH_B
VOLK_PYTHON_CHECK_MODULE("python >= 2.7" sys "sys.version.split()[0] >= '2.7'" PYTHON_MIN_VER_FOUND)
VOLK_PYTHON_CHECK_MODULE("Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND)
VOLK_PYTHON_CHECK_MODULE("mako >= 0.9.1" mako "mako.__version__ >= '0.9.1'" MAKO_FOUND)
VOLK_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND)


if(NOT PYTHON_MIN_VER_FOUND)
message(FATAL_ERROR "Python 2.7 or greater required to build VOLK_GNSSSDR")
endif()

# Cheetah
if(NOT CHEETAH_FOUND)
message(FATAL_ERROR "Cheetah templates required to build VOLK_GNSSSDR")
# Mako
if(NOT MAKO_FOUND)
message(FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR")
endif()
# Six
if(NOT SIX_FOUND)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ However, you can install and use VOLK_GNSSSDR kernels as you use VOLK's, indepen
First, make sure that the required dependencies are installed in you machine:

~~~~~~
$ sudo apt-get install git subversion cmake python-cheetah libboost-dev libbbost-filesystem
$ sudo apt-get install git subversion cmake python-mako python-six libboost-dev libbbost-filesystem
~~~~~~

In order to build and install the library, go to the base folder of the source code and do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,7 @@
import volk_gnsssdr_arch_defs
import volk_gnsssdr_machine_defs
import volk_gnsssdr_kernel_defs
from Cheetah import Template

def __escape_pre_processor(code):
out = list()
for line in code.splitlines():
m = re.match('^(\s*)#(\s*)(\w+)(.*)$', line)
if m:
p0, p1, fcn, stuff = m.groups()
conly = fcn in ('include', 'define', 'ifdef', 'ifndef', 'endif', 'elif', 'pragma')
both = fcn in ('if', 'else')
istmpl = '$' in stuff
if 'defined' in stuff: istmpl = False
if conly or (both and not istmpl):
line = '%s\\#%s%s%s'%(p0, p1, fcn, stuff)
out.append(line)
return '\n'.join(out)
from mako.template import Template

def __parse_tmpl(_tmpl, **kwargs):
defs = {
Expand All @@ -53,13 +38,12 @@ def __parse_tmpl(_tmpl, **kwargs):
'kernels': volk_gnsssdr_kernel_defs.kernels,
}
defs.update(kwargs)
_tmpl = __escape_pre_processor(_tmpl)
_tmpl = """
/* this file was generated by volk_gnsssdr template utils, do not edit! */
/* this file was generated by volk_gnsssdr template utils, do not edit! */
""" + _tmpl
return str(Template.Template(_tmpl, defs))
""" + _tmpl
return str(Template(_tmpl).render(**defs))

def main():
parser = optparse.OptionParser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,93 +110,91 @@ bool volk_gnsssdr_is_aligned(const void *ptr)
#define LV_HAVE_GENERIC
#define LV_HAVE_DISPATCHER

#for $kern in $kernels
%for kern in kernels:

#if $kern.has_dispatcher
#include <volk_gnsssdr/$(kern.name).h> //pulls in the dispatcher
#end if
%if kern.has_dispatcher:
#include <volk_gnsssdr/${kern.name}.h> //pulls in the dispatcher
%endif

static inline void __$(kern.name)_d($kern.arglist_full)
static inline void __${kern.name}_d(${kern.arglist_full})
{
#if $kern.has_dispatcher
$(kern.name)_dispatcher($kern.arglist_names);
%if kern.has_dispatcher:
${kern.name}_dispatcher(${kern.arglist_names});
return;
#end if

if (volk_gnsssdr_is_aligned(
#set $num_open_parens = 0
#for $arg_type, $arg_name in $kern.args
#if '*' in $arg_type
VOLK_OR_PTR($arg_name,
#set $num_open_parens += 1
#end if
#end for
0$(')'*$num_open_parens)
%endif

if (volk_gnsssdr_is_aligned(<% num_open_parens = 0 %>
%for arg_type, arg_name in kern.args:
%if '*' in arg_type:
VOLK_OR_PTR(${arg_name},<% num_open_parens += 1 %>
%endif
%endfor
0<% end_open_parens = ')'*num_open_parens %>${end_open_parens}
)){
$(kern.name)_a($kern.arglist_names);
${kern.name}_a(${kern.arglist_names});
}
else{
$(kern.name)_u($kern.arglist_names);
${kern.name}_u(${kern.arglist_names});
}
}

static inline void __init_$(kern.name)(void)
static inline void __init_${kern.name}(void)
{
const char *name = get_machine()->$(kern.name)_name;
const char **impl_names = get_machine()->$(kern.name)_impl_names;
const int *impl_deps = get_machine()->$(kern.name)_impl_deps;
const bool *alignment = get_machine()->$(kern.name)_impl_alignment;
const size_t n_impls = get_machine()->$(kern.name)_n_impls;
const char *name = get_machine()->${kern.name}_name;
const char **impl_names = get_machine()->${kern.name}_impl_names;
const int *impl_deps = get_machine()->${kern.name}_impl_deps;
const bool *alignment = get_machine()->${kern.name}_impl_alignment;
const size_t n_impls = get_machine()->${kern.name}_n_impls;
const size_t index_a = volk_gnsssdr_rank_archs(name, impl_names, impl_deps, alignment, n_impls, true/*aligned*/);
const size_t index_u = volk_gnsssdr_rank_archs(name, impl_names, impl_deps, alignment, n_impls, false/*unaligned*/);
$(kern.name)_a = get_machine()->$(kern.name)_impls[index_a];
$(kern.name)_u = get_machine()->$(kern.name)_impls[index_u];
${kern.name}_a = get_machine()->${kern.name}_impls[index_a];
${kern.name}_u = get_machine()->${kern.name}_impls[index_u];

assert($(kern.name)_a);
assert($(kern.name)_u);
assert(${kern.name}_a);
assert(${kern.name}_u);

$(kern.name) = &__$(kern.name)_d;
${kern.name} = &__${kern.name}_d;
}

static inline void __$(kern.name)_a($kern.arglist_full)
static inline void __${kern.name}_a(${kern.arglist_full})
{
__init_$(kern.name)();
$(kern.name)_a($kern.arglist_names);
__init_${kern.name}();
${kern.name}_a(${kern.arglist_names});
}

static inline void __$(kern.name)_u($kern.arglist_full)
static inline void __${kern.name}_u(${kern.arglist_full})
{
__init_$(kern.name)();
$(kern.name)_u($kern.arglist_names);
__init_${kern.name}();
${kern.name}_u(${kern.arglist_names});
}

static inline void __$(kern.name)($kern.arglist_full)
static inline void __${kern.name}(${kern.arglist_full})
{
__init_$(kern.name)();
$(kern.name)($kern.arglist_names);
__init_${kern.name}();
${kern.name}(${kern.arglist_names});
}

$kern.pname $(kern.name)_a = &__$(kern.name)_a;
$kern.pname $(kern.name)_u = &__$(kern.name)_u;
$kern.pname $(kern.name) = &__$(kern.name);
${kern.pname} ${kern.name}_a = &__${kern.name}_a;
${kern.pname} ${kern.name}_u = &__${kern.name}_u;
${kern.pname} ${kern.name} = &__${kern.name};

void $(kern.name)_manual($kern.arglist_full, const char* impl_name)
void ${kern.name}_manual(${kern.arglist_full}, const char* impl_name)
{
const int index = volk_gnsssdr_get_index(
get_machine()->$(kern.name)_impl_names,
get_machine()->$(kern.name)_n_impls,
get_machine()->${kern.name}_impl_names,
get_machine()->${kern.name}_n_impls,
impl_name
);
get_machine()->$(kern.name)_impls[index](
$kern.arglist_names
get_machine()->${kern.name}_impls[index](
${kern.arglist_names}
);
}

volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void) {
const char **impl_names = get_machine()->$(kern.name)_impl_names;
const int *impl_deps = get_machine()->$(kern.name)_impl_deps;
const bool *alignment = get_machine()->$(kern.name)_impl_alignment;
const size_t n_impls = get_machine()->$(kern.name)_n_impls;
volk_gnsssdr_func_desc_t ${kern.name}_get_func_desc(void) {
const char **impl_names = get_machine()->${kern.name}_impl_names;
const int *impl_deps = get_machine()->${kern.name}_impl_deps;
const bool *alignment = get_machine()->${kern.name}_impl_alignment;
const size_t n_impls = get_machine()->${kern.name}_n_impls;
volk_gnsssdr_func_desc_t desc = {
impl_names,
impl_deps,
Expand All @@ -206,4 +204,4 @@ volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void) {
return desc;
}

#end for
%endfor
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ VOLK_API size_t volk_gnsssdr_get_alignment(void);
*/
VOLK_API bool volk_gnsssdr_is_aligned(const void *ptr);

#for $kern in $kernels
%for kern in kernels:

//! A function pointer to the dispatcher implementation
extern VOLK_API $kern.pname $kern.name;
extern VOLK_API ${kern.pname} ${kern.name};

//! A function pointer to the fastest aligned implementation
extern VOLK_API $kern.pname $(kern.name)_a;
extern VOLK_API ${kern.pname} ${kern.name}_a;

//! A function pointer to the fastest unaligned implementation
extern VOLK_API $kern.pname $(kern.name)_u;
extern VOLK_API ${kern.pname} ${kern.name}_u;

//! Call into a specific implementation given by name
extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name);
extern VOLK_API void ${kern.name}_manual(${kern.arglist_full}, const char* impl_name);

//! Get description paramaters for this kernel
extern VOLK_API volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void);
#end for
extern VOLK_API volk_gnsssdr_func_desc_t ${kern.name}_get_func_desc(void);
%endfor

__VOLK_DECL_END

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#ifndef INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED_H
#define INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED_H

#for $i, $arch in enumerate($archs)
#ifndef LV_$(arch.name.upper())
#define LV_$(arch.name.upper()) $i
#endif
#end for
%for i, arch in enumerate(archs):
//#ifndef LV_${arch.name.upper()}
#define LV_${arch.name.upper()} ${i}
//#endif
%endfor

#endif /*INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED*/
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,14 @@ static int has_neon(void){
#endif
}

#for $arch in $archs
static int i_can_has_$arch.name (void) {
#for $check, $params in $arch.checks
if ($(check)($(', '.join($params))) == 0) return 0;
#end for
%for arch in archs:
static int i_can_has_${arch.name} (void) {
%for check, params in arch.checks:
if (${check}(<% joined_params = ', '.join(params)%>${joined_params}) == 0) return 0;
%endfor
return 1;
}

#end for
%endfor

#if defined(HAVE_FENV_H)
#if defined(FE_TONEAREST)
Expand All @@ -182,17 +181,17 @@ static int i_can_has_$arch.name (void) {
#endif

void volk_gnsssdr_cpu_init() {
#for $arch in $archs
volk_gnsssdr_cpu.has_$arch.name = &i_can_has_$arch.name;
#end for
%for arch in archs:
volk_gnsssdr_cpu.has_${arch.name} = &i_can_has_${arch.name};
%endfor
set_float_rounding();
}

unsigned int volk_gnsssdr_get_lvarch() {
unsigned int retval = 0;
volk_gnsssdr_cpu_init();
#for $arch in $archs
retval += volk_gnsssdr_cpu.has_$(arch.name)() << LV_$(arch.name.upper());
#end for
%for arch in archs:
retval += volk_gnsssdr_cpu.has_${arch.name}() << LV_${arch.name.upper()};
%endfor
return retval;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
__VOLK_DECL_BEGIN

struct VOLK_CPU {
#for $arch in $archs
int (*has_$arch.name) ();
#end for
%for arch in archs:
int (*has_${arch.name}) ();
%endfor
};

extern struct VOLK_CPU volk_gnsssdr_cpu;
Expand Down
Loading

0 comments on commit 9664b65

Please sign in to comment.