【问题标题】:How to let other xgsubmitted tasks share cpus with visual studio build tasks?如何让其他 xgsubmitted 任务与 Visual Studio 构建任务共享 cpu?
【发布时间】:2014-12-06 10:59:19
【问题描述】:

我可以使用 incredibuild 作为 Visual Studio 扩展包来使用多个 CPU 构建我的代码。

我也可以使用 xgconsole msbuild ... 命令。

但是如果我想在 vc build 的同时添加一些其他任务。所以我尝试了一些方法:

  1. 使用批处理 config.bat:

    xgSubmit /command task1
    xgSubmit /command task2
    msbuild  ***.sln /t:rebuild
    

然后使用命令

xgConsole /command="config.bat" /profile=pro.xml

我的pro.xml如下:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Profile FormatVersion="1">
<Tools>
    <Tool Filename="MSBuild" AllowIntercept="true" />
    <Tool Filename="Tracker" AllowIntercept="true" />
    <Tool Filename="CL" AllowIntercept="true" />
    <Tool Filename="Tracker" AllowRemote="true" />
    <Tool Filename="CL" AllowRemote="false" />
</Tools>
</Profile>

但问题是,tracker进程创建了一个cl进程,然后cl进程又创建了很多其他的cl进程。所以我在 xml 配置文件中将 cl 设置为 AllowIntercept 和 AllowRemote。但是有了这个xml配置,xgconsole就无法将cl进程分派给其他cpu,只会报错。

  1. 所以我尝试了另一种方法: 我将 Visual Studio cl.exe 重命名为 clChild.exe,并备份另一个,将其命名为 clorigin.exe。

然后我设计了自己的cl.exe。在我自己的cl.exe中,我检查父进程是否为tracker.exe,然后我启动clorigin.exe,并将命令para传递给它,然后等待clorigin.exe终止;如果父进程是cl.exe,那么我启动clchild.exe

但是这种方式也没什么用。简单地说,你可以认为它没有用。

所以我想也许我不应该通过StartProcess API 启动clorigin.exe,它只是启动另一个进程;也许我应该像unix中的execute api那样做,当启动一个子进程时,在taskmanager中它只能看到父进程,这意味着父进程只是完成另一个exe的任务,而不是创建一个新的进程号?

也许我认为是错误的方式,但是如何让其他任务与Visual Studio同时编译任务共享并被分派到多个cpu?

【问题讨论】:

    标签: visual-studio-2013 parallel-processing build-process incredibuild


    【解决方案1】:

    使用 IncrediBuild Visual Studio 插件(或 BuildConsole 命令)是使用 IncrediBuild 执行解决方案的最简单、最优化(性能方面)的方法。如果您更喜欢使用自定义配置文件执行构建,您的 profile.xml 应如下所示(请注意,不应在配置文件中提及 Tracker):

    &lt;?xml version="1.0" encoding="UTF-8" standalone="no" ?&gt; &lt;Profile FormatVersion="1"&gt; &lt;Tools&gt; &lt;Tool Filename="MSBuild" AllowIntercept="true" /&gt; &lt;Tool Filename="cl" AllowRemote="True" DeriveCaptionFrom="lastparam" VCCompiler="True" VCCompilerUnbatch="True" /&gt; &lt;Tool Filename="link" AllowRemote="false" DeriveCaptionFrom="firstparam" VCLinker="True" MonitorFileChanges="true" /&gt;

    &lt;/Tools&gt; &lt;/Profile&gt;

    (作者在 IncrediBuild 工作)

    【讨论】:

      猜你喜欢
      • 2016-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-21
      • 1970-01-01
      • 2013-08-29
      • 2011-12-14
      • 1970-01-01
      相关资源
      最近更新 更多