Mac OS X:GNU并行无法找到远程服务器上的核心数

时间:2014-06-18 22:02:02

标签: macos bash parallel-processing gnu gnu-parallel

我使用自制软件在我的mac上安装GNU parallel,这样我就可以在我大学的服务器上远程运行一些测试。我正在快速浏览tutorials,但当我跑了

parallel -S <username>@$SERVER1 echo running on ::: <username>@$SERVER1

我收到了消息

parallel: Warning: Could not figure out number of cpus on <username@server> (). Using 1.

可能相关,我从来没有添加并行到我的路径并得到警告“并行”不是一个公认的命令,但并行运行反正仍然正确回声。这个特定的服务器有16个核心,我怎样才能并行识别它们?

1 个答案:

答案 0 :(得分:1)

GNU Parallel在OS X上的测试较少,因为我无法访问OS X安装,因此您可能发现了一个错误。

自20120322以来,GNU Parallel使用它们来查找CPU的数量:

sysctl -n hw.physicalcpu
sysctl -a hw 2>/dev/null | grep [^a-z]physicalcpu[^a-z] | awk '{ print \$2 }'

核心数量:

sysctl -n hw.logicalcpu
sysctl -a hw  2>/dev/null | grep [^a-z]logicalcpu[^a-z] | awk '{ print \$2 }'

你能测试一下这些输出的结果吗?

您使用的是哪个版本的GNU Parallel?

作为一种解决方法,您可以强制GNU Parallel检测16个核心:

parallel -S 16/<username>@$SERVER1 echo running on ::: <username>@$SERVER1

从版本20140422开始,您可以将路径导出到远程服务器:

parallel --env PATH -S 16/<username>@$SERVER1 echo running on ::: <username>@$SERVER1

这样您只需将服务器上parallel所在的目录添加到本地计算机上的路径中即可。例如。远程服务器上的parallel位于/home/u/user/bin/parallel

PATH=$PATH:/home/u/user/bin parallel --env PATH -S <username>@$SERVER1 echo running on ::: <username>@$SERVER1

Ole的信息

我的iMac(英特尔酷睿i7上的OSX MAvericks)提供了以下内容,看起来都是正确的:

sysctl -n hw.physicalcpu
4


sysctl -a hw
hw.ncpu: 8
hw.byteorder: 1234
hw.memsize: 17179869184
hw.activecpu: 8
hw.physicalcpu: 4
hw.physicalcpu_max: 4
hw.logicalcpu: 8
hw.logicalcpu_max: 8
hw.cputype: 7
hw.cpusubtype: 4
hw.cpu64bit_capable: 1
hw.cpufamily: 1418770316
hw.cacheconfig: 8 2 2 8 0 0 0 0 0 0
hw.cachesize: 17179869184 32768 262144 8388608 0 0 0 0 0 0
hw.pagesize: 4096
hw.busfrequency: 100000000
hw.busfrequency_min: 100000000
hw.busfrequency_max: 100000000
hw.cpufrequency: 3400000000
hw.cpufrequency_min: 3400000000
hw.cpufrequency_max: 3400000000
hw.cachelinesize: 64
hw.l1icachesize: 32768
hw.l1dcachesize: 32768
hw.l2cachesize: 262144
hw.l3cachesize: 8388608
hw.tbfrequency: 1000000000
hw.packages: 1
hw.optional.floatingpoint: 1
hw.optional.mmx: 1
hw.optional.sse: 1
hw.optional.sse2: 1
hw.optional.sse3: 1
hw.optional.supplementalsse3: 1
hw.optional.sse4_1: 1
hw.optional.sse4_2: 1
hw.optional.x86_64: 1
hw.optional.aes: 1
hw.optional.avx1_0: 1
hw.optional.rdrand: 0
hw.optional.f16c: 0
hw.optional.enfstrg: 0
hw.optional.fma: 0
hw.optional.avx2_0: 0
hw.optional.bmi1: 0
hw.optional.bmi2: 0
hw.optional.rtm: 0
hw.optional.hle: 0
hw.cputhreadtype: 1
hw.machine = x86_64
hw.model = iMac12,2
hw.ncpu = 8
hw.byteorder = 1234
hw.physmem = 2147483648
hw.usermem = 521064448
hw.pagesize = 4096
hw.epoch = 0
hw.vectorunit = 1
hw.busfrequency = 100000000
hw.cpufrequency = 3400000000
hw.cachelinesize = 64
hw.l1icachesize = 32768
hw.l1dcachesize = 32768
hw.l2settings = 1
hw.l2cachesize = 262144
hw.l3settings = 1
hw.l3cachesize = 8388608
hw.tbfrequency = 1000000000
hw.memsize = 17179869184
hw.availcpu = 8

sysctl -n hw.logicalcpu
8