|
|
|
@ -26,8 +26,9 @@ bool zf_solver = false;
|
|
|
|
|
bool mmse_solver = false;
|
|
|
|
|
bool verbose = false;
|
|
|
|
|
|
|
|
|
|
static uint32_t nof_repetitions = 1;
|
|
|
|
|
|
|
|
|
|
#define MAX_MSE (1e-3)
|
|
|
|
|
#define NOF_REPETITIONS (1024)
|
|
|
|
|
#define MAX_FUNCTIONS (64)
|
|
|
|
|
#define MAX_BLOCKS (16)
|
|
|
|
|
|
|
|
|
@ -37,8 +38,11 @@ static srslte_random_t random_h = NULL;
|
|
|
|
|
#define RANDOM_B() ((int8_t)srslte_random_uniform_int_dist(random_h, -127, +127))
|
|
|
|
|
#define RANDOM_CF() srslte_random_uniform_complex_dist(random_h, -1.0f, +1.0f)
|
|
|
|
|
|
|
|
|
|
#define TEST_CALL(TEST_CODE) gettimeofday(&start, NULL);\
|
|
|
|
|
for (int i = 0; i < NOF_REPETITIONS; i++){TEST_CODE;}\
|
|
|
|
|
#define TEST_CALL(TEST_CODE) \
|
|
|
|
|
gettimeofday(&start, NULL); \
|
|
|
|
|
for (int i = 0; i < nof_repetitions; i++) { \
|
|
|
|
|
TEST_CODE; \
|
|
|
|
|
} \
|
|
|
|
|
gettimeofday(&end, NULL); \
|
|
|
|
|
*timing = elapsed_us(&start, &end);
|
|
|
|
|
|
|
|
|
@ -56,7 +60,7 @@ static srslte_random_t random_h = NULL;
|
|
|
|
|
printf("%32s (%5d) ... %7.1f MSamp/s ... %3s Passed (%.6f)\n", \
|
|
|
|
|
func_name, \
|
|
|
|
|
block_size, \
|
|
|
|
|
(double)block_size* NOF_REPETITIONS / *timing, \
|
|
|
|
|
(double)block_size* nof_repetitions / *timing, \
|
|
|
|
|
passed ? "" : "Not", \
|
|
|
|
|
mse); \
|
|
|
|
|
return passed; \
|
|
|
|
@ -104,30 +108,21 @@ float squared_error (cf_t a, cf_t b) {
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_acc_ff,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
float z;
|
|
|
|
|
TEST(srslte_vec_acc_ff, MALLOC(float, x); float z = 0;
|
|
|
|
|
|
|
|
|
|
cf_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_F();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_F(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(z = srslte_vec_acc_ff(x, block_size))
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold += x[i];
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { gold += x[i]; }
|
|
|
|
|
|
|
|
|
|
mse += fabs(gold - z) / gold;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
)
|
|
|
|
|
free(x);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_dot_prod_sss,
|
|
|
|
|
MALLOC(int16_t, x);
|
|
|
|
|
MALLOC(int16_t, y);
|
|
|
|
|
int16_t z;
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_dot_prod_sss, MALLOC(int16_t, x); MALLOC(int16_t, y); int16_t z = 0;
|
|
|
|
|
|
|
|
|
|
int16_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -137,20 +132,15 @@ TEST(srslte_vec_dot_prod_sss,
|
|
|
|
|
|
|
|
|
|
TEST_CALL(z = srslte_vec_dot_prod_sss(x, y, block_size))
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold += x[i] * y[i];
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { gold += x[i] * y[i]; }
|
|
|
|
|
|
|
|
|
|
mse = (gold - z) / abs(gold);
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
)
|
|
|
|
|
free(y);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sum_sss,
|
|
|
|
|
MALLOC(int16_t, x);
|
|
|
|
|
MALLOC(int16_t, y);
|
|
|
|
|
MALLOC(int16_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_sum_sss, MALLOC(int16_t, x); MALLOC(int16_t, y); MALLOC(int16_t, z);
|
|
|
|
|
|
|
|
|
|
int16_t gold = 0;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -167,13 +157,10 @@ TEST(srslte_vec_sum_sss,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sub_sss,
|
|
|
|
|
MALLOC(int16_t, x);
|
|
|
|
|
MALLOC(int16_t, y);
|
|
|
|
|
MALLOC(int16_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_sub_sss, MALLOC(int16_t, x); MALLOC(int16_t, y); MALLOC(int16_t, z);
|
|
|
|
|
|
|
|
|
|
int16_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -190,13 +177,10 @@ TEST(srslte_vec_sub_sss,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_prod_sss,
|
|
|
|
|
MALLOC(int16_t, x);
|
|
|
|
|
MALLOC(int16_t, y);
|
|
|
|
|
MALLOC(int16_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_prod_sss, MALLOC(int16_t, x); MALLOC(int16_t, y); MALLOC(int16_t, z);
|
|
|
|
|
|
|
|
|
|
int16_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -213,18 +197,17 @@ TEST(srslte_vec_prod_sss,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_neg_sss,
|
|
|
|
|
MALLOC(int16_t, x);
|
|
|
|
|
MALLOC(int16_t, y);
|
|
|
|
|
MALLOC(int16_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_neg_sss, MALLOC(int16_t, x); MALLOC(int16_t, y); MALLOC(int16_t, z);
|
|
|
|
|
|
|
|
|
|
int16_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_S();
|
|
|
|
|
do { y[i] = RANDOM_S(); } while (!y[i]);
|
|
|
|
|
do {
|
|
|
|
|
y[i] = RANDOM_S();
|
|
|
|
|
} while (!y[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_neg_sss(x, y, z, block_size))
|
|
|
|
@ -236,34 +219,23 @@ TEST(srslte_vec_neg_sss,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_acc_cc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
cf_t z;
|
|
|
|
|
TEST(srslte_vec_acc_cc, MALLOC(cf_t, x); cf_t z = 0.0f;
|
|
|
|
|
|
|
|
|
|
cf_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_F();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_F(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(z = srslte_vec_acc_cc(x, block_size))
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold += x[i];
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { gold += x[i]; }
|
|
|
|
|
|
|
|
|
|
mse += cabsf(gold - z) / cabsf(gold);
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
free(x);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sum_fff,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
MALLOC(float, y);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_sum_fff, MALLOC(float, x); MALLOC(float, y); MALLOC(float, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -280,13 +252,10 @@ TEST(srslte_vec_sum_fff,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sub_fff,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
MALLOC(float, y);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_sub_fff, MALLOC(float, x); MALLOC(float, y); MALLOC(float, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -303,13 +272,10 @@ TEST(srslte_vec_sub_fff,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_dot_prod_ccc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, y);
|
|
|
|
|
cf_t z;
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_dot_prod_ccc, MALLOC(cf_t, x); MALLOC(cf_t, y); cf_t z = 0.0f;
|
|
|
|
|
|
|
|
|
|
cf_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -319,20 +285,15 @@ TEST(srslte_vec_dot_prod_ccc,
|
|
|
|
|
|
|
|
|
|
TEST_CALL(z = srslte_vec_dot_prod_ccc(x, y, block_size))
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold += x[i] * y[i];
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { gold += x[i] * y[i]; }
|
|
|
|
|
|
|
|
|
|
mse = cabsf(gold - z) / cabsf(gold);
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
)
|
|
|
|
|
free(y);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_dot_prod_conj_ccc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, y);
|
|
|
|
|
cf_t z;
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_dot_prod_conj_ccc, MALLOC(cf_t, x); MALLOC(cf_t, y); cf_t z = 0.0f;
|
|
|
|
|
|
|
|
|
|
cf_t gold = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -342,20 +303,15 @@ TEST(srslte_vec_dot_prod_conj_ccc,
|
|
|
|
|
|
|
|
|
|
TEST_CALL(z = srslte_vec_dot_prod_conj_ccc(x, y, block_size))
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold += x[i] * conjf(y[i]);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { gold += x[i] * conjf(y[i]); }
|
|
|
|
|
|
|
|
|
|
mse = cabsf(gold - z) / cabsf(gold);
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
)
|
|
|
|
|
free(y);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_prod_ccc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, y);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_prod_ccc, MALLOC(cf_t, x); MALLOC(cf_t, y); MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -372,14 +328,10 @@ TEST(srslte_vec_prod_ccc,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_prod_ccc_split,
|
|
|
|
|
MALLOC(float, x_re);
|
|
|
|
|
MALLOC(float, x_im);
|
|
|
|
|
MALLOC(float, y_re);
|
|
|
|
|
MALLOC(float, y_im);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_prod_ccc_split, MALLOC(float, x_re); MALLOC(float, x_im); MALLOC(float, y_re); MALLOC(float, y_im);
|
|
|
|
|
MALLOC(float, z_re);
|
|
|
|
|
MALLOC(float, z_im);
|
|
|
|
|
|
|
|
|
@ -403,13 +355,10 @@ TEST(srslte_vec_prod_ccc_split,
|
|
|
|
|
free(y_re);
|
|
|
|
|
free(y_im);
|
|
|
|
|
free(z_re);
|
|
|
|
|
free(z_im);
|
|
|
|
|
)
|
|
|
|
|
free(z_im);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_prod_conj_ccc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, y);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_prod_conj_ccc, MALLOC(cf_t, x); MALLOC(cf_t, y); MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -426,18 +375,12 @@ TEST(srslte_vec_prod_conj_ccc,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sc_prod_ccc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
cf_t y = RANDOM_CF();
|
|
|
|
|
TEST(srslte_vec_sc_prod_ccc, MALLOC(cf_t, x); MALLOC(cf_t, z); cf_t y = RANDOM_CF();
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_sc_prod_ccc(x, y, z, block_size))
|
|
|
|
|
|
|
|
|
@ -447,18 +390,12 @@ TEST(srslte_vec_sc_prod_ccc,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_convert_fi,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
MALLOC(short, z);
|
|
|
|
|
float scale = 1000.0f;
|
|
|
|
|
TEST(srslte_vec_convert_fi, MALLOC(float, x); MALLOC(short, z); float scale = 1000.0f;
|
|
|
|
|
|
|
|
|
|
short gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = (float) RANDOM_F();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = (float)RANDOM_F(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_convert_fi(x, scale, z, block_size))
|
|
|
|
|
|
|
|
|
@ -471,19 +408,13 @@ TEST(srslte_vec_convert_fi,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_convert_if,
|
|
|
|
|
MALLOC(int16_t, x);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
float scale = 1000.0f;
|
|
|
|
|
TEST(srslte_vec_convert_if, MALLOC(int16_t, x); MALLOC(float, z); float scale = 1000.0f;
|
|
|
|
|
|
|
|
|
|
float gold;
|
|
|
|
|
float k = 1.0f / scale;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = (int16_t) RANDOM_S();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = (int16_t)RANDOM_S(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_convert_if(x, scale, z, block_size))
|
|
|
|
|
|
|
|
|
@ -496,8 +427,7 @@ TEST(srslte_vec_convert_if,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_prod_fff, MALLOC(float, x); MALLOC(float, y); MALLOC(float, z);
|
|
|
|
@ -525,10 +455,8 @@ TEST(
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_prod_cfc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(float, y);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_prod_cfc, MALLOC(cf_t, x); MALLOC(float, y); MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -545,18 +473,12 @@ TEST(srslte_vec_prod_cfc,
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sc_prod_fff,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
float y = RANDOM_F();
|
|
|
|
|
TEST(srslte_vec_sc_prod_fff, MALLOC(float, x); MALLOC(float, z); float y = RANDOM_F();
|
|
|
|
|
|
|
|
|
|
float gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_sc_prod_fff(x, y, z, block_size))
|
|
|
|
|
|
|
|
|
@ -566,18 +488,12 @@ TEST(srslte_vec_sc_prod_fff,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_abs_cf,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
float gold;
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_abs_cf, MALLOC(cf_t, x); MALLOC(float, z); float gold;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
x[0] = 0.0f;
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); } x[0] = 0.0f;
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_abs_cf(x, z, block_size))
|
|
|
|
|
|
|
|
|
@ -587,17 +503,11 @@ TEST(srslte_vec_abs_cf,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_abs_square_cf,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
float gold;
|
|
|
|
|
TEST(srslte_vec_abs_square_cf, MALLOC(cf_t, x); MALLOC(float, z); float gold;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_abs_square_cf(x, z, block_size))
|
|
|
|
|
|
|
|
|
@ -607,18 +517,11 @@ TEST(srslte_vec_abs_square_cf,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_sc_prod_cfc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
cf_t gold;
|
|
|
|
|
float h = RANDOM_F();
|
|
|
|
|
TEST(srslte_vec_sc_prod_cfc, MALLOC(cf_t, x); MALLOC(cf_t, z); cf_t gold; float h = RANDOM_F();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_sc_prod_cfc(x, h, z, block_size))
|
|
|
|
|
|
|
|
|
@ -628,13 +531,10 @@ TEST(srslte_vec_sc_prod_cfc,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_div_ccc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, y);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_div_ccc, MALLOC(cf_t, x); MALLOC(cf_t, y); MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -647,19 +547,14 @@ TEST(srslte_vec_div_ccc,
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold = x[i] / y[i];
|
|
|
|
|
mse += cabsf(gold - z[i]) / cabsf(gold);
|
|
|
|
|
}
|
|
|
|
|
mse /= block_size;
|
|
|
|
|
} mse /= block_size;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_div_cfc,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(float, y);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_div_cfc, MALLOC(cf_t, x); MALLOC(float, y); MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -672,19 +567,14 @@ TEST(srslte_vec_div_cfc,
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold = x[i] / y[i];
|
|
|
|
|
mse += cabsf(gold - z[i]) / cabsf(gold);
|
|
|
|
|
}
|
|
|
|
|
mse /= block_size;
|
|
|
|
|
} mse /= block_size;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_div_fff,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
MALLOC(float, y);
|
|
|
|
|
MALLOC(float, z);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_div_fff, MALLOC(float, x); MALLOC(float, y); MALLOC(float, z);
|
|
|
|
|
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
@ -697,20 +587,16 @@ TEST(srslte_vec_div_fff,
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold = x[i] / y[i];
|
|
|
|
|
mse += cabsf(gold - z[i]) / cabsf(gold);
|
|
|
|
|
}
|
|
|
|
|
mse /= block_size;
|
|
|
|
|
} mse /= block_size;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(y);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_max_fi,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_max_fi, MALLOC(float, x);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_F();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_F(); }
|
|
|
|
|
|
|
|
|
|
uint32_t max_index = 0;
|
|
|
|
|
TEST_CALL(max_index = srslte_vec_max_fi(x, block_size);)
|
|
|
|
@ -722,18 +608,14 @@ TEST(srslte_vec_max_fi,
|
|
|
|
|
gold_value = x[i];
|
|
|
|
|
gold_index = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mse = (gold_index != max_index) ? 1:0;
|
|
|
|
|
} mse = (gold_index != max_index) ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
)
|
|
|
|
|
free(x);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_max_abs_fi,
|
|
|
|
|
MALLOC(float, x);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_max_abs_fi, MALLOC(float, x);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_F();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_F(); }
|
|
|
|
|
|
|
|
|
|
uint32_t max_index = 0;
|
|
|
|
|
TEST_CALL(max_index = srslte_vec_max_abs_fi(x, block_size);)
|
|
|
|
@ -745,18 +627,14 @@ TEST(srslte_vec_max_abs_fi,
|
|
|
|
|
gold_value = fabsf(x[i]);
|
|
|
|
|
gold_index = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mse = (gold_index != max_index) ? 1:0;
|
|
|
|
|
} mse = (gold_index != max_index) ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
)
|
|
|
|
|
free(x);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_max_abs_ci,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_max_abs_ci, MALLOC(cf_t, x);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
uint32_t max_index = 0;
|
|
|
|
|
TEST_CALL(max_index = srslte_vec_max_abs_ci(x, block_size);)
|
|
|
|
@ -770,33 +648,25 @@ TEST(srslte_vec_max_abs_ci,
|
|
|
|
|
gold_value = abs2;
|
|
|
|
|
gold_index = (uint32_t)i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mse = (gold_index != max_index) ? 1:0;
|
|
|
|
|
} mse = (gold_index != max_index) ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
)
|
|
|
|
|
free(x);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_vec_apply_cfo,
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
TEST(srslte_vec_apply_cfo, MALLOC(cf_t, x); MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
const float cfo = 0.1f;
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
TEST_CALL(srslte_vec_apply_cfo(x, cfo, z, block_size))
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold = x[i] * cexpf(_Complex_I * 2.0f * (float)M_PI * i * cfo);
|
|
|
|
|
mse += cabsf(gold - z[i]) / cabsf(gold);
|
|
|
|
|
}
|
|
|
|
|
mse /= block_size;
|
|
|
|
|
} mse /= block_size;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
)
|
|
|
|
|
free(z);)
|
|
|
|
|
|
|
|
|
|
TEST(
|
|
|
|
|
srslte_vec_gen_sine, MALLOC(cf_t, z);
|
|
|
|
@ -824,17 +694,12 @@ TEST(srslte_vec_estimate_frequency, MALLOC(cf_t, x); float freq_gold = 0.1f; flo
|
|
|
|
|
|
|
|
|
|
free(x);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_cfo_correct,
|
|
|
|
|
srslte_cfo_t srslte_cfo;
|
|
|
|
|
bzero(&srslte_cfo, sizeof(srslte_cfo));
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
TEST(srslte_cfo_correct, srslte_cfo_t srslte_cfo; bzero(&srslte_cfo, sizeof(srslte_cfo)); MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
const float cfo = 0.1f;
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
srslte_cfo_init(&srslte_cfo, block_size);
|
|
|
|
|
|
|
|
|
@ -843,25 +708,18 @@ TEST(srslte_cfo_correct,
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold = x[i] * cexpf(_Complex_I * 2.0f * (float)M_PI * i * cfo);
|
|
|
|
|
mse += cabsf(gold - z[i]) / cabsf(gold);
|
|
|
|
|
}
|
|
|
|
|
mse /= block_size;
|
|
|
|
|
} mse /= block_size;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
srslte_cfo_free(&srslte_cfo);
|
|
|
|
|
)
|
|
|
|
|
srslte_cfo_free(&srslte_cfo);)
|
|
|
|
|
|
|
|
|
|
TEST(srslte_cfo_correct_change,
|
|
|
|
|
srslte_cfo_t srslte_cfo;
|
|
|
|
|
bzero(&srslte_cfo, sizeof(srslte_cfo));
|
|
|
|
|
MALLOC(cf_t, x);
|
|
|
|
|
TEST(srslte_cfo_correct_change, srslte_cfo_t srslte_cfo; bzero(&srslte_cfo, sizeof(srslte_cfo)); MALLOC(cf_t, x);
|
|
|
|
|
MALLOC(cf_t, z);
|
|
|
|
|
|
|
|
|
|
float cfo = 0.1f;
|
|
|
|
|
cf_t gold;
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
x[i] = RANDOM_CF();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < block_size; i++) { x[i] = RANDOM_CF(); }
|
|
|
|
|
|
|
|
|
|
srslte_cfo_init(&srslte_cfo, block_size);
|
|
|
|
|
|
|
|
|
@ -870,15 +728,14 @@ TEST(srslte_cfo_correct_change,
|
|
|
|
|
for (int i = 0; i < block_size; i++) {
|
|
|
|
|
gold = x[i] * cexpf(_Complex_I * 2.0f * (float)M_PI * i * cfo);
|
|
|
|
|
mse += cabsf(gold - z[i]) / cabsf(gold);
|
|
|
|
|
}
|
|
|
|
|
mse /= block_size;
|
|
|
|
|
} mse /= block_size;
|
|
|
|
|
|
|
|
|
|
free(x);
|
|
|
|
|
free(z);
|
|
|
|
|
srslte_cfo_free(&srslte_cfo);
|
|
|
|
|
)
|
|
|
|
|
srslte_cfo_free(&srslte_cfo);)
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
|
{
|
|
|
|
|
char func_names[MAX_FUNCTIONS][32];
|
|
|
|
|
double timmings[MAX_FUNCTIONS][MAX_BLOCKS];
|
|
|
|
|
uint32_t sizes[32];
|
|
|
|
@ -888,48 +745,63 @@ int main(int argc, char **argv) {
|
|
|
|
|
bool all_passed = true;
|
|
|
|
|
random_h = srslte_random_init(0x1234);
|
|
|
|
|
|
|
|
|
|
if (argc > 1) {
|
|
|
|
|
nof_repetitions = (uint32_t)strtol(argv[1], NULL, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (uint32_t block_size = 1; block_size <= 1024 * 32; block_size *= 2) {
|
|
|
|
|
func_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_xor_bbb(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_xor_bbb(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_acc_ff(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_acc_ff(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_dot_prod_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_dot_prod_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_sum_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_sum_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_sub_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_sub_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_prod_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_prod_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_neg_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_neg_sss(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_acc_cc(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_acc_cc(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_sum_fff(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_sum_fff(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_sub_fff(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_sub_fff(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_dot_prod_ccc(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_dot_prod_ccc(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_dot_prod_conj_ccc(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_dot_prod_conj_ccc(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_convert_fi(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
passed[func_count][size_count] =
|
|
|
|
|
test_srslte_vec_convert_fi(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
|
func_count++;
|
|
|
|
|
|
|
|
|
|
passed[func_count][size_count] = test_srslte_vec_convert_if(func_names[func_count], &timmings[func_count][size_count], block_size);
|
|
|
|
@ -1042,8 +914,11 @@ int main(int argc, char **argv) {
|
|
|
|
|
if (f) fprintf(f, "%s\t", func_names[i]);
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < size_count; j++) {
|
|
|
|
|
printf(" %s%7.1f\x1b[0m", (passed[i][j])?"":"\x1B[31m", (double) NOF_REPETITIONS*(double)sizes[j]/timmings[i][j]);
|
|
|
|
|
if (f) fprintf(f, "%.1f\t", (double) NOF_REPETITIONS*(double)sizes[j]/timmings[i][j]);
|
|
|
|
|
printf(" %s%7.1f\x1b[0m",
|
|
|
|
|
(passed[i][j]) ? "" : "\x1B[31m",
|
|
|
|
|
(double)nof_repetitions * (double)sizes[j] / timmings[i][j]);
|
|
|
|
|
if (f)
|
|
|
|
|
fprintf(f, "%.1f\t", (double)nof_repetitions * (double)sizes[j] / timmings[i][j]);
|
|
|
|
|
|
|
|
|
|
all_passed &= passed[i][j];
|
|
|
|
|
}
|
|
|
|
|