HTML automatically generated with rman
Table of Contents

Name

tabgen - Create an ASCII table with (random) values

Synopsis

tabgen [parameter=value]

Description

Create a table with (random) numbers. Either uniformly ditributed numbers between 0 and 1, from a gaussian (normal) distribution with mean 0 and sigma 1, a constant value, or a linearly increasing value (0, 1, 2, ...). See mode= below.

The number or rows and columns can be arbitrarely large, but not all table(5NEMO) programs in NEMO will be able to deal with large columns or rows. Usually rows can be managed with the nmax= keyword, but columns is hidden deeper and not under user control.

Using mode < 0 numbers are generated but not output, in effect allowing a benchmark.

Parameters

The following parameters are recognized in any order if the keyword is also given:
out=
Output ascii table [???]
nr=
Number of rows [10]
nc=
Number of columns [5]
mode=
The distribution of numbers: 1=uniform 2=normal 3=constant 4=linear < 0 : no output, but the absolute value determines which distribution of numbers [1]
seed=
Random seed [123]
fmt=
The printf(3) style format specifier. [%g]

Performance

On a typical 2020 machine it takes 0.23 seconds to create and output 1M random numbers, however most of the time is the output function. Using mode < 0 you can test the speed of just producing random numbers. About 95% of the time is spent in printf(3) , as can be seen with this benchmark:
    /usr/bin/time tabgen . 10000 10000 -1
    1.38user 0.29system 0:01.68elapsed 99%CPU
    
    /usr/bin/time tabgen . 10000 10000 1
    28.60user 0.14system 0:28.77elapsed 99%CPU
    
The raw production of random numbers is thus about 72 Mrups (same speed as numpy.random.normal), where the Linpack benchmark claims this machine runs at 50 GFlops.

Generating a sequence of numbers is relatively slow in tabgen. To generate 10M numbers is slow compared ot the standard unix tool seq(1) :

    /usr/bin/time tabgen - 10000000 1 4 fmt=%-10.f > tab2
    9.89user 0.07system 0:09.97elapsed 99%CPU
    /usr/bin/time seq 10000000 > tab2
    0.19user 0.22system 0:00.42elapsed 98%CPU
    
which is most likely the more complex operations of a floating point fprintf(3) .

See Also

seq(1) , tabmath(1NEMO) , xrandom(1NEMO) , xrandom(3NEMO) , printf(3)

Author

Peter Teuben

Update History


12-Jul-2020    V0.1 Created    PJT
14-jul-2020    V0.3 mode= implemented    PJT
25-jul-2020    V0.4 changed meaning of mode=    PJT


Table of Contents