mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Merge branch 'opencl' into next
This commit is contained in:
commit
ea68c8523c
@ -2099,8 +2099,6 @@ if(ENABLE_OPENCL)
|
|||||||
if(NOT OPENCL_FOUND)
|
if(NOT OPENCL_FOUND)
|
||||||
message(STATUS "Processing blocks using OpenCL will not be built.")
|
message(STATUS "Processing blocks using OpenCL will not be built.")
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
set(OPENCL_FOUND FALSE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@ -2114,13 +2112,33 @@ if(DEFINED ENV{CUDA_GPU_ACCEL})
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA)
|
||||||
find_package(CUDA REQUIRED)
|
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
set_package_properties(CUDA PROPERTIES
|
include(CheckLanguage)
|
||||||
URL "https://developer.nvidia.com/cuda-downloads"
|
check_language(CUDA)
|
||||||
DESCRIPTION "Library for parallel programming in Nvidia GPUs"
|
if(CMAKE_CUDA_COMPILER)
|
||||||
PURPOSE "Used in some processing block implementations."
|
enable_language(CUDA)
|
||||||
TYPE REQUIRED
|
set(CUDA_FOUND TRUE)
|
||||||
)
|
if(NOT DEFINED CMAKE_CUDA_STANDARD)
|
||||||
|
set(CMAKE_CUDA_STANDARD 11)
|
||||||
|
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(ENABLE_CUDA OFF)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(CUDA REQUIRED)
|
||||||
|
set_package_properties(CUDA PROPERTIES
|
||||||
|
URL "https://developer.nvidia.com/cuda-downloads"
|
||||||
|
DESCRIPTION "Library for parallel programming in Nvidia GPUs"
|
||||||
|
PURPOSE "Used in some processing block implementations."
|
||||||
|
TYPE REQUIRED
|
||||||
|
)
|
||||||
|
if(NOT CUDA_FOUND)
|
||||||
|
set(ENABLE_CUDA OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(ENABLE_CUDA)
|
||||||
message(STATUS "NVIDIA CUDA GPU Acceleration will be enabled.")
|
message(STATUS "NVIDIA CUDA GPU Acceleration will be enabled.")
|
||||||
message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'")
|
message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'")
|
||||||
else()
|
else()
|
||||||
|
@ -104,7 +104,6 @@ if(MATIO_INCLUDE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MATIO_CONFIG_FILE)
|
if(MATIO_CONFIG_FILE)
|
||||||
|
|
||||||
# Read and parse MATIO config header file for version number
|
# Read and parse MATIO config header file for version number
|
||||||
file(STRINGS "${MATIO_INCLUDE_DIR}/${MATIO_CONFIG_FILE}" _matio_HEADER_CONTENTS REGEX "#define MATIO_((MAJOR|MINOR)_VERSION)|(RELEASE_LEVEL) ")
|
file(STRINGS "${MATIO_INCLUDE_DIR}/${MATIO_CONFIG_FILE}" _matio_HEADER_CONTENTS REGEX "#define MATIO_((MAJOR|MINOR)_VERSION)|(RELEASE_LEVEL) ")
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
|
# Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors)
|
||||||
#
|
#
|
||||||
# This file is part of GNSS-SDR.
|
# This file is part of GNSS-SDR.
|
||||||
#
|
#
|
||||||
@ -20,7 +20,7 @@
|
|||||||
#
|
#
|
||||||
# - Try to find OpenCL
|
# - Try to find OpenCL
|
||||||
# This module tries to find an OpenCL implementation on your system. It supports
|
# This module tries to find an OpenCL implementation on your system. It supports
|
||||||
# AMD / ATI, Apple and NVIDIA implementations, but shoudl work, too.
|
# AMD / ATI, Apple and NVIDIA implementations.
|
||||||
#
|
#
|
||||||
# Once done this will define
|
# Once done this will define
|
||||||
# OPENCL_FOUND - system has OpenCL
|
# OPENCL_FOUND - system has OpenCL
|
||||||
@ -35,85 +35,189 @@ endif()
|
|||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
set(OPENCL_VERSION_STRING "0.1.0")
|
function(_FIND_OPENCL_VERSION)
|
||||||
set(OPENCL_VERSION_MAJOR 0)
|
include(CheckSymbolExists)
|
||||||
set(OPENCL_VERSION_MINOR 1)
|
include(CMakePushCheckState)
|
||||||
set(OPENCL_VERSION_PATCH 0)
|
set(CMAKE_REQUIRED_QUIET ${OPENCL_FIND_QUIETLY})
|
||||||
|
|
||||||
if(APPLE)
|
cmake_push_check_state()
|
||||||
find_library(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX")
|
foreach(VERSION "2_2" "2_1" "2_0" "1_2" "1_1" "1_0")
|
||||||
find_path(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX")
|
set(CMAKE_REQUIRED_INCLUDES "${OPENCL_INCLUDE_DIR}")
|
||||||
find_path(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl.hpp DOC "Include for OpenCL CPP bindings on OSX")
|
|
||||||
|
|
||||||
else()
|
if(APPLE)
|
||||||
if(WIN32)
|
check_symbol_exists(
|
||||||
find_path(OPENCL_INCLUDE_DIRS CL/cl.h)
|
CL_VERSION_${VERSION}
|
||||||
find_path(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp)
|
"${OPENCL_INCLUDE_DIR}/Headers/cl.h"
|
||||||
|
OPENCL_VERSION_${VERSION}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
check_symbol_exists(
|
||||||
|
CL_VERSION_${VERSION}
|
||||||
|
"${OPENCL_INCLUDE_DIR}/CL/cl.h"
|
||||||
|
OPENCL_VERSION_${VERSION}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# The AMD SDK currently installs both x86 and x86_64 libraries
|
if(OPENCL_VERSION_${VERSION})
|
||||||
# This is only a hack to find out architecture
|
string(REPLACE "_" "." VERSION "${VERSION}")
|
||||||
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
|
set(OPENCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
|
||||||
set(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86_64")
|
string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
|
||||||
set(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86_64")
|
list(GET version_components 0 major_version)
|
||||||
else()
|
list(GET version_components 1 minor_version)
|
||||||
set(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86")
|
set(OPENCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
|
||||||
set(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86")
|
set(OPENCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
|
||||||
endif()
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
cmake_pop_check_state()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# find out if the user asked for a 64-bit build, and use the corresponding
|
find_path(OPENCL_INCLUDE_DIR
|
||||||
# 64 or 32 bit NVIDIA library paths to the search:
|
NAMES
|
||||||
string(REGEX MATCH "Win64" ISWIN64 ${CMAKE_GENERATOR})
|
CL/cl.h OpenCL/cl.h
|
||||||
if("${ISWIN64}" STREQUAL "Win64")
|
PATHS
|
||||||
find_library(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/x64)
|
ENV "PROGRAMFILES(X86)"
|
||||||
else()
|
ENV AMDAPPSDKROOT
|
||||||
find_library(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/Win32)
|
ENV INTELOCLSDKROOT
|
||||||
endif()
|
ENV NVSDKCOMPUTE_ROOT
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV ATISTREAMSDKROOT
|
||||||
|
ENV OCL_ROOT
|
||||||
|
/usr/local/cuda/include
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
OpenCL/common/inc
|
||||||
|
"AMD APP/include"
|
||||||
|
)
|
||||||
|
|
||||||
get_filename_component(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
|
find_path(_OPENCL_CPP_INCLUDE_DIRS
|
||||||
|
NAMES
|
||||||
|
CL/cl.hpp OpenCL/cl.hpp
|
||||||
|
PATHS
|
||||||
|
ENV "PROGRAMFILES(X86)"
|
||||||
|
ENV AMDAPPSDKROOT
|
||||||
|
ENV INTELOCLSDKROOT
|
||||||
|
ENV NVSDKCOMPUTE_ROOT
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV ATISTREAMSDKROOT
|
||||||
|
ENV OCL_ROOT
|
||||||
|
/usr/local/cuda/include
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
OpenCL/common/inc
|
||||||
|
"AMD APP/include"
|
||||||
|
)
|
||||||
|
|
||||||
# On Win32 search relative to the library
|
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
|
||||||
find_path(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include)
|
if(_OPENCL_CPP_INCLUDE_DIRS)
|
||||||
find_path(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include)
|
set(OPENCL_HAS_CPP_BINDINGS TRUE)
|
||||||
|
list(APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS})
|
||||||
else()
|
# This is often the same, so clean up
|
||||||
# Unix style platforms
|
list(REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS)
|
||||||
find_library(OPENCL_LIBRARIES OpenCL
|
|
||||||
ENV LD_LIBRARY_PATH
|
|
||||||
)
|
|
||||||
|
|
||||||
get_filename_component(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH)
|
|
||||||
get_filename_component(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
|
|
||||||
|
|
||||||
# The AMD SDK currently does not place its headers
|
|
||||||
# in /usr/include, therefore also search relative
|
|
||||||
# to the library
|
|
||||||
find_path(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include")
|
|
||||||
find_path(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
_FIND_OPENCL_VERSION()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
|
find_library(OPENCL_LIBRARY
|
||||||
|
NAMES OpenCL
|
||||||
|
PATHS
|
||||||
|
ENV "PROGRAMFILES(X86)"
|
||||||
|
ENV AMDAPPSDKROOT
|
||||||
|
ENV INTELOCLSDKROOT
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV NVSDKCOMPUTE_ROOT
|
||||||
|
ENV ATISTREAMSDKROOT
|
||||||
|
ENV OCL_ROOT
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"AMD APP/lib/x86"
|
||||||
|
lib/x86
|
||||||
|
lib/Win32
|
||||||
|
OpenCL/common/lib/Win32
|
||||||
|
)
|
||||||
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
find_library(OPENCL_LIBRARY
|
||||||
|
NAMES OpenCL
|
||||||
|
PATHS
|
||||||
|
ENV "PROGRAMFILES(X86)"
|
||||||
|
ENV AMDAPPSDKROOT
|
||||||
|
ENV INTELOCLSDKROOT
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV NVSDKCOMPUTE_ROOT
|
||||||
|
ENV ATISTREAMSDKROOT
|
||||||
|
ENV OCL_ROOT
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"AMD APP/lib/x86_64"
|
||||||
|
lib/x86_64
|
||||||
|
lib/x64
|
||||||
|
OpenCL/common/lib/x64
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
|
find_library(OPENCL_LIBRARY
|
||||||
|
NAMES OpenCL
|
||||||
|
PATHS
|
||||||
|
ENV AMDAPPSDKROOT
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV LD_LIBRARY_PATH
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib/x86
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
find_library(OPENCL_LIBRARY
|
||||||
|
NAMES OpenCL
|
||||||
|
PATHS
|
||||||
|
ENV AMDAPPSDKROOT
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV LD_LIBRARY_PATH
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib/x86_64
|
||||||
|
lib/x64
|
||||||
|
lib
|
||||||
|
lib64
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(OPENCL_LIBRARIES ${OPENCL_LIBRARY})
|
||||||
|
|
||||||
find_package_handle_standard_args(OPENCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS)
|
find_package_handle_standard_args(OPENCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS)
|
||||||
|
|
||||||
if(_OPENCL_CPP_INCLUDE_DIRS)
|
|
||||||
set(OPENCL_HAS_CPP_BINDINGS TRUE)
|
|
||||||
list(APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS})
|
|
||||||
# This is often the same, so clean up
|
|
||||||
list(REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
OPENCL_INCLUDE_DIRS
|
OPENCL_INCLUDE_DIRS
|
||||||
|
OPENCL_LIBRARIES
|
||||||
)
|
)
|
||||||
|
|
||||||
set_package_properties(OPENCL PROPERTIES
|
set_package_properties(OPENCL PROPERTIES
|
||||||
URL "https://www.khronos.org/opencl/"
|
URL "https://www.khronos.org/opencl/"
|
||||||
DESCRIPTION "Library for parallel programming"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(OPENCL_INCLUDE_DIRS AND OPENCL_LIBRARIES)
|
if(OPENCL_FOUND AND OPENCL_VERSION_STRING)
|
||||||
set( OPENCL_FOUND TRUE )
|
set_package_properties(OPENCL PROPERTIES
|
||||||
add_definitions( -DOPENCL=1 )
|
DESCRIPTION "Library for parallel programming (found: v${OPENCL_VERSION_STRING})"
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
set( OPENCL_FOUND FALSE )
|
set_package_properties(OPENCL PROPERTIES
|
||||||
add_definitions( -DOPENCL=0 )
|
DESCRIPTION "Library for parallel programming"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OPENCL_FOUND AND NOT TARGET OpenCL::OpenCL)
|
||||||
|
if(OPENCL_LIBRARY MATCHES "/([^/]+)\\.framework$")
|
||||||
|
add_library(OpenCL::OpenCL INTERFACE IMPORTED)
|
||||||
|
set_target_properties(OpenCL::OpenCL PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES "${OPENCL_LIBRARY}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(OpenCL::OpenCL PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${OPENCL_LIBRARY}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
set_target_properties(OpenCL::OpenCL PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${OPENCL_INCLUDE_DIRS}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -144,6 +144,12 @@ public:
|
|||||||
|
|
||||||
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
|
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
|
||||||
|
|
||||||
|
inline bool opencl_ready() const
|
||||||
|
{
|
||||||
|
bool ready = this->acquisition_cc_->opencl_ready();
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigurationInterface* configuration_;
|
ConfigurationInterface* configuration_;
|
||||||
pcps_opencl_acquisition_cc_sptr acquisition_cc_;
|
pcps_opencl_acquisition_cc_sptr acquisition_cc_;
|
||||||
|
@ -49,16 +49,6 @@ if(OPENCL_FOUND)
|
|||||||
set(ACQ_GR_BLOCKS_HEADERS ${ACQ_GR_BLOCKS_HEADERS} pcps_opencl_acquisition_cc.h)
|
set(ACQ_GR_BLOCKS_HEADERS ${ACQ_GR_BLOCKS_HEADERS} pcps_opencl_acquisition_cc.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(OPENCL_FOUND)
|
|
||||||
include_directories(${OPENCL_INCLUDE_DIRS})
|
|
||||||
if(OS_IS_MACOSX)
|
|
||||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
|
|
||||||
else()
|
|
||||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(SORT ACQ_GR_BLOCKS_HEADERS)
|
list(SORT ACQ_GR_BLOCKS_HEADERS)
|
||||||
list(SORT ACQ_GR_BLOCKS_SOURCES)
|
list(SORT ACQ_GR_BLOCKS_SOURCES)
|
||||||
|
|
||||||
@ -78,19 +68,19 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(acquisition_gr_blocks
|
target_link_libraries(acquisition_gr_blocks
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
algorithms_libs
|
||||||
Gnuradio::runtime
|
Gnuradio::runtime
|
||||||
Gnuradio::fft
|
Gnuradio::fft
|
||||||
Volk::volk
|
Volk::volk
|
||||||
channel_libs
|
channel_libs
|
||||||
acquisition_libs
|
acquisition_libs
|
||||||
core_system_parameters
|
core_system_parameters
|
||||||
${OPT_LIBRARIES}
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
Gflags::gflags
|
Gflags::gflags
|
||||||
Glog::glog
|
Glog::glog
|
||||||
Matio::matio
|
Matio::matio
|
||||||
Volkgnsssdr::volkgnsssdr
|
Volkgnsssdr::volkgnsssdr
|
||||||
algorithms_libs
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(acquisition_gr_blocks
|
target_include_directories(acquisition_gr_blocks
|
||||||
@ -101,7 +91,11 @@ target_include_directories(acquisition_gr_blocks
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(OPENCL_FOUND)
|
if(OPENCL_FOUND)
|
||||||
target_include_directories(acquisition_gr_blocks PUBLIC ${OPENCL_INCLUDE_DIRS})
|
target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL)
|
||||||
|
target_include_directories(acquisition_gr_blocks
|
||||||
|
PUBLIC
|
||||||
|
${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_CLANG_TIDY)
|
if(ENABLE_CLANG_TIDY)
|
||||||
@ -116,4 +110,5 @@ endif()
|
|||||||
set_property(TARGET acquisition_gr_blocks
|
set_property(TARGET acquisition_gr_blocks
|
||||||
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl>
|
||||||
)
|
)
|
||||||
|
@ -209,7 +209,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
|
|||||||
std::vector<cl::Platform> all_platforms;
|
std::vector<cl::Platform> all_platforms;
|
||||||
cl::Platform::get(&all_platforms);
|
cl::Platform::get(&all_platforms);
|
||||||
|
|
||||||
if (all_platforms.size() == 0)
|
if (all_platforms.empty())
|
||||||
{
|
{
|
||||||
std::cout << "No OpenCL platforms found. Check OpenCL installation!" << std::endl;
|
std::cout << "No OpenCL platforms found. Check OpenCL installation!" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@ -223,7 +223,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
|
|||||||
std::vector<cl::Device> gpu_devices;
|
std::vector<cl::Device> gpu_devices;
|
||||||
d_cl_platform.getDevices(CL_DEVICE_TYPE_GPU, &gpu_devices);
|
d_cl_platform.getDevices(CL_DEVICE_TYPE_GPU, &gpu_devices);
|
||||||
|
|
||||||
if (gpu_devices.size() == 0)
|
if (gpu_devices.empty())
|
||||||
{
|
{
|
||||||
std::cout << "No GPU devices found. Check OpenCL installation!" << std::endl;
|
std::cout << "No GPU devices found. Check OpenCL installation!" << std::endl;
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -51,8 +51,10 @@
|
|||||||
#ifndef GNSS_SDR_PCPS_OPENCL_ACQUISITION_CC_H_
|
#ifndef GNSS_SDR_PCPS_OPENCL_ACQUISITION_CC_H_
|
||||||
#define GNSS_SDR_PCPS_OPENCL_ACQUISITION_CC_H_
|
#define GNSS_SDR_PCPS_OPENCL_ACQUISITION_CC_H_
|
||||||
|
|
||||||
|
#define CL_SILENCE_DEPRECATION
|
||||||
#include "channel_fsm.h"
|
#include "channel_fsm.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
|
#include "opencl/cl.hpp"
|
||||||
#include "opencl/fft_internal.h"
|
#include "opencl/fft_internal.h"
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include <gnuradio/fft/fft.h>
|
#include <gnuradio/fft/fft.h>
|
||||||
@ -62,12 +64,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include "opencl/cl.hpp"
|
|
||||||
#else
|
|
||||||
#include <CL/cl.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class pcps_opencl_acquisition_cc;
|
class pcps_opencl_acquisition_cc;
|
||||||
|
|
||||||
typedef boost::shared_ptr<pcps_opencl_acquisition_cc> pcps_opencl_acquisition_cc_sptr;
|
typedef boost::shared_ptr<pcps_opencl_acquisition_cc> pcps_opencl_acquisition_cc_sptr;
|
||||||
@ -226,7 +222,6 @@ public:
|
|||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set channel fsm associated to this acquisition instance
|
* \brief Set channel fsm associated to this acquisition instance
|
||||||
*/
|
*/
|
||||||
@ -262,6 +257,16 @@ public:
|
|||||||
d_doppler_step = doppler_step;
|
d_doppler_step = doppler_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool opencl_ready() const
|
||||||
|
{
|
||||||
|
bool ready = false;
|
||||||
|
if (d_opencl == 0)
|
||||||
|
{
|
||||||
|
ready = true;
|
||||||
|
}
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||||
*/
|
*/
|
||||||
|
@ -73,12 +73,6 @@ if(OPENCL_FOUND)
|
|||||||
opencl/fft_setup.cc # Needs OpenCL
|
opencl/fft_setup.cc # Needs OpenCL
|
||||||
opencl/fft_kernelstring.cc # Needs OpenCL
|
opencl/fft_kernelstring.cc # Needs OpenCL
|
||||||
)
|
)
|
||||||
include_directories(${OPENCL_INCLUDE_DIRS})
|
|
||||||
if(OS_IS_MACOSX)
|
|
||||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
|
|
||||||
else()
|
|
||||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(SORT GNSS_SPLIBS_HEADERS)
|
list(SORT GNSS_SPLIBS_HEADERS)
|
||||||
@ -105,7 +99,6 @@ target_link_libraries(algorithms_libs
|
|||||||
Gflags::gflags
|
Gflags::gflags
|
||||||
Gnuradio::runtime
|
Gnuradio::runtime
|
||||||
Gnuradio::blocks
|
Gnuradio::blocks
|
||||||
${OPT_LIBRARIES}
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
core_system_parameters
|
core_system_parameters
|
||||||
Volk::volk ${ORC_LIBRARIES}
|
Volk::volk ${ORC_LIBRARIES}
|
||||||
@ -113,6 +106,13 @@ target_link_libraries(algorithms_libs
|
|||||||
Glog::glog
|
Glog::glog
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(OPENCL_FOUND)
|
||||||
|
target_link_libraries(algorithms_libs PUBLIC OpenCL::OpenCL)
|
||||||
|
target_include_directories(algorithms_libs PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/opencl
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(algorithms_libs
|
target_include_directories(algorithms_libs
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
||||||
@ -145,7 +145,7 @@ add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h)
|
|||||||
if(${FILESYSTEM_FOUND})
|
if(${FILESYSTEM_FOUND})
|
||||||
target_compile_definitions(gnss_sdr_flags PRIVATE -DHAS_STD_FILESYSTEM=1)
|
target_compile_definitions(gnss_sdr_flags PRIVATE -DHAS_STD_FILESYSTEM=1)
|
||||||
if(${find_experimental})
|
if(${find_experimental})
|
||||||
add_definitions(-DHAS_STD_FILESYSTEM_EXPERIMENTAL=1)
|
target_compile_definitions(gnss_sdr_flags PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(gnss_sdr_flags PRIVATE std::filesystem)
|
target_link_libraries(gnss_sdr_flags PRIVATE std::filesystem)
|
||||||
else()
|
else()
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -57,6 +57,7 @@ extern "C"
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
#define CL_SILENCE_DEPRECATION
|
||||||
#include <OpenCL/opencl.h>
|
#include <OpenCL/opencl.h>
|
||||||
#else
|
#else
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
|
@ -108,7 +108,7 @@ target_include_directories(tracking_adapters
|
|||||||
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA AND NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
target_link_libraries(tracking_adapters
|
target_link_libraries(tracking_adapters
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CUDA_LIBRARIES}
|
${CUDA_LIBRARIES}
|
||||||
|
@ -97,7 +97,7 @@ target_link_libraries(tracking_gr_blocks
|
|||||||
tracking_libs
|
tracking_libs
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA AND NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
target_link_libraries(tracking_gr_blocks
|
target_link_libraries(tracking_gr_blocks
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CUDA_LIBRARIES}
|
${CUDA_LIBRARIES}
|
||||||
|
@ -17,18 +17,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
|
||||||
# Append current NVCC flags by something, eg comput capability
|
|
||||||
# set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --gpu-architecture sm_30)
|
|
||||||
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++11;-O3; -use_fast_math -default-stream per-thread")
|
|
||||||
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
|
||||||
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
set(LIB_TYPE STATIC) #set the lib type
|
|
||||||
cuda_add_library(CUDA_CORRELATOR_LIB ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu)
|
|
||||||
set(OPT_TRACKING_LIBRARIES ${OPT_TRACKING_LIBRARIES} CUDA_CORRELATOR_LIB)
|
|
||||||
set(OPT_TRACKING_INCLUDES ${OPT_TRACKING_INCLUDES} ${CUDA_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(TRACKING_LIB_SOURCES
|
set(TRACKING_LIB_SOURCES
|
||||||
cpu_multicorrelator.cc
|
cpu_multicorrelator.cc
|
||||||
cpu_multicorrelator_real_codes.cc
|
cpu_multicorrelator_real_codes.cc
|
||||||
@ -63,6 +51,22 @@ set(TRACKING_LIB_HEADERS
|
|||||||
exponential_smoother.h
|
exponential_smoother.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if(ENABLE_CUDA)
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
|
set(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} cuda_multicorrelator.cu)
|
||||||
|
set(TRACKING_LIB_HEADERS ${TRACKING_LIB_HEADERS} cuda_multicorrelator.h)
|
||||||
|
else()
|
||||||
|
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++11;-O3; -use_fast_math -default-stream per-thread")
|
||||||
|
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
||||||
|
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
set(LIB_TYPE STATIC) #set the lib type
|
||||||
|
cuda_add_library(CUDA_CORRELATOR_LIB ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu)
|
||||||
|
set(OPT_TRACKING_LIBRARIES ${OPT_TRACKING_LIBRARIES} CUDA_CORRELATOR_LIB)
|
||||||
|
set(OPT_TRACKING_INCLUDES ${OPT_TRACKING_INCLUDES} ${CUDA_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ARMADILLO_VERSION_STRING VERSION_GREATER 7.400)
|
if(ARMADILLO_VERSION_STRING VERSION_GREATER 7.400)
|
||||||
# sqrtmat_sympd() requires 7.400
|
# sqrtmat_sympd() requires 7.400
|
||||||
set(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} nonlinear_tracking.cc)
|
set(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} nonlinear_tracking.cc)
|
||||||
@ -95,10 +99,16 @@ target_link_libraries(tracking_libs
|
|||||||
Glog::glog
|
Glog::glog
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(tracking_libs
|
if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
PUBLIC
|
target_link_libraries(tracking_libs
|
||||||
${OPT_TRACKING_INCLUDES}
|
PUBLIC
|
||||||
)
|
${OPT_TRACKING_LIBRARIES}
|
||||||
|
)
|
||||||
|
target_include_directories(tracking_libs
|
||||||
|
PUBLIC
|
||||||
|
${OPT_TRACKING_INCLUDES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(Boost_VERSION VERSION_GREATER "106599")
|
if(Boost_VERSION VERSION_GREATER "106599")
|
||||||
target_compile_definitions(tracking_libs
|
target_compile_definitions(tracking_libs
|
||||||
|
@ -40,12 +40,6 @@ set(GNSS_RECEIVER_HEADERS
|
|||||||
control_message.h
|
control_message.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
|
||||||
set(OPT_RECEIVER_INCLUDE_DIRS
|
|
||||||
${OPT_RECEIVER_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(SORT GNSS_RECEIVER_HEADERS)
|
list(SORT GNSS_RECEIVER_HEADERS)
|
||||||
list(SORT GNSS_RECEIVER_SOURCES)
|
list(SORT GNSS_RECEIVER_SOURCES)
|
||||||
|
|
||||||
@ -120,12 +114,16 @@ endif()
|
|||||||
|
|
||||||
if(OPENCL_FOUND)
|
if(OPENCL_FOUND)
|
||||||
message(STATUS "Adding processing blocks implemented using OpenCL")
|
message(STATUS "Adding processing blocks implemented using OpenCL")
|
||||||
|
target_link_libraries(core_receiver PUBLIC algorithms_libs OpenCL::OpenCL)
|
||||||
target_compile_definitions(core_receiver PRIVATE -DOPENCL_BLOCKS=1)
|
target_compile_definitions(core_receiver PRIVATE -DOPENCL_BLOCKS=1)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(core_receiver PRIVATE -DOPENCL_BLOCKS=0)
|
target_compile_definitions(core_receiver PRIVATE -DOPENCL_BLOCKS=0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA)
|
||||||
|
if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
|
target_include_directories(core_receiver PUBLIC ${CUDA_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
target_compile_definitions(core_receiver PRIVATE -DCUDA_GPU_ACCEL=1)
|
target_compile_definitions(core_receiver PRIVATE -DCUDA_GPU_ACCEL=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -212,5 +210,4 @@ endif()
|
|||||||
set_property(TARGET core_receiver APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
set_property(TARGET core_receiver APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/core/receiver>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/core/receiver>
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/core/interfaces>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/core/interfaces>
|
||||||
$<BUILD_INTERFACE:${OPT_RECEIVER_INCLUDE_DIRS}>
|
|
||||||
)
|
)
|
||||||
|
@ -45,14 +45,16 @@ if(NOT ENABLE_LOG)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA)
|
||||||
target_link_libraries(gnss-sdr
|
if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
PUBLIC
|
target_link_libraries(gnss-sdr
|
||||||
${CUDA_LIBRARIES}
|
PUBLIC
|
||||||
)
|
${CUDA_LIBRARIES}
|
||||||
target_include_directories(gnss-sdr
|
)
|
||||||
PUBLIC
|
target_include_directories(gnss-sdr
|
||||||
${CUDA_INCLUDE_DIRS}
|
PUBLIC
|
||||||
)
|
${CUDA_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
target_compile_definitions(gnss-sdr PRIVATE -DCUDA_GPU_ACCEL=1)
|
target_compile_definitions(gnss-sdr PRIVATE -DCUDA_GPU_ACCEL=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ if(ENABLE_UNIT_TESTING)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA AND NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
target_link_libraries(run_tests
|
target_link_libraries(run_tests
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CUDA_LIBRARIES}
|
${CUDA_LIBRARIES}
|
||||||
|
@ -494,50 +494,57 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
ASSERT_NO_THROW({
|
if (!acquisition->opencl_ready())
|
||||||
boost::shared_ptr<GenSignalSource> signal_source;
|
|
||||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
|
||||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
|
||||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
|
||||||
signal_source->connect(top_block);
|
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
|
||||||
}) << "Failure connecting the blocks of acquisition test.";
|
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
|
||||||
for (unsigned int i = 0; i < 2; i++)
|
|
||||||
{
|
{
|
||||||
init();
|
std::cout << "OpenCL Platform is not ready." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSERT_NO_THROW({
|
||||||
|
boost::shared_ptr<GenSignalSource> signal_source;
|
||||||
|
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||||
|
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||||
|
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||||
|
signal_source->connect(top_block);
|
||||||
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
if (i == 0)
|
// i = 0 --> satellite in acquisition is visible
|
||||||
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
|
for (unsigned int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
gnss_synchro.PRN = 10; // This satellite is visible
|
init();
|
||||||
}
|
|
||||||
else if (i == 1)
|
|
||||||
{
|
|
||||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
|
||||||
}
|
|
||||||
|
|
||||||
acquisition->set_local_code();
|
if (i == 0)
|
||||||
|
|
||||||
start_queue();
|
|
||||||
|
|
||||||
EXPECT_NO_THROW({
|
|
||||||
top_block->run(); // Start threads and wait
|
|
||||||
}) << "Failure running the top_block.";
|
|
||||||
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
|
||||||
if (message == 1)
|
|
||||||
{
|
{
|
||||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
gnss_synchro.PRN = 10; // This satellite is visible
|
||||||
|
}
|
||||||
|
else if (i == 1)
|
||||||
|
{
|
||||||
|
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||||
|
}
|
||||||
|
|
||||||
|
acquisition->set_local_code();
|
||||||
|
|
||||||
|
start_queue();
|
||||||
|
|
||||||
|
EXPECT_NO_THROW({
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||||
|
if (message == 1)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (i == 1)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (i == 1)
|
|
||||||
{
|
|
||||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -575,52 +582,58 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
|||||||
}) << "Failure connecting acquisition to the top_block.";
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
if (!acquisition->opencl_ready())
|
||||||
ASSERT_NO_THROW({
|
|
||||||
boost::shared_ptr<GenSignalSource> signal_source;
|
|
||||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
|
||||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
|
||||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
|
||||||
signal_source->connect(top_block);
|
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
|
||||||
}) << "Failure connecting the blocks of acquisition test.";
|
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible (prob of detection and prob of detection with wrong estimation)
|
|
||||||
// i = 1 --> satellite in acquisition is not visible (prob of false detection)
|
|
||||||
for (unsigned int i = 0; i < 2; i++)
|
|
||||||
{
|
{
|
||||||
init();
|
std::cout << "OpenCL Platform is not ready." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSERT_NO_THROW({
|
||||||
|
boost::shared_ptr<GenSignalSource> signal_source;
|
||||||
|
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||||
|
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||||
|
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||||
|
signal_source->connect(top_block);
|
||||||
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
if (i == 0)
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
|
// i = 0 --> satellite in acquisition is visible (prob of detection and prob of detection with wrong estimation)
|
||||||
|
// i = 1 --> satellite in acquisition is not visible (prob of false detection)
|
||||||
|
for (unsigned int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
gnss_synchro.PRN = 10; // This satellite is visible
|
init();
|
||||||
}
|
|
||||||
else if (i == 1)
|
|
||||||
{
|
|
||||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
|
||||||
}
|
|
||||||
|
|
||||||
acquisition->set_local_code();
|
if (i == 0)
|
||||||
|
{
|
||||||
|
gnss_synchro.PRN = 10; // This satellite is visible
|
||||||
|
}
|
||||||
|
else if (i == 1)
|
||||||
|
{
|
||||||
|
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||||
|
}
|
||||||
|
|
||||||
start_queue();
|
acquisition->set_local_code();
|
||||||
|
|
||||||
EXPECT_NO_THROW({
|
start_queue();
|
||||||
top_block->run(); // Start threads and wait
|
|
||||||
}) << "Failure running the top_block.";
|
|
||||||
|
|
||||||
if (i == 0)
|
EXPECT_NO_THROW({
|
||||||
{
|
top_block->run(); // Start threads and wait
|
||||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
|
||||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
if (i == 0)
|
||||||
}
|
{
|
||||||
else if (i == 1)
|
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||||
{
|
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
}
|
||||||
|
else if (i == 1)
|
||||||
|
{
|
||||||
|
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||||
|
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user