Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
c45aa6ce
Commit
c45aa6ce
authored
May 14, 2020
by
OpInConnect_NCTU Terngyin/NY/GK/KM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dual thread with parameterized pressure test
parent
96009882
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
56 deletions
+86
-56
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+4
-4
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+4
-4
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+3
-1
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+75
-47
No files found.
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
c45aa6ce
...
...
@@ -219,7 +219,7 @@ for (int q=0; q<thread_num_pdsch; q++){
gNB
->
multi_encoder
[
q
].
mod_symbs
=
mod_symbs
[
q
];
// ==Need to change ==***
}
//Get value for pressure
for
(
int
q
=
0
;
q
<
2
;
q
++
){
for
(
int
q
=
0
;
q
<
thread_num_pressure
;
q
++
){
//gNB->pressure_test[q].f = harq->f;
gNB
->
pressure_test
[
q
].
encoded_length
=
encoded_length
;
gNB
->
pressure_test
[
q
].
Nid
=
Nid
;
...
...
@@ -228,7 +228,7 @@ for (int q=0; q<2; q++){
gNB
->
pressure_test
[
q
].
Qm
=
Qm
;
//gNB->pressure_test[q].mod_symbs = mod_symbs[q]; // ==Need to change ==***
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
for
(
int
q
=
0
;
q
<
NR_MAX_NB_CODEWORDS
;
q
++
){
gNB
->
pressure_test
[
th
].
mod_symbs_test
[
q
]
=
(
int32_t
*
)
malloc16
(
NR_MAX_PDSCH_ENCODED_LENGTH
*
sizeof
(
int32_t
));
}
...
...
@@ -258,14 +258,14 @@ clock_gettime(CLOCK_MONOTONIC, &start_ts); //timing
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
q
].
cond_scr_mod
));
}
for
(
int
q
=
0
;
q
<
2
;
q
++
){
for
(
int
q
=
0
;
q
<
thread_num_pressure
;
q
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
q
].
cond_scr_mod
));
}
//Wait threads
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
while
(
gNB
->
multi_encoder
[
q
].
complete_scr_mod
!=
1
);
}
for
(
int
q
=
0
;
q
<
2
;
q
++
){
for
(
int
q
=
0
;
q
<
thread_num_pressure
;
q
++
){
while
(
gNB
->
pressure_test
[
q
].
complete_scr_mod
!=
1
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
c45aa6ce
...
...
@@ -455,14 +455,14 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
// dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
// dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
// }
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
for
(
int
j
=
0
;
j
<
MAX_NUM_NR_DLSCH_SEGMENTS
/
bw_scaling
;
j
++
){
// ==Why can not just be MAX_NUM_NR_DLSCH_SEGMENTS ==???
gNB
->
pressure_test
[
th
].
c_test
[
j
]
=
(
uint8_t
*
)
malloc16
(
8448
);
//(unsigned char *)malloc16(sizeof(unsigned char) * Kr/8);
gNB
->
pressure_test
[
th
].
d_test
[
j
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
//(unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
memcpy
(
gNB
->
pressure_test
[
th
].
c_test
[
j
],
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
j
],
8448
);
// ==Check 8448 ==***
}
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
//gNB->pressure_test[th].test_input = dlsch->harq_processes[harq_pid]->c;
//gNB->pressure_test[th].channel_input_optim = dlsch->harq_processes[harq_pid]->d;
gNB
->
pressure_test
[
th
].
Zc
=
*
Zc
;
...
...
@@ -492,13 +492,13 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
th
].
cond
));
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
th
].
cond
));
}
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
while
(
gNB
->
multi_encoder
[
th
].
complete
!=
1
);
// ==check if multi_ldpc_enc done ==
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
while
(
gNB
->
pressure_test
[
th
].
complete
!=
1
);
// ==check if multi_ldpc_enc done ==
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
...
...
openair1/PHY/defs_gNB.h
View file @
c45aa6ce
...
...
@@ -47,6 +47,8 @@
#define MAX_NUM_RU_PER_gNB MAX_NUM_RU_PER_eNB
#define thread_num_pdsch 2 // ==Change thread_num_pdsch here. Don't greater than 2 ==
#define thread_num_pressure 3 // ==Change thread_num_pressure here ==
#define check_time 0 // ==Change if you wnat to check time of threads ==
typedef
struct
{
/*params of thread*/
...
...
@@ -915,7 +917,7 @@ typedef struct PHY_VARS_gNB_s {
dlsch_encoding_ISIP
thread_encode
[
4
];
ldpc_encoding_ISIP
ldpc_encode
;
multi_ldpc_encoder_gNB
multi_encoder
[
thread_num_pdsch
];
multi_ldpc_encoder_gNB
pressure_test
[
2
];
multi_ldpc_encoder_gNB
pressure_test
[
thread_num_pressure
];
volatile
uint8_t
complete_encode
[
4
];
...
...
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
c45aa6ce
...
...
@@ -520,17 +520,17 @@ static void *modulation_proc(void *ptr){
}
/*! \file openair1/SIMULATION/NR_PHY/dlsim.c
* \brief dual thread for pdsch with pressure test
* \brief dual thread for pdsch with p
arameterized p
ressure test
* \author Terngyin Hsu, Sendren Xu, Nungyi Kuo, Kuankai Hsiung, Kaimi Yang (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 1
3
-05-2020
* \version 2.
3
* \date 1
4
-05-2020
* \version 2.
4
* \note
* \warning
*/
//[START]multi_genetate_pdsch_proc
struct
timespec
start_encoder_ts
[
thread_num_pdsch
],
end_encoder_ts
[
thread_num_pdsch
],
start_perenc_ts
[
thread_num_pdsch
],
end_perenc_ts
[
thread_num_pdsch
],
start_pressure_ts
[
2
],
end_pressure_ts
[
2
],
start_perpre_ts
[
2
],
end_perpre_ts
[
2
];
struct
timespec
start_encoder_ts
[
thread_num_pdsch
],
end_encoder_ts
[
thread_num_pdsch
],
start_perenc_ts
[
thread_num_pdsch
],
end_perenc_ts
[
thread_num_pdsch
],
start_pressure_ts
[
thread_num_pressure
],
end_pressure_ts
[
thread_num_pressure
],
start_perpre_ts
[
thread_num_pressure
],
end_perpre_ts
[
thread_num_pressure
];
//int thread_num_pdsch = 2; //Craete 2 threads for temp
// int ifRand = 0;
int
vcd
=
0
;
...
...
@@ -566,11 +566,13 @@ static void *multi_genetate_pdsch_proc(void *ptr){
int
offset
=
test
->
id
>
7
?
7
:
test
->
id
;
//printf("[OFFSET] : %d %d\n", offset, test->id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
if
(
check_time
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_encoder_ts
[
test
->
id
]);
//timing
for
(
int
j
=
j_start
;
j
<
j_end
;
j
++
){
//printf(" Movement No. Round Cost time \n");
if
(
check_time
){
printf
(
" Active %d %d
\n
"
,
test
->
id
,
j
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perenc_ts
[
test
->
id
]);
//timing
}
ldpc_encoder_optim_8seg_multi
(
gNB
->
multi_encoder
[
test
->
id
].
test_input
,
//gNB->multi_encoder[0].c_test,
gNB
->
multi_encoder
[
test
->
id
].
channel_input_optim
,
//gNB->multi_encoder[0].d_test,
gNB
->
multi_encoder
[
test
->
id
].
Zc
,
...
...
@@ -580,21 +582,27 @@ static void *multi_genetate_pdsch_proc(void *ptr){
gNB
->
multi_encoder
[
test
->
id
].
n_segments
,
j
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perenc_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d %d %.2f usec
\n
"
,
test
->
id
,
j
,
(
end_perenc_ts
[
test
->
id
].
tv_nsec
-
start_perenc_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
}
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_encoder_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d %.2f usec
\n
"
,
test
->
id
,
(
end_encoder_ts
[
test
->
id
].
tv_nsec
-
start_encoder_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
gNB
->
multi_encoder
[
test
->
id
].
complete
=
1
;
//==================================================
while
(
pthread_cond_wait
(
&
(
gNB
->
multi_encoder
[
test
->
id
].
cond_scr_mod
),
&
(
gNB
->
multi_encoder
[
test
->
id
].
mutex_scr_mod
))
!=
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
if
(
check_time
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_encoder_ts
[
test
->
id
]);
//timing
for
(
int
q
=
0
;
q
<
1
;
q
++
){
//Need to change by codewords
if
(
check_time
){
printf
(
" Active %d %d
\n
"
,
test
->
id
,
q
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perenc_ts
[
test
->
id
]);
//timing
}
nr_pdsch_codeword_scrambling
(
gNB
->
multi_encoder
[
test
->
id
].
f
,
gNB
->
multi_encoder
[
test
->
id
].
encoded_length
,
q
,
...
...
@@ -605,13 +613,16 @@ static void *multi_genetate_pdsch_proc(void *ptr){
gNB
->
multi_encoder
[
test
->
id
].
encoded_length
,
gNB
->
multi_encoder
[
test
->
id
].
Qm
,
gNB
->
multi_encoder
[
test
->
id
].
mod_symbs
);
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perenc_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d %d %.2f usec
\n
"
,
test
->
id
,
q
,
(
end_perenc_ts
[
test
->
id
].
tv_nsec
-
start_perenc_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
}
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_encoder_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d %.2f usec
\n
"
,
test
->
id
,
(
end_encoder_ts
[
test
->
id
].
tv_nsec
-
start_encoder_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
gNB
->
multi_encoder
[
test
->
id
].
complete_scr_mod
=
1
;
}
return
0
;
...
...
@@ -637,19 +648,27 @@ static void *multi_genetate_pdsch_pressure(void *ptr){
// ldpc_enc[test->id].block_length,
// ldpc_enc[test->id].n_segments);
int
j_start
,
j_end
;
int
j_start
,
j_end
;
//Check if our situation((n_segments > 7)&(thread_num_pdsch == 2))
if
((
gNB
->
pressure_test
[
test
->
id
].
n_segments
>
7
)
&&
(
thread_num_pdsch
==
2
)){
j_start
=
test
->
id
;
j_end
=
j_start
+
1
;
}
else
{
j_start
=
0
;
j_end
=
(
gNB
->
pressure_test
[
test
->
id
].
n_segments
/
8
+
1
);
}
int
offset
=
test
->
id
+
thread_num_pdsch
;
if
(
offset
>
7
){
offset
=
7
;
}
//printf("[OFFSET] : %d %d\n", offset, test->id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
if
(
check_time
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_pressure_ts
[
test
->
id
]);
//timing
for
(
int
j
=
j_start
;
j
<
j_end
;
j
++
){
if
(
check_time
){
printf
(
" Active %d(p) %d
\n
"
,
test
->
id
,
j
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perpre_ts
[
test
->
id
]);
//timing
}
ldpc_encoder_optim_8seg_multi
(
gNB
->
pressure_test
[
test
->
id
].
c_test
,
gNB
->
pressure_test
[
test
->
id
].
d_test
,
gNB
->
pressure_test
[
test
->
id
].
Zc
,
...
...
@@ -659,21 +678,27 @@ static void *multi_genetate_pdsch_pressure(void *ptr){
gNB
->
pressure_test
[
test
->
id
].
n_segments
,
j
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perpre_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d(p) %d %.2f usec
\n
"
,
test
->
id
,
j
,
(
end_perpre_ts
[
test
->
id
].
tv_nsec
-
start_perpre_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
}
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_pressure_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d(p) %.2f usec
\n
"
,
test
->
id
,
(
end_pressure_ts
[
test
->
id
].
tv_nsec
-
start_pressure_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
gNB
->
pressure_test
[
test
->
id
].
complete
=
1
;
//==================================================
while
(
pthread_cond_wait
(
&
(
gNB
->
pressure_test
[
test
->
id
].
cond_scr_mod
),
&
(
gNB
->
pressure_test
[
test
->
id
].
mutex_scr_mod
))
!=
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
if
(
check_time
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_pressure_ts
[
test
->
id
]);
//timing
for
(
int
q
=
0
;
q
<
1
;
q
++
){
//Need to change by codewords
if
(
check_time
){
printf
(
" Active %d(p) %d
\n
"
,
test
->
id
,
q
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perpre_ts
[
test
->
id
]);
//timing
}
nr_pdsch_codeword_scrambling
(
gNB
->
pressure_test
[
test
->
id
].
f_test
,
gNB
->
pressure_test
[
test
->
id
].
encoded_length
,
q
,
...
...
@@ -684,13 +709,16 @@ static void *multi_genetate_pdsch_pressure(void *ptr){
gNB
->
pressure_test
[
test
->
id
].
encoded_length
,
gNB
->
pressure_test
[
test
->
id
].
Qm
,
gNB
->
pressure_test
[
test
->
id
].
mod_symbs_test
);
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perpre_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d(p) %d %.2f usec
\n
"
,
test
->
id
,
q
,
(
end_perpre_ts
[
test
->
id
].
tv_nsec
-
start_perpre_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
}
if
(
check_time
){
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_pressure_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d(p) %.2f usec
\n
"
,
test
->
id
,
(
end_pressure_ts
[
test
->
id
].
tv_nsec
-
start_pressure_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
gNB
->
pressure_test
[
test
->
id
].
complete_scr_mod
=
1
;
}
return
0
;
...
...
@@ -1162,7 +1190,7 @@ int main(int argc, char **argv)
pthread_create
(
&
(
gNB
->
multi_encoder
[
th
].
pthread
),
&
(
gNB
->
multi_encoder
[
th
].
attr
),
multi_genetate_pdsch_proc
,
&
(
gNB
->
multi_encoder
[
th
]));
printf
(
"[CREATE] LDPC encoder thread %d
\n
"
,
gNB
->
multi_encoder
[
th
].
id
);
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
pthread_attr_init
(
&
(
gNB
->
pressure_test
[
th
].
attr
));
pthread_mutex_init
(
&
(
gNB
->
pressure_test
[
th
].
mutex
),
NULL
);
pthread_mutex_init
(
&
(
gNB
->
pressure_test
[
th
].
mutex_scr_mod
),
NULL
);
...
...
@@ -1530,12 +1558,12 @@ int main(int argc, char **argv)
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
th
].
cond
));
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
th
].
cond
));
}
//free memorys
unsigned
char
bw_scaling
=
2
;
// ==Need to change ==***
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
for
(
int
j
=
0
;
j
<
MAX_NUM_NR_DLSCH_SEGMENTS
/
bw_scaling
;
j
++
){
free
(
gNB
->
pressure_test
[
th
].
c_test
[
j
]);
free
(
gNB
->
pressure_test
[
th
].
d_test
[
j
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment