Example #1
0
        /// <inheritdoc />
        protected override void SetupCompileCppFilesArgs(TaskGraph graph, BuildOptions options, List <string> args, string outputPath)
        {
            base.SetupCompileCppFilesArgs(graph, options, args, outputPath);

            args.Add(string.Format("-target {0}", ArchitectureName));
            args.Add(string.Format("--sysroot=\"{0}\"", ToolsetRoot.Replace('\\', '/')));
        }
Example #2
0
        private Dictionary <int, TickState> createInitialTickState(TaskGraph tasksGraph, ComputingSystem computingSystem)
        {
            var readyJobs       = new List <Job>();
            var readyProcessors = new List <Processor>();

            foreach (var job in tasksGraph)
            {
                if (!job.Parents.Any())
                {
                    readyJobs.Add(job);
                }
            }

            foreach (var proc in computingSystem)
            {
                readyProcessors.Add(proc);
            }


            var ticksDesc = new Dictionary <int, TickState>();

            ticksDesc[1] = new TickState
            {
                ReadyJobs       = readyJobs,
                ReadyProcessors = readyProcessors
            };

            return(ticksDesc);
        }
Example #3
0
 public JobDefinition()
 {
     Name = string.Empty;
     Tasks = new List<TaskRequest>();
     Files = new List<FileRequest>();
     Graph = new TaskGraph();
 }
Example #4
0
        protected Scheduler(TaskGraph graph, int?maxThreadCount)
        {
            this.graph      = graph;
            this.workerList = new List <Worker>();

            // If no threadCount is given, set to one per core.
            if (maxThreadCount == null)
            {
                int coreCount = 0;
                foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
                {
                    coreCount += int.Parse(item["NumberOfCores"].ToString());
                }
                Console.WriteLine("Number Of Cores: {0}", coreCount);
                WorkerCount = coreCount;
            }
            else
            {
                WorkerCount = (int)maxThreadCount;
            }

            for (int i = 0; i < WorkerCount; i++)
            {
                workerList.Add(new Worker(i));
            }
        }
Example #5
0
        /// <inheritdoc />
        protected override void SetupLinkFilesArgs(TaskGraph graph, BuildOptions options, List <string> args, string outputFilePath)
        {
            base.SetupLinkFilesArgs(graph, options, args, outputFilePath);

            // Speed up build
            //args.Add("-Wl,--as-needed");
            args.Add("-Wl,--hash-style=gnu");
            //args.Add("-Wl,--build-id");

            if (options.LinkEnv.Output == LinkerOutput.SharedLibrary)
            {
                args.Add("-shared");
                args.Add(string.Format("-soname=\"{0}\"", Path.GetFileNameWithoutExtension(outputFilePath)));
            }

            args.Add(string.Format("-target {0}", ArchitectureName));
            args.Add(string.Format("--sysroot=\"{0}\"", ToolsetRoot.Replace('\\', '/')));

            // Link core libraries
            args.Add("-pthread");
            args.Add("-ldl");
            args.Add("-lrt");

            // Link X11
            args.Add("-L/usr/X11R6/lib");
            args.Add("-lX11");
            args.Add("-lXcursor");
            args.Add("-lXinerama");
        }
Example #6
0
        /// <inheritdoc />
        protected override Task CreateBinary(TaskGraph graph, BuildOptions options, string outputFilePath)
        {
            var task = base.CreateBinary(graph, options, outputFilePath);

            task.CommandPath = ClangPath;
            return(task);
        }
Example #7
0
        /// <inheritdoc />
        protected override void SetupArchiveFilesArgs(TaskGraph graph, BuildOptions options, List <string> args, string outputFilePath)
        {
            // Remove -o from the output file specifier
            args[1] = string.Format("\"{0}\"", outputFilePath);

            base.SetupArchiveFilesArgs(graph, options, args, outputFilePath);
        }
