• incredibuild(分布式任务软件)脚本


    IncrediBuild 可以在Server段通过修改单个任务的进程上限来实现提升任务执行速度。

    IncredBuild本机版也可以用来进行本机实现多线程任务分发,这样可以充分利用多核资源。

    提交分布式任务涉及该工具的三个命令:

        xgConsole.exe ,负责编译工程任务的发起;

        xgSubmit.exe ,负责提交各个工程文件的编译任务;

        xgWait.exe ,负责最后的链接。

     示例:

    run.bat
    @ECHO OFF
    xgSubmit.exe /group=UTest # test.exe 0.cpp
    xgSubmit.exe /group=UTest # test.exe 1.cpp
    xgSubmit.exe /group=UTest # test.exe 2.cpp
    xgSubmit.exe /group=UTest # test.exe 3.cpp
    xgSubmit.exe /group=UTest # test.exe 4.cpp
    xgSubmit.exe /group=UTest # test.exe 5.cpp
    xgSubmit.exe /group=UTest # test.exe 6.cpp
    xgSubmit.exe /group=UTest # test.exe 7.cpp
    xgSubmit.exe /group=UTest # test.exe 8.cpp
    xgSubmit.exe /group=UTest # test.exe 9.cpp
    xgSubmit.exe /group=UTest # test.exe 10.cpp
    xgWait.exe /group=UTest
    echo All Task Finished
    
    xgConsole /command="run.bat" /openmonitor 
    Rem UTest.bat - Distributed Version
    Rem ===============================
    xgSubmit.exe /group=UTest /command UTest.exe /in=Input1.dat /out="Results"
    xgSubmit.exe /group=UTest /command UTest.exe /in=Input2.dat /out="Results"
    xgSubmit.exe /group=UTest /command UTest.exe /in=Input3.dat /out="Results"
    xgSubmit.exe /group=UTest /command UTest.exe /in=Input4.dat /out="Results"
    xgSubmit.exe /group=UTest /command UTest.exe /in=Input5.dat /out="Results"
    xgWait.exe /group=UTest
    UReport.exe /in="Results" /ShowReport
    :end
    
    xgConsole.exe UTest.bat

     自己写的一个分布式批处理脚本: 

    @ECHO OFF
    setlocal ENABLEDELAYEDEXPANSION
    set time1=%time:~0,2%%time:~3,2%%time:~6,2%
    
    set PRJ_DIR=%CD%
    set WORK_FILE=lint
    set BAT=run.bat
    set SOURCE=filelist.txt
    
    ::进工作目录
    IF NOT EXIST %WORK_FILE% (
        echo No %WORK_FILE%!!!
        EXIT
    )
    
    cd %WORK_FILE%
    
    IF NOT EXIST %SOURCE% (
        echo No %SOURCE%!!!
        EXIT
    )
    
    set tmpIndex=0
    set duplicateCount=0
    
    ::遍历文件列表
    FOR /F "eol=/delims=" %%i in (%SOURCE%) do (
        set tmp=%%i
        
        set isannotate=false
        IF "!tmp:~0,1!"=="#" (
            set isannotate=true
        )
        IF "!tmp:~0,2!"=="//" (
            set isannotate=true
        )
        
        IF !isannotate!==false (
            set fileorfolder=!tmp:%%PRJ_DIR%%=%PRJ_DIR%!
            set existfile=false
            FOR /F "delims=" %%j in ('dir /s /b /A:-D !fileorfolder!') do (
                IF EXIST "%%j" (
                    set existfile=true
                    
                    ::判重标识
                    set duplicate=false
                    FOR /L %%k IN (0,1,!tmpIndex!) do (
                        IF /I !tmp[%%k]!=="%%j" (
                            set duplicate=true
                        )
                    )
                    
                    ::判重
                    IF !duplicate!==false (
                        set tmp[!tmpIndex!]="%%j"
                        set /a tmpIndex=tmpIndex+1
                    ) ELSE (
                        set /a duplicateCount=duplicateCount+1
                    )
                )
            )
            
            IF !existfile!==false (
                echo !tmp! error
                echo !fileorfolder!
            )
        )
    )
    
    ::清空临时环境变量,否则后面执行xgConsole时会尝试解析这些环境变量而出错
    set tmp=
    set fileorfolder=
    set existfile=
    set duplicate=
    
    echo TaskInfo FileCount:!tmpIndex!  Duplicate:!duplicateCount!
    
    ::重新生成bat
    IF EXIST "%BAT%" (
        del "%BAT%"
    )
    
    echo @ECHO OFF >>%BAT%
    
    ::按实际大小遍历
    set /a tmpIndex=tmpIndex-1
    
    FOR /L %%k IN (0,1,!tmpIndex!) do (
        echo xgSubmit.exe /group=UTest # test.exe !tmp[%%k]! >>%BAT%
    )
    
    echo xgWait.exe /group=UTest >>%BAT%
    echo echo All Task Finished! >>%BAT%
    
    xgConsole /NOLOGO /command="%BAT%"
    
    set time2=%time:~0,2%%time:~3,2%%time:~6,2%
    set /a time3=%time2%-%time1%
    echo 耗时%time3%秒
    
    EXIT
  • 相关阅读:
    页面加载完没有其他操作的情况下直接获取音频时长为NAN问题
    关于mysql的一些操作
    阿里云服务器登录不上 提示:之前用于连接到 (公网ip) 的凭据无法工作(1核1G) 以及阿里云新版本安全组策略没有开启80端口导致网站只能ping通 访问不到的问题
    微信浏览器禁止页面下拉查看网址(不影响页面内部scroll)
    2018年11月17号第一次参加源创会记录
    使用了eclipse10年之后,我终于投向了IDEA
    spring/spring boot/spring cloud书籍推荐
    python数据库连接例子
    Spring Cloud Eureka配置文件例子与较为详细说明
    spring源代码下载并导入eclipse技巧
  • 原文地址:https://www.cnblogs.com/dongzhiquan/p/3176734.html
Copyright © 2020-2023  润新知