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
spbro
OpenXG-RAN
Commits
bacf3537
Commit
bacf3537
authored
Dec 22, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/fix-seed-physim-script' into integration_2022_wk51
parents
1af5062b
8cacbb88
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
97 additions
and
187 deletions
+97
-187
CMakeLists.txt
CMakeLists.txt
+27
-37
cmake_targets/autotests/run_exec_autotests.bash
cmake_targets/autotests/run_exec_autotests.bash
+1
-0
docker/Dockerfile.lteUE.rhel8.2
docker/Dockerfile.lteUE.rhel8.2
+0
-1
docker/Dockerfile.lteUE.ubuntu18
docker/Dockerfile.lteUE.ubuntu18
+0
-1
docker/Dockerfile.phySim.rhel8.2
docker/Dockerfile.phySim.rhel8.2
+0
-1
openair1/SIMULATION/RF/rf.c
openair1/SIMULATION/RF/rf.c
+0
-14
openair1/SIMULATION/TOOLS/rangen_double.c
openair1/SIMULATION/TOOLS/rangen_double.c
+56
-42
openair1/SIMULATION/TOOLS/sim.h
openair1/SIMULATION/TOOLS/sim.h
+2
-1
openair1/SIMULATION/TOOLS/taus.c
openair1/SIMULATION/TOOLS/taus.c
+4
-15
openair2/UTIL/MATH/random.c
openair2/UTIL/MATH/random.c
+0
-74
openair3/ocp-gtpu/gtp_itf.cpp
openair3/ocp-gtpu/gtp_itf.cpp
+7
-1
No files found.
CMakeLists.txt
View file @
bacf3537
This diff is collapsed.
Click to expand it.
cmake_targets/autotests/run_exec_autotests.bash
View file @
bacf3537
...
...
@@ -114,6 +114,7 @@ function test_run() {
for
((
run_index
=
1
;
run_index <
=
$nruns
;
run_index++
))
do
temp_exec_log
=
"
$log_dir
/test.
$test_case_name
.
${
tags_array
[
$tags_array_index
]
}
.run_
$run_index
"
echo
"</EXECUTION LOG Test Case =
$test_case_name
.
${
tags_array
[
$tags_array_index
]
}
, Run =
$run_index
>"
>>
$temp_exec_log
2>&1
cat
"
$temp_exec_log
"
>>
"
$log_file
"
2>&1
...
...
docker/Dockerfile.lteUE.rhel8.2
View file @
bacf3537
...
...
@@ -70,7 +70,6 @@ COPY --from=lte-ue-build \
/oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \
/oai-ran/cmake_targets/ran_build/build/libcoding.so \
/oai-ran/cmake_targets/ran_build/build/libparams_libconfig.so \
/oai-ran/cmake_targets/ran_build/build/libSIMU.so \
/oai-ran/cmake_targets/ran_build/build/libdfts.so \
/oai-ran/cmake_targets/ran_build/build/libtelnetsrv.so \
/usr/local/lib/
...
...
docker/Dockerfile.lteUE.ubuntu18
View file @
bacf3537
...
...
@@ -76,7 +76,6 @@ COPY --from=lte-ue-build \
/oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \
/oai-ran/cmake_targets/ran_build/build/libcoding.so \
/oai-ran/cmake_targets/ran_build/build/libparams_libconfig.so \
/oai-ran/cmake_targets/ran_build/build/libSIMU.so \
/oai-ran/cmake_targets/ran_build/build/libdfts.so \
/oai-ran/cmake_targets/ran_build/build/libtelnetsrv.so \
/usr/local/lib/
...
...
docker/Dockerfile.phySim.rhel8.2
View file @
bacf3537
...
...
@@ -89,7 +89,6 @@ COPY --from=phy-sim-build \
/lib64/libxslt.so.1 \
/usr/lib64/libasan.so.5 \
/oai-ran/cmake_targets/ran_build/build/libdfts.so \
/oai-ran/cmake_targets/ran_build/build/libSIMU.so \
/oai-ran/cmake_targets/ran_build/build/libldpc.so \
/oai-ran/cmake_targets/ran_build/build/libldpc_orig.so \
/usr/local/lib/
...
...
openair1/SIMULATION/RF/rf.c
View file @
bacf3537
...
...
@@ -26,21 +26,7 @@
//#include "PHY/defs.h"
#include "SIMULATION/TOOLS/sim.h"
#include "rf.h"
/*
extern void randominit(void);
extern double gaussdouble(double,double);
//free(input_data);
//extern int LOG_M(const char *,const char *,void *,int,int,char);
//flag change
extern int LOG_M(const char *,const char *,void *,int,int,char);
*/
//double pn[1024];
//#define DEBUG_RF 1
//free(input_data);
void
rf_rx
(
double
**
r_re
,
double
**
r_im
,
double
**
r_re_i1
,
...
...
openair1/SIMULATION/TOOLS/rangen_double.c
View file @
bacf3537
...
...
@@ -26,57 +26,67 @@
#include "sim.h"
static
unsigned
int
seed
,
iy
,
ir
[
98
];
/*
@defgroup _uniformdouble
@ingroup numerical Uniform linear congruential random number generator.
*/
/*!\brief Initialization routine for Uniform/Gaussian random number generators. */
#define a 1664525lu
#define mod 4294967296.0
/* is 2**32 */
static
unsigned
int
urseed
,
iy
,
ir
[
98
];
/// uniformrandom
static
bool
tableNordDone
=
false
;
/// gaussZiggurat
#if 1
void
randominit
(
unsigned
seed_init
)
/*!\brief Generate a random number form `/dev/urandom`. */
void
fill_random
(
void
*
buf
,
size_t
sz
)
{
int
i
;
// this need to be integrated with the existing rng, like taus: navid
if
(
seed_init
==
0
)
{
srand
((
unsigned
)
time
(
NULL
));
seed
=
(
unsigned
int
)
rand
();
}
else
{
seed
=
seed_init
;
const
char
*
fn
=
"/dev/urandom"
;
FILE
*
f
=
fopen
(
fn
,
"rb"
);
if
(
f
==
NULL
)
{
fprintf
(
stderr
,
"could not open %s for seed generation: %d %s
\n
"
,
fn
,
errno
,
strerror
(
errno
));
abort
();
}
printf
(
"Initializing random number generator, seed %x
\n
"
,
seed
);
int
rc
=
fread
(
buf
,
sz
,
1
,
f
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"could not read %s for seed generation: %d %s
\n
"
,
fn
,
errno
,
strerror
(
errno
));
abort
();
}
fclose
(
f
);
}
if
(
seed
%
2
==
0
)
seed
+=
1
;
/* seed and mod are relative prime */
static
const
unsigned
int
a
=
1664525lu
;
for
(
i
=
1
;
i
<=
97
;
i
++
)
{
seed
=
a
*
seed
;
/* mod 2**32 */
ir
[
i
]
=
seed
;
/* initialize the shuffle table */
/*!\brief Initialization routine for Uniform/Gaussian random number generators. */
void
randominit
(
unsigned
long
seed_init
)
{
unsigned
long
seed
=
seed_init
;
if
(
seed_init
==
0
)
fill_random
(
&
seed
,
sizeof
(
seed
));
printf
(
"Initializing random number generator, seed %ld
\n
"
,
seed
);
// initialize uniformrandom RNG
urseed
=
(
unsigned
int
)
seed
;
if
(
urseed
%
2
==
0
)
urseed
+=
1
;
/* urseed and mod are relative prime */
for
(
int
i
=
1
;
i
<=
97
;
i
++
)
{
urseed
=
a
*
urseed
;
/* mod 2**32 */
ir
[
i
]
=
urseed
;
/* initialize the shuffle table */
}
iy
=
1
;
iy
=
1
;
// initialize gaussZiggurat RNG
tableNor
(
seed
);
tableNordDone
=
true
;
}
#endif
/*
@defgroup _uniformdouble
@ingroup numerical Uniform linear congruential random number generator.
*/
/*!\brief Uniform linear congruential random number generator on \f$[0,1)\f$. Returns a double-precision floating-point number.*/
double
uniformrandom
(
void
)
{
#define a 1664525lu
#define mod 4294967296.0
/* is 2**32 */
int
j
;
j
=
1
+
97
.
0
*
iy
/
mod
;
iy
=
ir
[
j
];
seed
=
a
*
seed
;
/* mod 2**32 */
ir
[
j
]
=
seed
;
return
(
(
double
)
iy
/
mod
);
const
double
mod
=
4294967296
.
0
;
/* is 2**32 */
int
j
=
1
+
97
.
0
*
iy
/
mod
;
iy
=
ir
[
j
];
urseed
=
a
*
urseed
;
/* mod 2**32 */
ir
[
j
]
=
urseed
;
return
(
double
)
iy
/
mod
;
}
/*
...
...
@@ -109,8 +119,12 @@ double __attribute__ ((no_sanitize_address)) gaussdouble(double mean, double var
}
}
/*
@defgroup _gaussZiggurat
@ingroup numerical ziggurat random number generator for exponentially distributed numbers
*/
// Ziggurat
static
bool
tableNordDone
=
false
;
static
double
wn
[
128
],
fn
[
128
];
static
uint32_t
iz
,
jz
,
jsr
=
123456789
,
kn
[
128
];
static
int32_t
hz
;
...
...
@@ -180,9 +194,9 @@ double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double v
{
if
(
!
tableNordDone
)
{
// let's make reasonnable constant tables
struct
timespec
t
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
t
);
tableNor
(
(
long
)(
t
.
tv_nsec
%
INT_MAX
)
);
unsigned
long
seed
;
fill_random
(
&
seed
,
sizeof
(
seed
)
);
tableNor
(
seed
);
}
hz
=
SHR3
;
iz
=
hz
&
127
;
...
...
openair1/SIMULATION/TOOLS/sim.h
View file @
bacf3537
...
...
@@ -523,8 +523,9 @@ the value \f$\mathrm{sgn}(u)i\f$. The search requires at most \f$Nbits-1\f$ com
*/
int
gauss
(
unsigned
int
*
gauss_LUT
,
unsigned
char
Nbits
);
void
fill_random
(
void
*
buf
,
size_t
sz
);
double
gaussdouble
(
double
,
double
);
void
randominit
(
unsigned
int
seed_init
);
void
randominit
(
unsigned
long
seed_init
);
double
uniformrandom
(
void
);
double
gaussZiggurat
(
double
mean
,
double
variance
);
void
tableNor
(
unsigned
long
seed
);
...
...
openair1/SIMULATION/TOOLS/taus.c
View file @
bacf3537
...
...
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
//#include "SIMULATION/TOOLS/
sim.h"
#include "
sim.h"
static
unsigned
int
s0
,
s1
,
s2
;
...
...
@@ -52,20 +52,9 @@ void set_taus_seed(unsigned int seed_init)
unsigned
long
result
=
0
;
if
(
seed_init
==
0
)
{
unsigned
int
data
[
3
];
int
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
if
(
fd
==
-
1
)
{
abort
();
}
if
(
read
(
fd
,
data
,
sizeof
(
data
))
!=
sizeof
(
data
))
{
abort
();
}
close
(
fd
);
s0
=
data
[
0
];
s1
=
data
[
1
];
s2
=
data
[
2
];
fill_random
(
&
s0
,
sizeof
(
s0
));
fill_random
(
&
s1
,
sizeof
(
s1
));
fill_random
(
&
s2
,
sizeof
(
s2
));
}
else
{
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r
((
long
int
)
seed_init
,
&
buffer
);
...
...
openair2/UTIL/MATH/random.c
deleted
100644 → 0
View file @
1af5062b
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
random.c
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
#include "rtos_header.h"
#include "platform_types.h"
#include <sys/time.h>
/* Random generators */
#define FACTOR 16807
#define LASTXN 127773
#define UPTOMOD -2836
static
int
seed
;
void
init_uniform
(
void
)
{
struct
timeval
tv
;
struct
timezone
tz
;
gettimeofday
(
&
tv
,
&
tz
);
seed
=
(
int
)
tv
.
tv_usec
;
#ifdef NODE_MT
#warning TO DO seed = mobileId
//seed += mobileId;
#endif
#ifdef NODE_RG
#warning TO DO seed = rgId
//seed += rgId;
#endif
}
int
uniform
(
void
)
{
static
int
times
,
rest
,
prod1
,
prod2
;
times
=
seed
/
LASTXN
;
rest
=
seed
-
times
*
LASTXN
;
prod1
=
times
*
UPTOMOD
;
prod2
=
rest
*
FACTOR
;
seed
=
prod1
+
prod2
;
return
seed
;
}
openair3/ocp-gtpu/gtp_itf.cpp
View file @
bacf3537
...
...
@@ -19,7 +19,7 @@ extern "C" {
#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h>
#include <openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h>
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
//#include <openair1/PHY/phy_extern.h>
#include "sim.h"
#pragma pack(1)
...
...
@@ -143,6 +143,12 @@ class gtpEndPoints {
// the instance id will be the Linux socket handler, as this is uniq
map
<
uint64_t
,
gtpEndPoint
>
instances
;
gtpEndPoints
()
{
unsigned
int
seed
;
fill_random
(
&
seed
,
sizeof
(
seed
));
srandom
(
seed
);
}
~
gtpEndPoints
()
{
// automatically close all sockets on quit
for
(
const
auto
&
p
:
instances
)
...
...
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