MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / uniformThreefry

Function uniformThreefry

src/backend/cuda/kernel/random_engine.hpp:852–872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850
851template<typename T>
852__global__ void uniformThreefry(T *out, uint hi, uint lo, uint hic, uint loc,
853 uint elementsPerBlock, uint elements) {
854 uint index = blockIdx.x * elementsPerBlock + threadIdx.x;
855 uint key[2] = {lo, hi};
856 uint ctr[2] = {loc, hic};
857 ctr[0] += index;
858 ctr[1] += (ctr[0] < loc);
859 uint o[4];
860
861 threefry(key, ctr, o);
862 uint step = elementsPerBlock / 2;
863 ctr[0] += step;
864 ctr[1] += (ctr[0] < step);
865 threefry(key, ctr, o + 2);
866
867 if (blockIdx.x != (gridDim.x - 1)) {
868 writeOut128Bytes(out, index, o[0], o[1], o[2], o[3]);
869 } else {
870 partialWriteOut128Bytes(out, index, o[0], o[1], o[2], o[3], elements);
871 }
872}
873
874template<typename T>
875__global__ void uniformMersenne(T *const out, uint *const gState,

Callers

nothing calls this directly

Calls 3

threefryFunction · 0.70
writeOut128BytesFunction · 0.70
partialWriteOut128BytesFunction · 0.70

Tested by

no test coverage detected