Example #8
0
        /// <inheritdoc />
        public override void PostBuild(TaskGraph graph, BuildOptions buildOptions)
        {
            base.PostBuild(graph, buildOptions);

            // If building engine executable for platform doesn't support referencing it when linking game shared libraries
            if (UseSeparateMainExecutable(buildOptions))
            {
                // Build additional executable with Main module only that uses shared library
                using (new ProfileEventScope("BuildExecutable"))
                {
                    BuildMainExecutable(graph, buildOptions);
                }

                // Restore state from PreBuild
                Modules.Add("Main");
            }

            // Mono on Linux is using dynamic linking and needs additional link files
            if (buildOptions.Platform.Target == TargetPlatform.Linux && Platform.BuildTargetPlatform == TargetPlatform.Linux && !IsPreBuilt)
            {
                var task = graph.Add <Task>();
                task.PrerequisiteFiles.Add(Path.Combine(buildOptions.OutputFolder, "libmonosgen-2.0.so"));
                task.ProducedFiles.Add(Path.Combine(buildOptions.OutputFolder, "libmonosgen-2.0.so.1"));
                task.WorkingDirectory = buildOptions.OutputFolder;
                task.CommandPath      = "ln";
                task.CommandArguments = "-s -f libmonosgen-2.0.so libmonosgen-2.0.so.1";
                task = graph.Add <Task>();
                task.PrerequisiteFiles.Add(Path.Combine(buildOptions.OutputFolder, "libmonosgen-2.0.so"));
                task.ProducedFiles.Add(Path.Combine(buildOptions.OutputFolder, "libmonosgen-2.0.so.1.0.0"));
                task.WorkingDirectory = buildOptions.OutputFolder;
                task.CommandPath      = "ln";
                task.CommandArguments = "-s -f libmonosgen-2.0.so libmonosgen-2.0.so.1.0.0";
            }
        }
Example #9
0
        /// <inheritdoc />
        protected override Task CreateArchive(TaskGraph graph, BuildOptions options, string outputFilePath)
        {
            var task = base.CreateArchive(graph, options, outputFilePath);

            task.CommandPath = LlvmArPath;
            return(task);
        }
Example #10
0
    static void WorkThread(TaskGraph taskGraph)
    {
        while (true)
        {
            taskGraph.mEventDispatch.Wait();
            {
                if (taskGraph.mEventExit.Wait(0))
                {
                    break;
                }

                taskGraph.mEventReady.Signal();
                taskGraph.mEventReady.Wait();

                if (taskGraph.mTaskListHeads.Count > 0 && taskGraph.mTaskListDependence.Count > 0)
                {
                    TaskEvent taskEvent = taskGraph.mEventRun;
                    do
                    {
                        taskEvent.Wait();

                        while (true)
                        {
                            bool     bFinish = false;
                            TaskBase task    = null;

                            taskGraph.mMutex.WaitOne();
                            {
                                if (taskGraph.mTaskListHeads.ContainsKey(taskEvent) && taskGraph.mTaskListHeads[taskEvent] != null)
                                {
                                    task = taskGraph.mTaskListHeads[taskEvent];
                                    taskGraph.mTaskListHeads[taskEvent] = taskGraph.mTaskListHeads[taskEvent].Next;
                                }
                                else
                                {
                                    bFinish = true;
                                }
                            }
                            taskGraph.mMutex.ReleaseMutex();

                            if (task != null)
                            {
                                task.TaskFunc();
                                task.SetEventSignal();
                            }

                            if (bFinish)
                            {
                                break;
                            }
                        }

                        taskEvent = taskGraph.mTaskListDependence.Count > 0 ? taskGraph.mTaskListDependence[taskEvent] : null;
                    } while (taskEvent != null);
                }
            }
            taskGraph.mEventDispatch.Reset();
            taskGraph.mEventFinish.Signal();
        }
    }
Example #11
0
 /// <summary>
 /// Cleans the build system cache and intermediate results.
 /// </summary>
 public static void Clean()
 {
     using (new ProfileEventScope("Clean"))
     {
         var graph = new TaskGraph(Globals.Root);
         graph.CleanCache();
     }
 }
Example #12
0
        public Dynamic(TaskGraph graph, int?maxThreadCount = null) : base(graph, maxThreadCount)
        {
            this.graph.ComputeSLevel();
            var initialList = this.graph.SortBySLevel().Where(x => x.IsReadyToExecute).ToList();

            readyList = new ReadyTaskList(initialList);
            workers   = new ReadyWorkerList(WorkerCount);
        }
Example #13
0
        public override void Execute()
        {
            if (Application.DisplayManual)
            {
                ForgeTool.DisplayManual();
            }
            else
            {
                TaskGraph.SetEndPoints(Application.Profile.GetEndPoints());
                AppDomain.CurrentDomain.GetAssemblies().ParallelFor((assembly) =>
                {
                    foreach (Type task in assembly.GetTypes <ITaskPrototype>())
                    {
                        if (!task.IsAbstract)
                        {
                            try
                            {
                                TaskPrototypes.Add(task.CreateInstance <ITaskPrototype>());
                            }
                            catch (Exception er)
                            {
                                if (Application.LogSeverity == SeverityFlags.Full)
                                {
                                    Application.Error(SeverityFlags.None, "{0}{1}{2}", er.Message, Environment.NewLine, er.StackTrace);
                                }
                                else
                                {
                                    Application.Error(SeverityFlags.None, er.Message);
                                }
                            }
                        }
                    }
                });

                foreach (FileDescriptor file in Application.GetBuildFiles())
                {
                    outputPins.Add(new FlaggedPin(this, file, SystemTags.SealedSetup));
                }

                UInt32 flag; if (outputPins.Count > 0)
                {
                    flag = SystemTags.SealedSetup;
                }
                else
                {
                    flag = SystemTags.ForgeSetup;
                }
                foreach (PathDescriptor path in Application.GetBuildPaths())
                {
                    outputPins.Add(new FlaggedPin(this, path, flag));
                }

                if (outputPins.Count == 0)
                {
                    Application.Error(SeverityFlags.None, "Build paths not valid");
                }
            }
        }
Example #14
0
        /// <inheritdoc />
        protected override void SetupCompileCppFilesArgs(TaskGraph graph, BuildOptions options, List <string> args, string outputPath)
        {
            base.SetupCompileCppFilesArgs(graph, options, args, outputPath);

            var toolchain = ToolsetRoot.Replace('\\', '/');

            args.Add(string.Format("--target={0}", ArchitectureName));
            args.Add(string.Format("--gcc-toolchain=\"{0}\"", toolchain));
            args.Add(string.Format("--sysroot=\"{0}/sysroot\"", toolchain));

            args.Add("-fpic");
            args.Add("-funwind-tables");
            args.Add("-no-canonical-prefixes");
            if (options.Configuration != TargetConfiguration.Release)
            {
                args.Add("-fstack-protector-strong");
                args.Add("-D_FORTIFY_SOURCE=2");
            }
            else
            {
                args.Add("-D_FORTIFY_SOURCE=1");
            }
            if (options.CompileEnv.DebugInformation)
            {
                args.Add("-g2 -gdwarf-4");
                args.Add("-fno-omit-frame-pointer");
                args.Add("-fno-function-sections");
            }

            switch (Architecture)
            {
            case TargetArchitecture.x86:
                args.Add("-march=atom");
                if (Configuration.AndroidPlatformApi < 24)
                {
                    args.Add("-mstackrealign");
                }
                break;

            case TargetArchitecture.x64:
                args.Add("-march=atom");
                break;

            case TargetArchitecture.ARM:
                args.Add("-march=armv7-a");
                args.Add("-mfloat-abi=softfp");
                args.Add("-mfpu=vfpv3-d16");
                break;

            case TargetArchitecture.ARM64:
                args.Add("-march=armv8-a");
                break;

            default: throw new InvalidArchitectureException(Architecture);
            }
        }
