summaryrefslogtreecommitdiff
path: root/training/utils/parallelize.pl
diff options
context:
space:
mode:
authorChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2014-01-15 23:33:58 -0500
committerChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2014-01-15 23:33:58 -0500
commit4b3c880a77d25af9f612e9aaf60e78faa3f00624 (patch)
tree20b3395f0146fbadf6563e4b9d822184342fdacd /training/utils/parallelize.pl
parent9f57df1eb1346196b6ea755eab9fb81a8a57b915 (diff)
parentf3f8dbaec0c91d90fc2e9fdec988081659a7c48c (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'training/utils/parallelize.pl')
-rwxr-xr-xtraining/utils/parallelize.pl16
1 files changed, 13 insertions, 3 deletions
diff --git a/training/utils/parallelize.pl b/training/utils/parallelize.pl
index 4197e0e5..c9ab88ce 100755
--- a/training/utils/parallelize.pl
+++ b/training/utils/parallelize.pl
@@ -45,11 +45,22 @@ my $numnodes = 8;
my $user = $ENV{"USER"};
my $pmem = "9g";
my $basep=50300;
-my $randp=300;
my $tryp=50;
my $no_which;
my $no_cd;
+if (-r '/dev/urandom') {
+ open(RR,'</dev/urandom') or die "Failed to read /dev/urandom: $!";
+ my $buffer;
+ die "Failed to read 4 bytes of entropy" unless read(RR,$buffer,4) == 4;
+ close RR;
+ my ($val) = unpack 'L1', $buffer;
+ srand($val);
+} else {
+ srand();
+}
+my $randp=4000;
+
my $DEBUG=$ENV{DEBUG};
print STDERR "DEBUG=$DEBUG output enabled.\n" if $DEBUG;
my $verbose = 1;
@@ -206,8 +217,7 @@ chomp $host;
# find open port
-srand;
-my $port = 50300+int(rand($randp));
+my $port = $basep+int(rand($randp));
my $endp=$port+$tryp;
sub listening_port_lines {
my $quiet=$verbose?'':'2>/dev/null';