Bash: Running the same program over multiple cores

后端 未结 3 650
闹比i
闹比i 2020-12-14 10:28

I have access to a machine where I have access to 10 of the cores -- and I would like to actually use them. What I am used to doing on my own machine would be something like

3条回答
  •  眼角桃花
    2020-12-14 11:17

    With GNU Parallel you can do:

    parallel myProgram (options) {} {.}.tmp ::: *.fa
    

    From: http://git.savannah.gnu.org/cgit/parallel.git/tree/README

    = Full installation =

    Full installation of GNU Parallel is as simple as:

    ./configure && make && make install
    

    If you are not root you can add ~/bin to your path and install in ~/bin and ~/share:

    ./configure --prefix=$HOME && make && make install
    

    Or if your system lacks 'make' you can simply copy src/parallel src/sem src/niceload src/sql to a dir in your path.

    = Minimal installation =

    If you just need parallel and do not have 'make' installed (maybe the system is old or Microsoft Windows):

    wget http://git.savannah.gnu.org/cgit/parallel.git/plain/src/parallel
    chmod 755 parallel
    cp parallel sem
    mv parallel sem dir-in-your-$PATH/bin/
    

    Watch the intro videos to learn more: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1

提交回复
热议问题