srsLTE: FFTW wisdom gets loaded and saved by default

This commit is contained in:
Xavier Arteaga 2019-12-20 16:37:18 +01:00 committed by Andre Puschmann
parent 892ece8cdd
commit 11eafa8ab4
31 changed files with 4 additions and 49 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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];

View File

@ -182,7 +182,6 @@ int main(int argc, char** argv)
n_prb++;
}
srslte_dft_exit();
exit(0);
}

View File

@ -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) {

View File

@ -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)) {

View File

@ -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");

View File

@ -158,6 +158,5 @@ int main(int argc, char** argv)
free(slot_symbols[i]);
}
printf("OK\n");
srslte_dft_exit();
exit(0);
}

View File

@ -283,6 +283,5 @@ int main(int argc, char** argv)
} while (frame_cnt <= max_frames);
base_free();
srslte_dft_exit();
exit(ret);
}

View File

@ -410,6 +410,5 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

View File

@ -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) {

View File

@ -588,6 +588,5 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

View File

@ -282,7 +282,6 @@ int main(int argc, char** argv)
}
base_free();
srslte_dft_exit();
if (n < 0) {
ERROR("Error decoding phich\n");

View File

@ -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);
}

View File

@ -229,7 +229,6 @@ int main(int argc, char** argv)
if (data != NULL) {
free(data);
}
srslte_dft_exit();
if (ret >= 0) {
exit(0);
} else {

View File

@ -438,7 +438,6 @@ quit:
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

View File

@ -118,7 +118,6 @@ int main(int argc, char** argv)
}
srslte_prach_free(&prach);
srslte_dft_exit();
printf("Done\n");
exit(0);

View File

@ -139,7 +139,6 @@ int main(int argc, char** argv)
}
srslte_prach_free(&prach);
srslte_dft_exit();
printf("Done\n");
exit(0);
}

View File

@ -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);

View File

@ -259,6 +259,5 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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");

View File

@ -224,7 +224,6 @@ exit:
free(fft_buffer);
}
srslte_dft_exit();
return ret;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -699,6 +699,5 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

View File

@ -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() {}

View File

@ -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();
}

View File

@ -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 {