Example #15
0
        /// <inheritdoc />
        public override void PreBuild(TaskGraph graph, BuildOptions buildOptions)
        {
            // If building engine executable for platform doesn't support referencing it when linking game shared libraries
            if (UseSymbolsExports && OutputType == TargetOutputType.Executable && !buildOptions.Platform.HasExecutableFileReferenceSupport)
            {
                // Don't link Main module into shared library
                Modules.Remove("Main");
            }

            base.PreBuild(graph, buildOptions);
        }
Example #16
0
 public static void IgnoreNotIncluded(this TaskGraph graph, IReadOnlyCollection <string> included)
 {
     if (included.None())
     {
         return;
     }
     foreach (var m in graph.All.Where(m => !included.Contains(m.Name)))
     {
         m.Status = Ignored;
     }
 }
Example #17
0
        /// <inheritdoc />
        public override void PreBuild(TaskGraph graph, BuildOptions buildOptions)
        {
            // If building engine executable for platform doesn't support referencing it when linking game shared libraries
            if (UseSeparateMainExecutable(buildOptions))
            {
                // Don't link Main module into shared library
                Modules.Remove("Main");
            }

            base.PreBuild(graph, buildOptions);
        }
Example #18
0
        /// <inheritdoc />
        protected override void SetupCompileCppFilesArgs(TaskGraph graph, BuildOptions options, List <string> args)
        {
            base.SetupCompileCppFilesArgs(graph, options, args);

            if (options.CompileEnv.WinRTComponentExtensions)
            {
                foreach (var path in _usingDirs)
                {
                    args.Add(string.Format("/AI\"{0}\"", path));
                }
            }
        }
Example #19
0
        /// <inheritdoc />
        protected override Task CreateBinary(TaskGraph graph, BuildOptions options, string outputFilePath)
        {
            // Bundle STL library for the executable files for runtime
            if (options.LinkEnv.Output == LinkerOutput.Executable)
            {
                graph.AddCopyFile(Path.Combine(Path.GetDirectoryName(outputFilePath), "libc++_shared.so"), Path.Combine(AndroidNdk.Instance.RootPath, "sources/cxx-stl/llvm-libc++/libs/", GetAbiName(Architecture), "libc++_shared.so"));
            }

            var task = base.CreateBinary(graph, options, outputFilePath);

            task.CommandPath = ClangPath;
            return(task);
        }
Example #20
0
        /// <summary>
        /// Links the files into an archive (static library).
        /// </summary>
        protected virtual Task CreateArchive(TaskGraph graph, BuildOptions options, string outputFilePath)
        {
            var linkEnvironment = options.LinkEnv;
            var task            = graph.Add <LinkTask>();

            // Setup arguments
            var args = new List <string>();

            {
                args.Add("rcs");

                args.Add(string.Format("-o \"{0}\"", outputFilePath));
            }
            SetupArchiveFilesArgs(graph, options, args, outputFilePath);

            // Input files
            task.PrerequisiteFiles.AddRange(linkEnvironment.InputFiles);
            foreach (var file in linkEnvironment.InputFiles)
            {
                args.Add(string.Format("\"{0}\"", file.Replace('\\', '/')));
            }

            // Use a response file (it can contain any commands that you would specify on the command line)
            bool   useResponseFile = true;
            string responseFile    = null;

            if (useResponseFile)
            {
                responseFile = Path.Combine(options.IntermediateFolder, Path.GetFileName(outputFilePath) + ".response");
                task.PrerequisiteFiles.Add(responseFile);
                Utilities.WriteFileIfChanged(responseFile, string.Join(Environment.NewLine, args));
            }

            // Link object into archive
            task.WorkingDirectory = options.WorkingDirectory;
            task.CommandPath      = ArPath;
            task.CommandArguments = useResponseFile ? string.Format("@\"{0}\"", responseFile) : string.Join(" ", args);
            task.Cost             = task.PrerequisiteFiles.Count;
            task.ProducedFiles.Add(outputFilePath);

            // Generate an index to the contents of an archive

            /*task = graph.Add<LinkTask>();
             * task.CommandPath = RanlibPath;
             * task.CommandArguments = string.Format("\"{0}\"", outputFilePath);
             * task.InfoMessage = "Linking " + outputFilePath;
             * task.PrerequisiteFiles.Add(outputFilePath);
             * task.ProducedFiles.Add(outputFilePath);*/

            return(task);
        }
Example #21
0
        /// <inheritdoc />
        public override void PreBuild(TaskGraph graph, BuildOptions options)
        {
            base.PreBuild(graph, options);

            // Compile and include resource file if need to
            if (options.Target.Win32ResourceFile != null && !options.Target.IsPreBuilt && options.Target.OutputType == TargetOutputType.Executable)
            {
                var task       = graph.Add <CompileCppTask>();
                var args       = new List <string>();
                var sourceFile = options.Target.Win32ResourceFile;

                // Suppress Startup Banner
                args.Add("/nologo");

                // Language
                args.Add("/l 0x0409");

                // Add preprocessor definitions
                foreach (var definition in options.CompileEnv.PreprocessorDefinitions)
                {
                    args.Add(string.Format("/D \"{0}\"", definition));
                }

                // Add include paths
                foreach (var includePath in options.CompileEnv.IncludePaths)
                {
                    AddIncludePath(args, includePath);
                }

                // Add the resource file to the produced item list
                var outputFile = Path.Combine(options.IntermediateFolder, Path.GetFileNameWithoutExtension(sourceFile) + ".res");
                args.Add(string.Format("/Fo\"{0}\"", outputFile));
                options.LinkEnv.InputFiles.Add(outputFile);

                // Request included files to exist
                var includes = IncludesCache.FindAllIncludedFiles(sourceFile);
                task.PrerequisiteFiles.AddRange(includes);

                // Add the source file
                args.Add(string.Format("\"{0}\"", sourceFile));
                task.ProducedFiles.Add(outputFile);

                task.WorkingDirectory = options.WorkingDirectory;
                task.CommandPath      = _resourceCompilerPath;
                task.CommandArguments = string.Join(" ", args);
                task.PrerequisiteFiles.Add(sourceFile);
                task.Cost = 1;
            }
        }
    static void Main(string[] args)
    {
        int  count = 10;
        Data data  = new Data();

        TaskStep0[] step0 = new TaskStep0[count];
        TaskStep1[] step1 = new TaskStep1[count];
        TaskStep2[] step2 = new TaskStep2[count];

        for (int index = 0; index < count; index++)
        {
            step0[index] = new TaskStep0(data, index, count);
            step1[index] = new TaskStep1(data, index, count);
            step2[index] = new TaskStep2(data, index, count);
        }

        TaskEvent event1 = new TaskEvent();
        TaskEvent event2 = new TaskEvent();

        TaskGraph taskGraph = new TaskGraph();

        taskGraph.Create(8);

        while (true)
        {
            ConsoleKeyInfo key = Console.ReadKey();
            if (key.Key != ConsoleKey.Escape)
            {
                Console.WriteLine("");

                for (int index = 0; index < count; index++)
                {
                    taskGraph.Task(step0[index], event1, null);
                    taskGraph.Task(step1[index], event2, event1);
                    taskGraph.Task(step2[index], null, event2);
                }

                taskGraph.Dispatch();
                taskGraph.Wait();

                continue;
            }

            break;
        }
        taskGraph.Destroy();
    }
