File indexing completed on 2026-04-10 07:49:41
0001 #include "stdio.h"
0002
0003 #include "scuda.h"
0004 #include "qrng.h"
0005 #include "scurand.h"
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 template <typename T>
0022 __global__ void _QRng_generate(qrng<RNG>* qr, unsigned event_idx, T* uu, unsigned ni, unsigned nj )
0023 {
0024 unsigned id = blockIdx.x*blockDim.x + threadIdx.x;
0025 if (id >= ni) return;
0026
0027 RNG rng ;
0028 qr->init(rng, event_idx, id );
0029
0030 unsigned ibase = id*nj ;
0031
0032 for(unsigned j=0 ; j < nj ; j++)
0033 {
0034 T u = scurand<T>::uniform(&rng) ;
0035
0036
0037
0038 uu[ibase+j] = u ;
0039 }
0040 }
0041
0042 template <typename T>
0043 extern void QRng_generate(dim3 numBlocks, dim3 threadsPerBlock, qrng<RNG>* qr, unsigned event_idx, T* uu, unsigned ni, unsigned nj )
0044 {
0045 printf("//QRng_generate event_idx %d ni %d nj %d \n", event_idx, ni, nj );
0046 _QRng_generate<T><<<numBlocks,threadsPerBlock>>>( qr, event_idx, uu, ni, nj );
0047 }
0048
0049 template void QRng_generate(dim3, dim3, qrng<RNG>*, unsigned, float*, unsigned, unsigned );
0050 template void QRng_generate(dim3, dim3, qrng<RNG>*, unsigned, double*, unsigned, unsigned );
0051
0052