Beispiel #1
0
 Object IRuntime.Execute(params Object[] args)
 {
     using (Runtimes.Activate(this))
     {
         return(Execute(args));
     }
 }
Beispiel #2
0
        protected void TestKernelCrosscompilation(Type t_kernel)
        {
            var cfg = new CudaConfig {
                BlockDim = new dim3(16, 16, 1)
            };

            cfg.Codebase.OptIn(t => t.Assembly.GetName().Name == "Conflux.Playground");

            using (Runtimes.Activate(new CudaRuntime(cfg, t_kernel)))
            {
                var result       = JitCompiler.DoCompile(cfg, t_kernel);
                var s_ptx_actual = result.Ptx;
                var s_hir_actual = result.Hir.DumpAsText();

                var asm        = MethodInfo.GetCurrentMethod().DeclaringType.Assembly;
                var @namespace = MethodInfo.GetCurrentMethod().DeclaringType.Namespace;
                @namespace += ".Reference.";
                var ptx_fileName = asm.GetManifestResourceNames().SingleOrDefault2(
                    n => String.Compare(n, @namespace + t_kernel.Name + ".ptx", true) == 0);
                var hir_fileName = asm.GetManifestResourceNames().SingleOrDefault2(
                    n => String.Compare(n, @namespace + t_kernel.Name + ".hir", true) == 0);

                Verify(s_ptx_actual, ptx_fileName, "crosscompiled PTX", t_kernel);
                Verify(s_hir_actual, hir_fileName, "crosscompiled HIR", t_kernel);
            }
        }