Example #23
0
        /// <inheritdoc />
        public override void PostBuild(TaskGraph graph, BuildOptions buildOptions)
        {
            base.PostBuild(graph, buildOptions);

            // If building engine executable for platform doesn't support referencing it when linking game shared libraries
            if (UseSymbolsExports && OutputType == TargetOutputType.Executable && !buildOptions.Platform.HasExecutableFileReferenceSupport)
            {
                // Build additional executable with Main module only that uses shared library
                using (new ProfileEventScope("BuildExecutable"))
                {
                    BuildMainExecutable(graph, buildOptions);
                }

                // Restore state from PreBuild
                Modules.Add("Main");
            }
        }
Example #24
0
        public async Task TestGraphRunner()
        {
            var ctx = await TestSetup.TextCtx();;
            var res = await TaskGraph.FromMethods(
                (l, c) => Shorten(l),
                (l, c) => Generate(l, true),
                (l, c) => NotDependent(l))
                      .Run(parallel: 2, ctx.Log, CancellationToken.None);

            var resByName = res.ToKeyedCollection(r => r.Name);

            resByName[nameof(Generate)].FinalStatus.Should().Be(GraphTaskStatus.Error);
            resByName[nameof(Shorten)].FinalStatus.Should().Be(GraphTaskStatus.Cancelled);
            resByName[nameof(NotDependent)].FinalStatus.Should().Be(GraphTaskStatus.Success);

            ctx.Log.Information("Res {Res}, Shortened {Values}", res.Join("\n"), shortened);
        }
Example #25
0
        public async Task Run(IReadOnlyCollection <string> include, ILogger log, CancellationToken cancel = default)
        {
            var taskGraph = TaskGraph.FromMethods((l, c) => TopVideos(l), (l, c) => TopChannelVideos(l), (l, c) => ChannelStats(l));

            taskGraph.IgnoreNotIncluded(include);
            var(res, dur) = await taskGraph.Run(parallel : 4, log, cancel).WithDuration();

            var errors = res.Where(r => r.Error).ToArray();

            if (errors.Any())
            {
                Log.Error("Index - failed in {Duration}: {@TaskResults}", dur.HumanizeShort(), res.Join("\n"));
            }
            else
            {
                Log.Information("Index - completed in {Duration}: {TaskResults}", dur.HumanizeShort(), res.Join("\n"));
            }
        }
Example #26
0
        public IActionResult Add([FromBody] TaskGraphAddModel taskGraph)
        {
            var userList = new List <Guid>();

            userList.Add(taskGraph.UserId);
            var tgModel = new TaskGraph
            {
                Id          = Guid.NewGuid(),
                Description = taskGraph.Description,
                Name        = taskGraph.Name,
                RootId      = null,
                TaskSetId   = null,
                ActiveUsers = userList,
                WorkspaceId = taskGraph.WorkspaceId
            };

            return(Ok(ServiceFactory.TaskGraphService.Add(tgModel)));
        }
