code: def KernelCodeCuda():
      KERNEL_CODE_CUDA = """
  #define TCONG 0
  #define TSHR3 1
  #define TMWC 2
  #define TKISS 3
  
  #define TINT32 0
  #define TINT64 1
  #define TFP32 2
  #define TFP64 3
  
  #define IFTHEN 1
  
  // Marsaglia RNG very simple implementation
  
  #define znew  ((z=36969*(z&65535)+(z>>16))<<16)
  #define wnew  ((w=18000*(w&65535)+(w>>16))&65535)
  #define MWC   (znew+wnew)
  #define SHR3  (jsr=(jsr=(jsr=jsr^(jsr<<17))^(jsr>>13))^(jsr<<5))
  #define CONG  (jcong=69069*jcong+1234567)
  #define KISS  ((MWC^CONG)+SHR3)
  
  #define MWCfp MWC * 2.328306435454494e-10f
  #define KISSfp KISS * 2.328306435454494e-10f
  #define SHR3fp SHR3 * 2.328306435454494e-10f
  #define CONGfp CONG * 2.328306435454494e-10f
  
  __device__ ulong MainLoop(ulong iterations,uint seed_w,uint seed_z,size_t work)
  {
  
  #if TRNG == TCONG
     uint jcong=seed_z+work;
  #elif TRNG == TSHR3
     uint jsr=seed_w+work;
  #elif TRNG == TMWC
     uint z=seed_z+work;
     uint w=seed_w+work;
  #elif TRNG == TKISS
     uint jcong=seed_z+work;
     uint jsr=seed_w+work;
     uint z=seed_z-work;
     uint w=seed_w-work;
  #endif
  
     ulong total=0;
  
     for (ulong i=0;i<iterations;i++) {
  
  #if TYPE == TINT32
      #define THEONE 1073741824
      #if TRNG == TCONG
          uint x=CONG>>17 ;
          uint y=CONG>>17 ;
      #elif TRNG == TSHR3
          uint x=SHR3>>17 ;
          uint y=SHR3>>17 ;
      #elif TRNG == TMWC
          uint x=MWC>>17 ;
          uint y=MWC>>17 ;
      #elif TRNG == TKISS
          uint x=KISS>>17 ;
          uint y=KISS>>17 ;
      #endif
  #elif TYPE == TINT64
      #define THEONE 4611686018427387904
      #if TRNG == TCONG
          ulong x=(ulong)(CONG>>1) ;
          ulong y=(ulong)(CONG>>1) ;
      #elif TRNG == TSHR3
          ulong x=(ulong)(SHR3>>1) ;
          ulong y=(ulong)(SHR3>>1) ;
      #elif TRNG == TMWC
          ulong x=(ulong)(MWC>>1) ;
          ulong y=(ulong)(MWC>>1) ;
      #elif TRNG == TKISS
          ulong x=(ulong)(KISS>>1) ;
          ulong y=(ulong)(KISS>>1) ;
      #endif
  #elif TYPE == TFP32
      #define THEONE 1.0f
      #if TRNG == TCONG
          float x=CONGfp ;
          float y=CONGfp ;
      #elif TRNG == TSHR3
          float x=SHR3fp ;
          float y=SHR3fp ;
      #elif TRNG == TMWC
          float x=MWCfp ;
          float y=MWCfp ;
      #elif TRNG == TKISS
        float x=KISSfp ;
        float y=KISSfp ;
      #endif
  #elif TYPE == TFP64
      #define THEONE 1.0f
      #if TRNG == TCONG
          double x=(double)CONGfp ;
          double y=(double)CONGfp ;
      #elif TRNG == TSHR3
          double x=(double)SHR3fp ;
          double y=(double)SHR3fp ;
      #elif TRNG == TMWC
          double x=(double)MWCfp ;
          double y=(double)MWCfp ;
      #elif TRNG == TKISS
          double x=(double)KISSfp ;
          double y=(double)KISSfp ;
      #endif
  #endif
  
  #if TEST == IFTHEN
        if ((x*x+y*y) <=THEONE) {
           total+=1;
        }
  #else
        ulong inside=((x*x+y*y) <= THEONE) ? 1:0;
        total+=inside;
  #endif
     }
  
     return(total);
  }
  
  __global__ void MainLoopBlocks(ulong *s,ulong iterations,uint seed_w,uint seed_z)
  {
     ulong total=MainLoop(iterations,seed_z,seed_w,blockIdx.x);
     s[blockIdx.x]=total;
     __syncthreads();
  
  }
  
  __global__ void MainLoopThreads(ulong *s,ulong iterations,uint seed_w,uint seed_z)
  {
     ulong total=MainLoop(iterations,seed_z,seed_w,threadIdx.x);
     s[threadIdx.x]=total;
     __syncthreads();
  
  }
  
  __global__ void MainLoopHybrid(ulong *s,ulong iterations,uint seed_w,uint seed_z)
  {
     ulong total=MainLoop(iterations,seed_z,seed_w,blockDim.x*blockIdx.x+threadIdx.x);
     s[blockDim.x*blockIdx.x+threadIdx.x]=total;
     __syncthreads();
  }
  
  """
      return KERNEL_CODE_CUDA
  
imports: import numpy
  import sys
  import getopt
  import time
  import itertools
  from socket import gethostname
label_desc: Use image node_id 8 for calling a global function with example usage: KernelCodeCuda() and returns: KERNEL_CODE_CUDA