From 11eafa8ab493e0644d0568dd4f1e750a7eb8d1ed Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Fri, 20 Dec 2019 16:37:18 +0100 Subject: [PATCH] srsLTE: FFTW wisdom gets loaded and saved by default --- lib/include/srslte/phy/dft/dft.h | 4 ---- lib/src/phy/channel/test/fading_channel_test.c | 2 -- lib/src/phy/dft/dft_fftw.c | 6 ++++-- lib/src/phy/dft/test/ofdm_test.c | 1 - lib/src/phy/phch/test/pbch_file_test.c | 1 - lib/src/phy/phch/test/pbch_test.c | 1 - lib/src/phy/phch/test/pcfich_file_test.c | 1 - lib/src/phy/phch/test/pcfich_test.c | 1 - lib/src/phy/phch/test/pdcch_file_test.c | 1 - lib/src/phy/phch/test/pdcch_test.c | 1 - lib/src/phy/phch/test/pdsch_pdcch_file_test.c | 1 - lib/src/phy/phch/test/pdsch_test.c | 1 - lib/src/phy/phch/test/phich_file_test.c | 1 - lib/src/phy/phch/test/phich_test.c | 1 - lib/src/phy/phch/test/pmch_file_test.c | 1 - lib/src/phy/phch/test/pmch_test.c | 1 - lib/src/phy/phch/test/prach_test.c | 1 - lib/src/phy/phch/test/prach_test_multi.c | 1 - lib/src/phy/phch/test/prach_test_usrp.c | 1 - lib/src/phy/phch/test/pucch_test.c | 1 - lib/src/phy/phch/test/pusch_test.c | 3 --- lib/src/phy/sync/test/cfo_test.c | 1 - lib/src/phy/sync/test/npss_test.c | 1 - lib/src/phy/sync/test/nsss_test.c | 1 - lib/src/phy/sync/test/sync_test.c | 1 - lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c | 1 - lib/src/phy/utils/test/dft_test.c | 2 -- lib/test/phy/phy_dl_test.c | 1 - srsenb/src/enb.cc | 3 --- srsue/src/ue.cc | 7 ------- srsue/test/phy/scell_search_test.cc | 3 --- 31 files changed, 4 insertions(+), 49 deletions(-) diff --git a/lib/include/srslte/phy/dft/dft.h b/lib/include/srslte/phy/dft/dft.h index b645b5a98..167063579 100644 --- a/lib/include/srslte/phy/dft/dft.h +++ b/lib/include/srslte/phy/dft/dft.h @@ -63,10 +63,6 @@ typedef struct SRSLTE_API { srslte_dft_mode_t mode; // Complex/Real } srslte_dft_plan_t; -SRSLTE_API void srslte_dft_load(); - -SRSLTE_API void srslte_dft_exit(); - SRSLTE_API int srslte_dft_plan(srslte_dft_plan_t* plan, int dft_points, srslte_dft_dir_t dir, srslte_dft_mode_t type); SRSLTE_API int srslte_dft_plan_c(srslte_dft_plan_t* plan, int dft_points, srslte_dft_dir_t dir); diff --git a/lib/src/phy/channel/test/fading_channel_test.c b/lib/src/phy/channel/test/fading_channel_test.c index 038a84863..ce04d1c77 100644 --- a/lib/src/phy/channel/test/fading_channel_test.c +++ b/lib/src/phy/channel/test/fading_channel_test.c @@ -96,7 +96,6 @@ int main(int argc, char** argv) uint64_t time_usec = 0; parse_args(argc, argv); - srslte_dft_load(); srslte_dft_plan_t ifft; srslte_dft_plan_c(&ifft, srate / 1000, SRSLTE_DFT_BACKWARD); @@ -251,6 +250,5 @@ clean_exit: free(output_buffer); } srslte_channel_fading_free(&channel_fading); - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/dft/dft_fftw.c b/lib/src/phy/dft/dft_fftw.c index 26e17dec3..575cf74ed 100644 --- a/lib/src/phy/dft/dft_fftw.c +++ b/lib/src/phy/dft/dft_fftw.c @@ -53,7 +53,8 @@ static int get_fftw_wisdom_file(char* full_path, uint32_t n) static pthread_mutex_t fft_mutex = PTHREAD_MUTEX_INITIALIZER; -__attribute__((constructor)) void srslte_dft_load() +// This function is called in the beggining of any executable where it is linked +__attribute__((constructor)) static void srslte_dft_load() { #ifdef FFTW_WISDOM_FILE char full_path[256]; @@ -64,7 +65,8 @@ __attribute__((constructor)) void srslte_dft_load() #endif } -__attribute__((destructor)) void srslte_dft_exit() +// This function is called in the ending of any executable where it is linked +__attribute__((destructor)) static void srslte_dft_exit() { #ifdef FFTW_WISDOM_FILE char full_path[256]; diff --git a/lib/src/phy/dft/test/ofdm_test.c b/lib/src/phy/dft/test/ofdm_test.c index a82163226..93fac8da3 100644 --- a/lib/src/phy/dft/test/ofdm_test.c +++ b/lib/src/phy/dft/test/ofdm_test.c @@ -182,7 +182,6 @@ int main(int argc, char** argv) n_prb++; } - srslte_dft_exit(); exit(0); } diff --git a/lib/src/phy/phch/test/pbch_file_test.c b/lib/src/phy/phch/test/pbch_file_test.c index 29ea0279e..17388b03f 100644 --- a/lib/src/phy/phch/test/pbch_file_test.c +++ b/lib/src/phy/phch/test/pbch_file_test.c @@ -230,7 +230,6 @@ int main(int argc, char** argv) } while (nread > 0 && frame_cnt < nof_frames); base_free(); - srslte_dft_exit(); if (frame_cnt == 1) { if (n == 0) { diff --git a/lib/src/phy/phch/test/pbch_test.c b/lib/src/phy/phch/test/pbch_test.c index a077c643e..d85133300 100644 --- a/lib/src/phy/phch/test/pbch_test.c +++ b/lib/src/phy/phch/test/pbch_test.c @@ -142,7 +142,6 @@ int main(int argc, char** argv) srslte_vec_fprint_hex(stdout, bch_payload_tx, SRSLTE_BCH_PAYLOAD_LEN); printf("Rx payload: "); srslte_vec_fprint_hex(stdout, bch_payload_rx, SRSLTE_BCH_PAYLOAD_LEN); - srslte_dft_exit(); if (nof_rx_ports == cell.nof_ports && !memcmp(bch_payload_rx, bch_payload_tx, sizeof(uint8_t) * SRSLTE_BCH_PAYLOAD_LEN)) { diff --git a/lib/src/phy/phch/test/pcfich_file_test.c b/lib/src/phy/phch/test/pcfich_file_test.c index d5d534ddf..432cae20c 100644 --- a/lib/src/phy/phch/test/pcfich_file_test.c +++ b/lib/src/phy/phch/test/pcfich_file_test.c @@ -248,7 +248,6 @@ int main(int argc, char** argv) srslte_vec_save_file("d", pcfich.d, pcfich.nof_symbols * sizeof(cf_t)); base_free(); - srslte_dft_exit(); if (n < 0) { ERROR("Error decoding PCFICH\n"); diff --git a/lib/src/phy/phch/test/pcfich_test.c b/lib/src/phy/phch/test/pcfich_test.c index 7084bf49a..8a648042d 100644 --- a/lib/src/phy/phch/test/pcfich_test.c +++ b/lib/src/phy/phch/test/pcfich_test.c @@ -158,6 +158,5 @@ int main(int argc, char** argv) free(slot_symbols[i]); } printf("OK\n"); - srslte_dft_exit(); exit(0); } diff --git a/lib/src/phy/phch/test/pdcch_file_test.c b/lib/src/phy/phch/test/pdcch_file_test.c index f60137d91..632dc7cd2 100644 --- a/lib/src/phy/phch/test/pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdcch_file_test.c @@ -283,6 +283,5 @@ int main(int argc, char** argv) } while (frame_cnt <= max_frames); base_free(); - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/phch/test/pdcch_test.c b/lib/src/phy/phch/test/pdcch_test.c index 1ae15952d..e0b82dfd7 100644 --- a/lib/src/phy/phch/test/pdcch_test.c +++ b/lib/src/phy/phch/test/pdcch_test.c @@ -410,6 +410,5 @@ quit: } else { printf("Ok\n"); } - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c index 0b3fdb7dd..d27f24cd7 100644 --- a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c @@ -217,7 +217,6 @@ int main(int argc, char** argv) } while (nof_frames <= max_frames && ret == 0); base_free(); - srslte_dft_exit(); if (data[0]) free(data[0]); if (ret > 0) { diff --git a/lib/src/phy/phch/test/pdsch_test.c b/lib/src/phy/phch/test/pdsch_test.c index 1e04ee314..ce298ef23 100644 --- a/lib/src/phy/phch/test/pdsch_test.c +++ b/lib/src/phy/phch/test/pdsch_test.c @@ -588,6 +588,5 @@ quit: } else { printf("Ok\n"); } - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/phch/test/phich_file_test.c b/lib/src/phy/phch/test/phich_file_test.c index f00e039c8..e3cb93a2a 100644 --- a/lib/src/phy/phch/test/phich_file_test.c +++ b/lib/src/phy/phch/test/phich_file_test.c @@ -282,7 +282,6 @@ int main(int argc, char** argv) } base_free(); - srslte_dft_exit(); if (n < 0) { ERROR("Error decoding phich\n"); diff --git a/lib/src/phy/phch/test/phich_test.c b/lib/src/phy/phch/test/phich_test.c index b808cbf28..0775bb970 100644 --- a/lib/src/phy/phch/test/phich_test.c +++ b/lib/src/phy/phch/test/phich_test.c @@ -225,7 +225,6 @@ int main(int argc, char** argv) for (i = 0; i < SRSLTE_MAX_PORTS; i++) { free(slot_symbols[i]); } - srslte_dft_exit(); printf("OK\n"); exit(0); } diff --git a/lib/src/phy/phch/test/pmch_file_test.c b/lib/src/phy/phch/test/pmch_file_test.c index 28cdc77bf..3667d34ee 100644 --- a/lib/src/phy/phch/test/pmch_file_test.c +++ b/lib/src/phy/phch/test/pmch_file_test.c @@ -229,7 +229,6 @@ int main(int argc, char** argv) if (data != NULL) { free(data); } - srslte_dft_exit(); if (ret >= 0) { exit(0); } else { diff --git a/lib/src/phy/phch/test/pmch_test.c b/lib/src/phy/phch/test/pmch_test.c index 07907ce73..2ca645391 100644 --- a/lib/src/phy/phch/test/pmch_test.c +++ b/lib/src/phy/phch/test/pmch_test.c @@ -438,7 +438,6 @@ quit: printf("Ok\n"); } - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/phch/test/prach_test.c b/lib/src/phy/phch/test/prach_test.c index d05e0991e..bab02773b 100644 --- a/lib/src/phy/phch/test/prach_test.c +++ b/lib/src/phy/phch/test/prach_test.c @@ -118,7 +118,6 @@ int main(int argc, char** argv) } srslte_prach_free(&prach); - srslte_dft_exit(); printf("Done\n"); exit(0); diff --git a/lib/src/phy/phch/test/prach_test_multi.c b/lib/src/phy/phch/test/prach_test_multi.c index bf3ed69ba..f250beb0f 100644 --- a/lib/src/phy/phch/test/prach_test_multi.c +++ b/lib/src/phy/phch/test/prach_test_multi.c @@ -139,7 +139,6 @@ int main(int argc, char** argv) } srslte_prach_free(&prach); - srslte_dft_exit(); printf("Done\n"); exit(0); } diff --git a/lib/src/phy/phch/test/prach_test_usrp.c b/lib/src/phy/phch/test/prach_test_usrp.c index f6d1c0877..8f4434c66 100644 --- a/lib/src/phy/phch/test/prach_test_usrp.c +++ b/lib/src/phy/phch/test/prach_test_usrp.c @@ -228,7 +228,6 @@ int main(int argc, char** argv) srslte_rf_close(&rf); srslte_prach_free(&prach); - srslte_dft_exit(); printf("Done\n"); exit(0); diff --git a/lib/src/phy/phch/test/pucch_test.c b/lib/src/phy/phch/test/pucch_test.c index 33cf1099a..19f7977ed 100644 --- a/lib/src/phy/phch/test/pucch_test.c +++ b/lib/src/phy/phch/test/pucch_test.c @@ -259,6 +259,5 @@ quit: } else { printf("Ok\n"); } - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/phch/test/pusch_test.c b/lib/src/phy/phch/test/pusch_test.c index 0bdd6bb17..f65354425 100644 --- a/lib/src/phy/phch/test/pusch_test.c +++ b/lib/src/phy/phch/test/pusch_test.c @@ -198,8 +198,6 @@ int main(int argc, char** argv) bzero(&cfg, sizeof(srslte_pusch_cfg_t)); - srslte_dft_load(); - srslte_dci_ul_t dci; ZERO_OBJECT(dci); @@ -410,6 +408,5 @@ quit: } else { printf("Ok\n"); } - srslte_dft_exit(); exit(ret); } diff --git a/lib/src/phy/sync/test/cfo_test.c b/lib/src/phy/sync/test/cfo_test.c index c6bfebd3d..8295567e2 100644 --- a/lib/src/phy/sync/test/cfo_test.c +++ b/lib/src/phy/sync/test/cfo_test.c @@ -104,7 +104,6 @@ int main(int argc, char** argv) srslte_cfo_free(&cfocorr); free(input); free(output); - srslte_dft_exit(); printf("MSE: %f\n", mse); if (mse > MAX_MSE) { diff --git a/lib/src/phy/sync/test/npss_test.c b/lib/src/phy/sync/test/npss_test.c index f577ffb30..77e1b4b99 100644 --- a/lib/src/phy/sync/test/npss_test.c +++ b/lib/src/phy/sync/test/npss_test.c @@ -149,7 +149,6 @@ int main(int argc, char** argv) free(input_buffer); srslte_ofdm_tx_free(&ifft); - srslte_dft_exit(); if (peak_pos == SRSLTE_NPSS_CORR_OFFSET) { printf("Ok\n"); diff --git a/lib/src/phy/sync/test/nsss_test.c b/lib/src/phy/sync/test/nsss_test.c index 56ed51799..d7a7a28fc 100644 --- a/lib/src/phy/sync/test/nsss_test.c +++ b/lib/src/phy/sync/test/nsss_test.c @@ -224,7 +224,6 @@ exit: free(fft_buffer); } - srslte_dft_exit(); return ret; } diff --git a/lib/src/phy/sync/test/sync_test.c b/lib/src/phy/sync/test/sync_test.c index e4cc554c6..ee989b246 100644 --- a/lib/src/phy/sync/test/sync_test.c +++ b/lib/src/phy/sync/test/sync_test.c @@ -182,7 +182,6 @@ int main(int argc, char** argv) srslte_sync_free(&syncobj); srslte_ofdm_tx_free(&ifft); - srslte_dft_exit(); printf("Ok\n"); exit(0); diff --git a/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c b/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c index ae6b4a100..21a55cdb7 100644 --- a/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c +++ b/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c @@ -175,7 +175,6 @@ int main(int argc, char** argv) srslte_ue_mib_sync_nbiot_free(&mib_sync); srslte_rf_close(&rf); - srslte_dft_exit(); return SRSLTE_SUCCESS; } diff --git a/lib/src/phy/utils/test/dft_test.c b/lib/src/phy/utils/test/dft_test.c index 487c47b18..4bf0a9e7a 100644 --- a/lib/src/phy/utils/test/dft_test.c +++ b/lib/src/phy/utils/test/dft_test.c @@ -152,8 +152,6 @@ int main(int argc, char** argv) if (test_dft(in) != 0) return -1; - srslte_dft_exit(); - free(in); printf("Done\n"); exit(0); diff --git a/lib/test/phy/phy_dl_test.c b/lib/test/phy/phy_dl_test.c index b16d7487c..e220cc64a 100644 --- a/lib/test/phy/phy_dl_test.c +++ b/lib/test/phy/phy_dl_test.c @@ -699,6 +699,5 @@ quit: } else { printf("Ok\n"); } - srslte_dft_exit(); exit(ret); } diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index bb32638e4..ca9f6b45a 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -44,7 +44,6 @@ enb* enb::get_instance() } void enb::cleanup() { - srslte_dft_exit(); pthread_mutex_lock(&enb_instance_mutex); if (nullptr != instance) { delete instance; @@ -58,8 +57,6 @@ enb::enb() : started(false), pool(srslte::byte_buffer_pool::get_instance(ENB_POO { // print build info std::cout << std::endl << get_build_string() << std::endl; - - srslte_dft_load(); } enb::~enb() {} diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index a100105fa..f01519e55 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -40,13 +40,6 @@ ue::ue() : logger(nullptr) { // print build info std::cout << std::endl << get_build_string() << std::endl; - - // load FFTW wisdom - srslte_dft_load(); - - // save FFTW wisdom when UE exits - atexit(srslte_dft_exit); - pool = byte_buffer_pool::get_instance(); } diff --git a/srsue/test/phy/scell_search_test.cc b/srsue/test/phy/scell_search_test.cc index 274961529..5106d97e8 100644 --- a/srsue/test/phy/scell_search_test.cc +++ b/srsue/test/phy/scell_search_test.cc @@ -370,7 +370,6 @@ int main(int argc, char** argv) return SRSLTE_ERROR; } - srslte_dft_load(); // Common for simulation and over-the-air auto baseband_buffer = (cf_t*)srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_MAX); @@ -640,8 +639,6 @@ int main(int argc, char** argv) } } - atexit(srslte_dft_exit); - if (ret) { printf("Error\n"); } else {