Example #27
0
        /// <inheritdoc />
        protected override void SetupLinkFilesArgs(TaskGraph graph, BuildOptions options, List <string> args, string outputFilePath)
        {
            base.SetupLinkFilesArgs(graph, options, args, outputFilePath);

            args.Add("-shared");
            args.Add("-no-canonical-prefixes");
            args.Add("-Wl,-Bsymbolic");
            args.Add("-Wl,--build-id=sha1");
            args.Add("-Wl,-gc-sections");

            if (options.LinkEnv.Output == LinkerOutput.Executable)
            {
                args.Add("-u ANativeActivity_onCreate");
            }

            string target;

            switch (Architecture)
            {
            case TargetArchitecture.x86:
                target = "i686-none-linux-android";
                break;

            case TargetArchitecture.x64:
                target = "x86_64-none-linux-android";
                break;

            case TargetArchitecture.ARM:
                target = "armv7-none-linux-androideabi";
                break;

            case TargetArchitecture.ARM64:
                target = "aarch64-none-linux-android";
                break;

            default: throw new InvalidArchitectureException(Architecture);
            }

            var toolchain = ToolsetRoot.Replace('\\', '/');

            args.Add(string.Format("--sysroot=\"{0}/sysroot\"", toolchain));
            args.Add(string.Format("--gcc-toolchain=\"{0}\"", toolchain));
            args.Add("--target=" + target + Configuration.AndroidPlatformApi);
        }
        public MainWindowViewModel()
        {
            Graph = new TaskGraph(true);
            Graph2 = new SystemGraph(true);

            //Add Layout Algorithm Types
            layoutAlgorithmTypes.Add("BoundedFR");
            layoutAlgorithmTypes.Add("Circular");
            layoutAlgorithmTypes.Add("CompoundFDP");
            layoutAlgorithmTypes.Add("EfficientSugiyama");
            layoutAlgorithmTypes.Add("FR");
            layoutAlgorithmTypes.Add("ISOM");
            layoutAlgorithmTypes.Add("KK");
            layoutAlgorithmTypes.Add("LinLog");
            layoutAlgorithmTypes.Add("Tree");

            //Pick a default Layout Algorithm Type
            LayoutAlgorithmType = "Tree";
        }
Example #29
0
    public IEnumerable <Job> GetJobOrder(TaskGraph graph)
    {
        var taskOrder = new List <Job>();
        var order     = new SortedList <long, Job>(new DuplicateKeyComparer <long>());
        var critPath  = new Dictionary <Job, long>();

        foreach (var finishTask in graph.FinishTasks)
        {
            fillCriticalPath(finishTask, 0, critPath);
        }
        foreach (var kvp in critPath)
        {
            var job  = kvp.Key;
            var crit = kvp.Value;
            order.Add(crit, job);
        }

        return(order.Select(kvp => kvp.Value).Reverse());
    }
Example #30
0
        public async Task TestGraphRunner()
        {
            using var log = Setup.CreateTestLogger();

            log.Information("hey there");

            var res = await TaskGraph.FromMethods(
                c => Shorten(log),
                c => Generate(log, true),
                c => NotDependent(log))
                      .Run(parallel: 2, log, CancellationToken.None);

            var resByName = res.ToKeyedCollection(r => r.Name);

            resByName[nameof(Generate)].FinalStatus.Should().Be(GraphTaskStatus.Error);
            resByName[nameof(Shorten)].FinalStatus.Should().Be(GraphTaskStatus.Cancelled);
            resByName[nameof(NotDependent)].FinalStatus.Should().Be(GraphTaskStatus.Success);

            log.Information("Res {Res}, Shortened {Values}", res.Join("\n"), shortened);
        }
Example #31
0
        private static void Start()
        {
            List <Task> tasks = new List <Task>();
            ForgeSetup  setup = new ForgeSetup();

            foreach (PathDescriptor path in Application.GetPluginList())
            {
                Plugin plugin = new Plugin(path);
                plugin.Child = setup;
                plugins.Add(plugin);
                tasks.Add(plugin);
            }
            if (tasks.Count == 0)
            {
                tasks.Add(setup);
            }

            TaskGraph.AwaitCompletion(tasks);
            Application.ProcessLogMessages();
        }
Example #32
0
        /// <inheritdoc />
        protected override void SetupCompileCppFilesArgs(TaskGraph graph, BuildOptions options, List <string> args, string outputPath)
        {
            base.SetupCompileCppFilesArgs(graph, options, args, outputPath);

            // Hide all symbols by default
            args.Add("-fvisibility-inlines-hidden");
            args.Add("-fvisibility-ms-compat");

            args.Add(string.Format("-target {0}", ArchitectureName));
            args.Add(string.Format("--sysroot=\"{0}\"", ToolsetRoot.Replace('\\', '/')));

            if (Architecture == TargetArchitecture.x64)
            {
                args.Add("-mssse3");
            }

            if (options.LinkEnv.Output == LinkerOutput.SharedLibrary)
            {
                args.Add("-fPIC");
            }
        }
 public void ReLayoutGraph()
 {
     graph = new TaskGraph(true);
     NotifyPropertyChanged("Graph");
 }
Example #34
0
        private void generateButton_Click(object sender, RoutedEventArgs e)
        {
            Random r = new Random();
            int nodeMinWeight = 1,
                nodeMaxWeight = 5,
                nodesNumber = 15,
                vertexWeight = 0,
                sumGraphWeight = 0;
            double coherence = 0.9;
            stats.Text += "coherence = " + coherence + "\n";
            TaskGraph graph = new TaskGraph(true);

            for (int i = 0; i < nodesNumber; i++)
            {
                vertexWeight = r.Next(nodeMinWeight, nodeMaxWeight);
                sumGraphWeight += vertexWeight;
                graph.AddVertex(new TaskVertex("V" + i, vertexWeight.ToString()));
            }

            int edgesWeight = (int)(sumGraphWeight * (1.0 / coherence - 1));

            int averageEdgeWeight = edgesWeight / r.Next(nodesNumber, (int)(nodesNumber * 1.2)) + 1;
            //int averageEdgeWeight = edgesWeight / r.Next(nodesNumber * (nodesNumber - 1) / 5, nodesNumber * (nodesNumber - 1) / 4 + 1) + 1;
            int edgesNumber = 0;
            while (edgesWeight > 0 && edgesNumber != nodesNumber * (nodesNumber - 1) / 2)
            {
                int source = r.Next(nodesNumber - 1);
                int target = r.Next(source + 1, nodesNumber);
                int weight = r.Next(averageEdgeWeight / 3, (int)(averageEdgeWeight * 2));
                weight = weight > edgesWeight ? edgesWeight : weight;
                TaskEdge edge = null;
                try
                {
                    edge = (from v in graph.Edges
                            where v.Source.ID == "V" + source && v.Target.ID == "V" + target
                            select v).First();
                }
                catch
                {
                }

                if (edge == null && weight > 0)
                {
                    var sourceVertex = graph.Vertices.Where(node => node.ID == "V" + source).Single();
                    var targetVertex = graph.Vertices.Where(node => node.ID == "V" + target).Single();
                    graph.AddEdge(new TaskEdge(weight.ToString(), sourceVertex, targetVertex));
                    edgesWeight -= weight;
                    edgesNumber++;
                }
            }

            vm.Graph = graph;
        }
Example #35
0
        //Open Graph
        private void LoadGraph_OnClick(object sender, RoutedEventArgs e)
        {
            FileDialog dialog = new OpenFileDialog();
            dialog.DefaultExt = ".xml";
            dialog.Filter = "XML Documents (.xml)|*.xml";
            bool? result = dialog.ShowDialog();
            if (result != true)
            {
                return;
            }
            string path = dialog.FileName;
            TaskGraph graph = new TaskGraph(true);
            XmlDocument document = new XmlDocument();
            document.LoadXml(File.ReadAllText(path));
            XmlNodeList vertices = document.GetElementsByTagName("vertice");
            XmlNodeList edges = document.GetElementsByTagName("edge");
            foreach (XmlNode node in vertices)
            {
                TaskVertex vertex = new TaskVertex(node.Attributes[0].Value, node.Attributes[1].Value);
                graph.AddVertex(vertex);
            }

            foreach (XmlNode node in edges)
            {
                var source = graph.Vertices.First(x => x.ID == node.Attributes[1].Value);
                var target = graph.Vertices.First(x => x.ID == node.Attributes[2].Value);
                TaskEdge edge = new TaskEdge(node.Attributes[0].Value, source, target);
                graph.AddEdge(edge);
            }

            vm.Graph = graph;
        }