Using shared memory and thread

bioinfornatics bioinfornatics at fedoraproject.org
Mon Nov 4 19:53:29 UTC 2019


Dear,

I would like to put a buffer `shared(char[])` into a shared 
memory ( L2 cache ) and provide a start and end index to multiple 
thread in order to perform computation on a piece of original 
buffer.

I read doc from std.concurrency, std.parallelism, core.thead 
(druntime) and vectorization (simd) .  But I found any example or 
unittest which perform such calculus.

1/ So did you have an example somewhere ?
2/ about shared keyword do we ensure that its size is lower than 
L2 or L3 cache using :

```
core.sys.posix.unistd: sysconf, _SC_LEVEL2_CACHE_SIZE, 
_SC_LEVEL3_CACHE_SIZE;
immutable size_t L2_CACHE_SIZE = cast(size_t) 
sysconf(_SC_LEVEL2_CACHE_SIZE);
immutable size_t L3_CACHE_SIZE = cast(size_t) 
sysconf(_SC_LEVEL3_CACHE_SIZE);

```
3/ variable flagged as `shared` does at mean the variable is put 
into L2 cache ?

thanks for your help

best regards


More information about the Digitalmars-d-learn mailing list