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