diff --git a/src/parallel b/src/parallel index b26cd3b3..01ba42ce 100755 --- a/src/parallel +++ b/src/parallel @@ -2931,6 +2931,8 @@ sub no_of_cpus { $no_of_cpus = no_of_cpus_aix(); } elsif ($^O eq 'darwin') { $no_of_cpus = no_of_cpus_darwin(); + } elsif ($^O eq 'hpux') { + $no_of_cpus = no_of_cpus_hpux(); } else { $no_of_cpus = (no_of_cpus_freebsd() || no_of_cpus_netbsd() @@ -2968,6 +2970,8 @@ sub no_of_cores { $no_of_cores = no_of_cores_aix(); } elsif ($^O eq 'darwin') { $no_of_cores = no_of_cores_darwin(); + } elsif ($^O eq 'hpux') { + $no_of_cores = no_of_cores_hpux(); } else { $no_of_cores = (no_of_cores_freebsd() || no_of_cores_netbsd() @@ -3166,6 +3170,24 @@ sub no_of_cores_aix { return $no_of_cores; } +sub no_of_cpus_hpux { + # Returns: + # Number of physical CPUs on HP-UX + # undef if not HP-UX + my $no_of_cpus = + (`/usr/bin/mpsched -s 2>/dev/null | grep 'Locality Domain Count' | awk '{ print \$4 }'`); + return $no_of_cpus; +} + +sub no_of_cores_hpux { + # Returns: + # Number of CPU cores on HP-UX + # undef if not HP-UX + my $no_of_cores = + (`/usr/bin/mpsched -s 2>/dev/null | grep 'Processor Count' | awk '{ print \$4 }'`); + return $no_of_cores; +} + sub sshcommand { my $self = shift; if (not defined $self->{'sshcommand'}) {