GNU平行不工作(GNU parallel not working at all)

2019-09-02 07:13发布

我一直在尝试使用GNU并行了一段时间,但我从来没有能够得到它的功能了!

例如,在运行(在非空目录!):

ls | parallel echo            # Outputs single new line
ls | parallel echo echo echo  # Outputs three new lines.
ls | parallel echo {}         # /bin/bash: {}: command not found
ls | parallel echo '{}'       # /bin/bash: {}: command not found
ls | parallel 'echo {}'       # Outputs: {}
ls | parallel -IMM 'echo MM'  # Outputs: MM

看来,这只不过是执行每个参数的命令,这是没有意义的。

我已经试过的bash,zsh中,tcsh中,CSH和SH,无济于事。

Answer 1:

正当我完成写这个问题,我跑parallel --version报告的版本,才发现:

警告:您正在使用--tollef。 如果事情怪怪的使用--gnu。

为什么该标志的默认设置目前尚不清楚给我。 不用说,使用--gnu工作!

以为我会张贴此保存挫折和困惑的人小时。

编辑:要永久解决此(在Ubuntu至少),删除--tollef在标志/etc/parallel/config



Answer 2:

根据不同的操作系统上,你应该检查是否正在实际运行GNU版本。

$ parallel --version
parallel: invalid option -- '-'
parallel [OPTIONS] command -- arguments
    for each argument, run command with argument, in parallel
parallel [OPTIONS] -- commands
    run specified commands in parallel

如果是这样的话,你没有运行GNU版本。 Ubuntu的12.04是这样,你就需要手动安装GNU平行得到你所期望的功能。



Answer 3:

有从FREEMAT外部命令(MATLAB外形相似)平行延伸的问题; 该argumentFile没有送入命令妥善解决它通过:

  • 添加--gnu期权
  • 不使用cmdString语法涉及[“]

码:

cmdString = 'parallel --gnu command ::: ';
    while j<=jLength
        cmdString = [cmdString argumentFilePath(j,:) ' '];
        j=j+1;
    end
    system(cmdString)

谢谢你的:)林在Ubuntu 12.04也是如此。



Answer 4:

For me it was same issue but different problem. Just running parallel command was exiting silently. Also parallel --version was saying invalid option error. In my Path there was just one parallel executable binary but still it was not detecting.

I was able to fix it as below:

  1. Run whereis parallel. This gives all the paths where executables named parallel is present. For my case there was just one path /usr/local/bin/parallel. Running using this path works just fine.
  2. You can add an alias for this in ~/.bashrc or ~/.zshrc file like alias parallel='/usr/local/bin/parallel'

And now parallel works like charm.

dev-dsk % parallel --version         
GNU parallel 20190322
Copyright (C) 2007-2019 Ole Tange and Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
GNU parallel comes with no warranty.


文章来源: GNU parallel not working at all