示例#1
0
        public Scheduler(List <string> fileNames)
        {
            this.fileNames = fileNames;

            Pipeline pipeline = ((GPUVerifyCruncherCommandLineOptions)CommandLineOptions.Clo).Pipeline;

            if (pipeline.RunHoudini)
            {
                pipeline.AddHoudiniEngine();
            }

            Houdini.HoudiniOutcome outcome;

            // Execute the engine pipeline in sequence or in parallel
            if (pipeline.Sequential)
            {
                outcome = ScheduleEnginesInSequence(pipeline);
            }
            else
            {
                outcome = ScheduleEnginesInParallel(pipeline);
            }

            // If Houdini has been invoked then apply the invariants to the program.
            // Otherwise report success
            if (pipeline.RunHoudini)
            {
                var     counters = default(KernelAnalyser.ResultCounter);
                Program prog     = GetFreshProgram(true, true);
                foreach (var implOutcome in outcome.implementationOutcomes)
                {
                    KernelAnalyser.ProcessOutcome(
                        prog, implOutcome.Key, implOutcome.Value.outcome, implOutcome.Value.errors, string.Empty, ref counters);
                }

                if (counters.AllVerified())
                {
                    GPUVerify.Utilities.IO.EmitProgram(ApplyInvariants(outcome), GetFileNameBase(), "cbpl");
                }

                ErrorCode = KernelAnalyser.GetExitCode(counters);
            }
            else
            {
                ErrorCode = (int)ToolExitCodes.SUCCESS;
            }

            if (((GPUVerifyCruncherCommandLineOptions)CommandLineOptions.Clo).WriteKilledInvariantsToFile)
            {
                DumpKilledInvariants(pipeline.ToString());
            }
        }
        public static void Main(string[] args)
        {
            Contract.Requires(cce.NonNullElements(args));
            CommandLineOptions.Install(new GVCommandLineOptions());

            try {
                CommandLineOptions.Clo.RunningBoogieFromCommandLine = true;
                if (!CommandLineOptions.Clo.Parse(args))
                {
                    Environment.Exit((int)GPUVerify.ToolExitCodes.OTHER_ERROR);
                }

                if (CommandLineOptions.Clo.Files.Count == 0)
                {
                    GVUtil.IO.ErrorWriteLine("GPUVerify: error: no input files were specified");
                    Environment.Exit((int)GPUVerify.ToolExitCodes.OTHER_ERROR);
                }
                if (!CommandLineOptions.Clo.DontShowLogo)
                {
                    Console.WriteLine(CommandLineOptions.Clo.Version);
                }

                List <string> fileList = new List <string>();
                foreach (string file in CommandLineOptions.Clo.Files)
                {
                    string extension = Path.GetExtension(file);
                    if (extension != null)
                    {
                        extension = extension.ToLower();
                    }
                    fileList.Add(file);
                }
                foreach (string file in fileList)
                {
                    Contract.Assert(file != null);
                    string extension = Path.GetExtension(file);
                    if (extension != null)
                    {
                        extension = extension.ToLower();
                    }
                    if (extension != ".bpl" && extension != ".cbpl")
                    {
                        GVUtil.IO.ErrorWriteLine("GPUVerify: error: {0} is not a .(c)bpl file", file);
                        Environment.Exit((int)GPUVerify.ToolExitCodes.OTHER_ERROR);
                    }
                }

                var results = VerifyFiles(fileList);
                Environment.Exit(KernelAnalyser.GetExitCode(results));
            } catch (Exception e) {
                if (GetCommandLineOptions().DebugGPUVerify)
                {
                    Console.Error.WriteLine("Exception thrown in GPUVerifyBoogieDriver");
                    Console.Error.WriteLine(e);
                    throw e;
                }

                GVUtil.IO.DumpExceptionInformation(e);
                Environment.Exit((int)GPUVerify.ToolExitCodes.INTERNAL_ERROR);
            }
        }