File: mpqcval.pl

package info (click to toggle)
mpqc 2.3.1-18%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,828 kB
  • sloc: cpp: 258,686; sh: 8,532; perl: 6,017; ansic: 5,491; makefile: 2,496; fortran: 1,970; lisp: 1,269; yacc: 313; lex: 177; csh: 45
file content (70 lines) | stat: -rw-r--r-- 1,703 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl

# Modified by Michael Banck <mbanck@debian.org> to run
# during the mpqc-build process

# If this is set to run, then runs involving the largest
# basis sets will be skipped.
$small = 1;

# This is the number of jobs that will be run concurrently.
$maxjobs = 2;

# The path to the MPQC executable
$mpqc = "../../../../../../debian/tmp/usr/bin/mpqc";

# So that MPQC finds its basis files
$ENV{SCLIBDIR} = "../../../../../../debian/tmp/usr/share/mpqc";

######################################################################

# autoflush output
$| = 1;

if ($ARGV[0] eq "-readdir") {
    opendir(DIR,".");
    @files = sort(readdir(DIR));
    closedir(DIR);
}
else {
    @files = sort(@ARGV);
}

$n = 0;
foreach $j (@files) {
    if (!($j =~ /\.in$/)) { next; }
    $out = "$j";
    $out =~ s/\.[^.]*$/.out/;
    printf "%s ", $out;
    $issmall = (!($j =~ /ccpc?v[tq5]z/));
    $can_run_concurrent = ! ($j =~ /^ckpt_[0-9]/);
    if ($small && $issmall != 1) {
        printf "skipping possibly big job\n";
    }
    elsif ( -f $out && ( -M $out < -M $j && -M $out < -M "$mpqc") ) {
        printf "skipping file that is up-to-date\n";
    }
    else {
        if (! $can_run_concurrent || $maxjobs == 1) {
            printf "starting in foreground\n";
            $pid = fork();
            if ($pid == 0) {
                exec("$mpqc -o $out $j");
            }
            waitpid($pid,'');
        }
        else {
            if (fork() == 0) {
                exec("$mpqc -o $out $j");
            }
            printf "started\n";
            $n = $n + 1;
        }
    }
    while ($n >= $maxjobs) {
        wait();
        $n = $n - 1;
    }
}

foreach $i (1..$n) { wait(); }