Example #1
0
        public void RunExperiment(Grammar grm, bool nvrtc = true, bool remote = false)
        {
            Initialize(grm);  ///                                      ---  (1)  gp, grammar, population, individual


            // Evolution of generations
            for (int gen = 0; gen < GENCOUNT; gen++)
            {
                CreateSourceCodes(PARALLELISM_LEVEL); ///    ---  (2)  create source

                PTXcompile(nvrtc, remote);            ///                     ---  (3) ptx compile

                JITcompile();                         ///                     ---  (4) JIT compile

                tic();

                CreateKernelObjects();      ///                     ---

                LaunchKernels();            ///                     ---  (5)  launch kernel

                WaitCompleteAndReadBack();  ///                     ---



                GPoperations();             ///                     ---  (6) gp operations: selection, XO, mutation

                SampleCollector.Collect("other", toc());
            }
            ctx.Dispose();
        }
Example #2
0
        public void WaitCompleteAndReadBack()
        {
            ctx.Synchronize();                                          // wait all to finish

            grm.ReadBackFromGPUBuffersAndComputeFitness(gp.population); //  read back from GPU memory


            Individual e = gp.getElite();

            e.elite = true;             // mark the new elite
            SampleCollector.Collect("fitness", e.fitness);
        }
Example #3
0
        public void JITcompile()
        {
            tic();
            foreach (var sc in sourceCodes)
            {
                if (sc.ptx == null)
                {
                    sc.mod = ctx.LoadModulePTX(sc.cubin, null, null);  // no jit, just upload
                }
                else
                {
                    sc.mod = ctx.LoadModulePTX(sc.ptx); //jit
                }
            }

            SampleCollector.Collect("JIT", toc());
        }
Example #4
0
 public void PTXcompile(bool nvrtc, bool remote)
 {
     tic();
     if (nvrtc)
     {
         if (remote)
         {
             // Multiple remote NVRTC
             PtxCompileRemoteMultiprocess();
         }
         else
         {
             // Single thread, NVRTC
             srcToPtx(sourceCodes[0]);
         }
     }
     else
     {
         // Multiple NVCC launch
         PtxCompileNVCCMultiprocess();
     }
     SampleCollector.Collect("PTX", toc());
 }