Commit 1dbffbde authored by Ting-An Lin's avatar Ting-An Lin Committed by rajeshwari.p

Init done: load FHI lib and DPDK lib in OAI

parent d2ae2a09
......@@ -160,7 +160,8 @@ set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3)
set (OPENAIR_CMAKE ${OPENAIR_DIR}/cmake_targets)
set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
set (XRAN_DIR ${OPENAIR_DIR}/targets/ARCH/ORAN_FHI/lib)
set (XRAN_LIB_DIR /usr/local/xran)
set (XRAN_LIB /usr/local/xran)
set (ICC_LIB /usr/local/intel64)
project (OpenAirInterface)
......@@ -629,6 +630,7 @@ target_link_libraries(benetel_4g PRIVATE asn1_nr_rrc asn1_lte_rrc)
include_directories("${XRAN_DIR}")
include_directories ("/usr/local/dpdk_19_11")
include_directories("${ICC_LIB}")
set(ORAN_FHLIB_4G_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/oran/4g/oran.cpp
......@@ -643,7 +645,8 @@ set_target_properties(oran_fhlib_4g PROPERTIES COMPILE_FLAGS "-fvisibility=hidde
SET(DPDK_LIBS "-Wl,-rpath,$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -Wl,--whole-archive -L$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -ldpdk -Wl,--no-whole-archive")
TARGET_LINK_LIBRARIES(oran_fhlib_4g ${DPDK_LIBS})
TARGET_LINK_LIBRARIES(oran_fhlib_4g -L${XRAN_LIB_DIR} -lxran)
TARGET_LINK_LIBRARIES(oran_fhlib_4g -L${XRAN_LIB} -lxran)
TARGET_LINK_LIBRARIES(oran_fhlib_4g -L${ICC_LIB} -lirc)
TARGET_LINK_LIBRARIES(oran_fhlib_4g pthread dl rt m numa)
# Benetel 5G library
......@@ -670,6 +673,7 @@ target_link_libraries(benetel_5g PRIVATE asn1_nr_rrc asn1_lte_rrc)
include_directories("${XRAN_DIR}")
include_directories ("/usr/local/dpdk_19_11/include/dpdk")
include_directories("${ICC_LIB}")
set(ORAN_FHLIB_5G_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/oran/5g/oran.cc
......@@ -683,7 +687,8 @@ set_target_properties(oran_fhlib_5g PROPERTIES COMPILE_FLAGS "-fvisibility=hidde
SET(DPDK_LIBS "-Wl,-rpath,$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -Wl,--whole-archive -L$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -ldpdk -Wl,--no-whole-archive")
TARGET_LINK_LIBRARIES(oran_fhlib_5g ${DPDK_LIBS})
TARGET_LINK_LIBRARIES(oran_fhlib_5g -L${XRAN_LIB_DIR} -lxran)
TARGET_LINK_LIBRARIES(oran_fhlib_5g -L${XRAN_LIB} -lxran)
TARGET_LINK_LIBRARIES(oran_fhlib_5g -L${ICC_LIB} -lirc)
TARGET_LINK_LIBRARIES(oran_fhlib_5g pthread dl rt m numa)
##########################################################
......
......@@ -39,9 +39,14 @@ void xran_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status){
rte_pause();
}
#ifdef __cplusplus
extern "C"
{
#endif
int start_oran(){
// xranLibWraper *xranlib = malloc(sizeof(*xranlib));
//xranLibWraper *xranlib = malloc(sizeof(xranLibWraper));
xranLibWraper *xranlib;
xranlib = new xranLibWraper;
if(xranlib->SetUp() < 0) {
......@@ -58,7 +63,9 @@ int start_oran(){
return (0);
}
#ifdef __cplusplus
}
#endif
......
......@@ -23,6 +23,7 @@
#define _ORAN_H_
#include "shared_buffers.h"
#include "common_lib.h"
void oran_fh_if4p5_south_out(RU_t *ru,
int frame,
......
......@@ -26,6 +26,15 @@
#include "shared_buffers.h"
#include "low_oran.h"
#ifdef __cplusplus
extern "C"
{
#endif
int start_oran();
#ifdef __cplusplus
}
#endif
#endif /* _ORAN_ISOLATE_H_ */
......@@ -31,7 +31,7 @@
#include <rte_malloc.h>
#endif
// #include "gtest/gtest.h"
//#include "gtest/gtest.h"
#include "common_typedef_xran.h"
......@@ -39,13 +39,13 @@
using json = nlohmann::json;
// #define ASSERT_ARRAY_NEAR(reference, actual, size, precision) \
#define ASSERT_ARRAY_NEAR(reference, actual, size, precision) \
assert_array_near(reference, actual, size, precision)
#define ASSERT_ARRAY_EQ(reference, actual, size) \
assert_array_eq(reference, actual, size)
// #define ASSERT_AVG_GREATER_COMPLEX(reference, actual, size, precision) \
#define ASSERT_AVG_GREATER_COMPLEX(reference, actual, size, precision) \
assert_avg_greater_complex(reference, actual, size, precision)
struct BenchmarkParameters
......@@ -106,7 +106,7 @@ json read_json_from_file(const std::string &filename);
\return Pointer to the allocated memory with data from the file.
\throws std::runtime_error when memory cannot be allocated.
*/
char* read_data_to_aligned_array(const std::string &filename);
//char* read_data_to_aligned_array(const std::string &filename);
/*!
\brief Measure the TSC on the machine
......@@ -575,29 +575,29 @@ private:
const double mean,
const double stddev);
};
#endif
/*!
\brief Run the given function and return the mean run time and stddev.
\param [in] function Function to benchmark.
\param [in] args Function's arguments.
\return std::pair where the first element is mean and the second one is standard deviation.
*/
// template <typename F, typename ... Args>
// std::pair<double, double> run_benchmark(F function, Args ... args)
// {
// std::vector<long> results((unsigned long) BenchmarkParameters::repetition);
// for(unsigned int outer_loop = 0; outer_loop < BenchmarkParameters::repetition; outer_loop++) {
// const auto start_time = __rdtsc();
// for (unsigned int inner_loop = 0; inner_loop < BenchmarkParameters::loop; inner_loop++) {
// function(args ...);
// }
// const auto end_time = __rdtsc();
// results.push_back(end_time - start_time);
// }
// return calculate_statistics(results);
// };
template <typename F, typename ... Args>
std::pair<double, double> run_benchmark(F function, Args ... args)
{
std::vector<long> results((unsigned long) BenchmarkParameters::repetition);
for(unsigned int outer_loop = 0; outer_loop < BenchmarkParameters::repetition; outer_loop++) {
const auto start_time = __rdtsc();
for (unsigned int inner_loop = 0; inner_loop < BenchmarkParameters::loop; inner_loop++) {
function(args ...);
}
const auto end_time = __rdtsc();
results.push_back(end_time - start_time);
}
return calculate_statistics(results);
};
/*!
\brief Assert elements of two arrays. It calls ASSERT_EQ for each element of the array.
......@@ -622,27 +622,27 @@ void assert_array_eq(const T* reference, const T* actual, const int size)
\param [in] size Size of the array.
\param [in] precision Precision fo the comparision used by ASSERT_NEAR.
*/
// template <typename T>
// void assert_array_near(const T* reference, const T* actual, const int size, const double precision)
// {
// for(int index = 0; index < size ; index++)
// {
// ASSERT_NEAR(reference[index], actual[index], precision)
// <<"The wrong number is index: "<< index;
// }
// }
// template <>
// void assert_array_near<complex_float>(const complex_float* reference, const complex_float* actual, const int size, const double precision)
// {
// for(int index = 0; index < size ; index++)
// {
// ASSERT_NEAR(reference[index].re, actual[index].re, precision)
// <<"The wrong number is RE, index: "<< index;
// ASSERT_NEAR(reference[index].im, actual[index].im, precision)
// <<"The wrong number is IM, index: "<< index;
// }
// }
template <typename T>
void assert_array_near(const T* reference, const T* actual, const int size, const double precision)
{
for(int index = 0; index < size ; index++)
{
ASSERT_NEAR(reference[index], actual[index], precision)
<<"The wrong number is index: "<< index;
}
}
template <>
void assert_array_near<complex_float>(const complex_float* reference, const complex_float* actual, const int size, const double precision)
{
for(int index = 0; index < size ; index++)
{
ASSERT_NEAR(reference[index].re, actual[index].re, precision)
<<"The wrong number is RE, index: "<< index;
ASSERT_NEAR(reference[index].im, actual[index].im, precision)
<<"The wrong number is IM, index: "<< index;
}
}
/*!
\brief Assert average diff of two arrays. It calls ASSERT_GT to check the average.
......@@ -651,40 +651,40 @@ void assert_array_eq(const T* reference, const T* actual, const int size)
\param [in] size Size of the array, based on complex inputs.
\param [in] precision Precision for the comparison used by ASSERT_GT.
*/
// template<typename T>
// void assert_avg_greater_complex(const T* reference, const T* actual, const int size, const double precision)
// {
// float mseDB, MSE;
// double avgMSEDB = 0.0;
// for (int index = 0; index < size; index++) {
// T refReal = reference[2*index];
// T refImag = reference[(2*index)+1];
// T resReal = actual[2*index];
// T resImag = actual[(2*index)+1];
// T errReal = resReal - refReal;
// T errIm = resImag - refImag;
// For some unit tests, e.g. PUCCH deomdulation, the expected output is 0. To avoid a
// divide by zero error, check the reference results to determine if the expected result
// is 0 and, if so, add a 1 to the division.
// if (refReal == 0 && refImag == 0)
// MSE = (float)(errReal*errReal + errIm*errIm)/(float)(refReal*refReal + refImag*refImag + 1);
// else
// MSE = (float)(errReal*errReal + errIm*errIm)/(float)(refReal*refReal + refImag*refImag);
// if(MSE == 0)
// mseDB = (float)(-100.0);
// else
// mseDB = (float)(10.0) * (float)log10(MSE);
// avgMSEDB += (double)mseDB;
// }
// avgMSEDB /= size;
// ASSERT_GT(precision, avgMSEDB);
// }
template<typename T>
void assert_avg_greater_complex(const T* reference, const T* actual, const int size, const double precision)
{
float mseDB, MSE;
double avgMSEDB = 0.0;
for (int index = 0; index < size; index++) {
T refReal = reference[2*index];
T refImag = reference[(2*index)+1];
T resReal = actual[2*index];
T resImag = actual[(2*index)+1];
T errReal = resReal - refReal;
T errIm = resImag - refImag;
For some unit tests, e.g. PUCCH deomdulation, the expected output is 0. To avoid a
divide by zero error, check the reference results to determine if the expected result
is 0 and, if so, add a 1 to the division.
if (refReal == 0 && refImag == 0)
MSE = (float)(errReal*errReal + errIm*errIm)/(float)(refReal*refReal + refImag*refImag + 1);
else
MSE = (float)(errReal*errReal + errIm*errIm)/(float)(refReal*refReal + refImag*refImag);
if(MSE == 0)
mseDB = (float)(-100.0);
else
mseDB = (float)(10.0) * (float)log10(MSE);
avgMSEDB += (double)mseDB;
}
avgMSEDB /= size;
ASSERT_GT(precision, avgMSEDB);
}
/*!
\brief Allocates memory of the given size.
......@@ -828,5 +828,6 @@ T* generate_random_real_numbers(const long size, const unsigned alignment, const
return generate_random_numbers<T, std::uniform_real_distribution<T>>(size, alignment, distribution);
}
#endif
#endif //XRANLIB_COMMON_HPP
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment