star-sp

Random number generators and distributions
git clone git://git.meso-star.fr/star-sp.git
Log | Files | Refs | README | LICENSE

commit 0ff700b7bea18cb602979f1679cc2c53532f3af9
parent 76037063a829e7ab786e792961b16003287e72c1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Sun, 30 Mar 2025 16:43:34 +0200

Reduce the size of the proxy cache to 4 MB

This considerably reduces the memory footprint of the proxy when it has
to manage several RNGs, as is the case on computers with many threads.
And this without any impact on most of the workloads to be processed.

A size of 4 MB already enables at least several hundred states to be
stored for generators with a large state size. This should be sufficient
to buffer random sequence states when the workload is unbalanced between
buckets.

Diffstat:
Msrc/ssp_rng_proxy.c | 2+-
Msrc/test_ssp_rng_proxy.c | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ssp_rng_proxy.c b/src/ssp_rng_proxy.c @@ -30,7 +30,7 @@ /* Cache capacity. Maximum size in bytes that the cache can store */ #if 1 - #define STATE_CACHE_CAPACITY (32*(1024*1024)) /* 32 MB */ + #define STATE_CACHE_CAPACITY (4*1024*1024) /* 4 MB */ #else #define STATE_CACHE_CAPACITY 0 /* Disable the cache */ #endif diff --git a/src/test_ssp_rng_proxy.c b/src/test_ssp_rng_proxy.c @@ -476,7 +476,7 @@ test_read_with_cached_states(void) } /* Discard several RNs for the first RNG only to make under pressure the - * cache stream of 'rng1'. The cache stream limit is set to 32 MB and the + * cache stream of 'rng1'. The cache memory limit is 32 MB maximum and the * size of a Mersenne Twister RNG state is greater than 6 KB. Consquently, * ~5500 RNG states will exceed the cache stream, i.e. 5500*2 = 11000 * random generations (since there is 2 RNs per bucket). Above this limit, @@ -607,7 +607,7 @@ test_cache(void) CHK(ssp_rng_create(NULL, SSP_RNG_MT19937_64, &rng) == RES_OK); /* Generate several RNs for the first RNG only to make under pressure the - * cache stream of 'rng1'. The cache stream limit is set to 32 MB and the + * cache stream of 'rng1'. The cache memory limit is 32 MB maximum and the * size of a Mersenne Twister RNG state is greater than 6 KB. Consquently, * ~5500 RNG states will exceed the cache stream, i.e. 5500*2 = 11000 * random generations (since there is 2 RNs per bucket). Above this limit, @@ -827,7 +827,7 @@ test_flush_sequence() } /* Generate several RNs for the first RNG only to make under pressure the - * cache stream of 'rng1'. The cache stream limit is set to 32 MB and the + * cache stream of 'rng1'. The cache memory limit is 32 MB maximum and the * size of a Mersenne Twister RNG state is greater than 6 KB. Consquently, * ~5500 RNG states will exceed the cache stream, i.e. 5500*5 = 27500 * random generations (since there is 5 RNs per bucket). Above this limit,