-
Notifications
You must be signed in to change notification settings - Fork 1
/
mk-module-list.pl
executable file
·180 lines (176 loc) · 5.45 KB
/
mk-module-list.pl
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/perl
#
# /usr/bin/modulecmd bash whatis >& module.whatis
#
# -html to generate HTML output, uses module-style.css
#
# Nov 10 2021 - SGK - added more sections (Python, NVIDIA) and more stuff (julia)
# Nov 13 2021 - SGK - added xKey to exclude w/ grep(!/$xKey/, (grep (/$key/, $modList)))
#
# <- Last updated: Sat Nov 13 08:14:53 2021 -> SGK
#
$verNo = 'v2.0/0';
$useHTML = 0;
if ($ARGV[0] eq '-html') { $useHTML = 1;}
#
$base = '/share/apps/modulefiles';
@modList = `cat module.whatis`;
## $key; $xKey; $name; $check
@catList = (
'^bioinfo;;BioInformatics;1',
'^java/;;Java;1',
'^tools/;/python|/julia|/fl|/gdl;Tools;1',
'^python|/python;;Python;0',
'^idl/|^tools/fl|^tools/gdl|^matlab/|^tools/julia;;IDL, MATLAB or JULIA;0',
'^gcc/[0-9.]*:;;GNU compilers;0',
'^gcc/.*mpich|^gcc/.*mvapich|^gcc/.*openmpi;;GNU MPI;0',
'^gcc/.*/gsl;;GNU gsl;0',
'^intel/[0-9.]*:;;Intel compilers;0',
'^intel/mpi|^intel/mvapich|^intel/openmpi|^intel/.*/mpi|^intel/.*/mvapich|^intel/.*/openmpi'.
';;Intel MPI;0',
'^pgi/[0-9.]*:;;PGI compilers;0',
'^pgi/mvapich|^pgi/openmpi|^pgi/.*/mvapich|^pgi/.*/mpi|^pgi/.*/openmpi;;PGI MPI;0',
'^nvidia/[0-9.]*:;;NVIDIA compilers;0',
'^nvidia/mvapich|^nvidia/openmpi|^nvidia/.*/mvapich|^nvidia/.*/mpi|^nvidia/.*/openmpi;;NVIDIA MPI;0',
'^nvidia/.*/cuda|^cuda;;NVIDIA cuda;0',
'^gis|^gnuplot|^gsl|^blac|^fft'.
'^gdb|^hdf5|^intel-tbb-oss|^lapack|^mmfs|^mpich|^mvapich|^netcdf|'.
'^openblas|^openmpi|^scalapack'.';;Misc;0'
);
%links = ( 'BioInformatics' => 'bioinfo',
'Java' => 'java',
'Tools' => 'tools',
'Python' => 'python',
'IDL, MATLAB or JULIA' => 'idl/matlab/julia',
'GNU compilers' => 'gcc',
'GNU MPI' => 'gcc-mpich',
'GNU gsl' => 'gcc-gsl',
'Intel compilers' => 'intel',
'Intel MPI' => 'intel-mpi',
'PGI compilers' => 'pgi',
'PGI MPI' => 'pgi-mpi',
'NVIDIA compilers' => 'nvidia',
'NVIDIA MPI' => 'nvidia-mpi',
'NVIDIA cuda' => 'nvidia-cuda',
'Misc' => 'misc',
);
if ($useHTML) {
print <<__EOF__;
<html>
<head>
<title>Hydra Modules</title>
<link rel="stylesheet" type="text/css" href="module-style.css">
</head>
<h1>List of Available Modules on Hydra</h1>
<ul>
<li> <a href="#bioinfo">BioInformatics</a>
<li> <a href="#java">Java</a>
<li> <a href="#tools">Tools</a>
<li> <a href="#python">Python</a>
<li> <a href="#idl/matlab/julia">IDL/MATLAB/julia</a>
<li> <a href="#gcc">GNU compilers</a>
<ul>
<li> <a href="#gcc-mpich">GNU MPI</a>
<li> <a href="#gcc-gsl">GNU gsl</a>
</ul>
<li> <a href="#intel">Intel compilers</a>
<ul>
<li> <a href="#intel-mpi">Intel MPI</a>
</ul>
<li> <a href="#pgi">PGI compilers</a>
<ul>
<li> <a href="#pgi-mpi">PGI MPI</a>
</ul>
<li> <a href="#nvidia">NVIDIA compilers</a>
<ul>
<li> <a href="#nvidia-mpi">NVIDIA MPI</a>
<li> <a href="#nvidia-mpi">NVIDIA cuda</a>
</ul>
<li> <a href="#misc">Misc</a>
</ul>
__EOF__
$table = 0;
}
foreach $cat (@catList) {
($key, $xKey, $val, $chk) = split(';', $cat);
if ($useHTML) {
if ($table) { print "</table><p>\n"; }
print <<__EOF__;
<h2 id="$links{$val}">$val</h2>
<table rules='rows'>
<col width="350">
<col width="850">
<tr><td><b>Module</b></td><td><b>Description<b></td></tr>
__EOF__
$table = 1;
} else {
print "=:$val\n";
}
if ($xKey) {
@list = sort(grep !/$xKey/, (grep /$key/, @modList));
} else {
@list = sort(grep /$key/, @modList);
}
$prev = '';
$defVer = '?';
foreach $line (@list) {
## print STDERR ">>$cat>$line\n";
$line =~ s/Description: //;
$line =~ s/- Home.*//;
($name, $descr) = split(':', $line, 2);
chop($descr);
if ($name =~/\//) {
@w = split('/', $name);
$version = pop(@w);
$version =~ s/ *$//;
$name = join('/',@w);
} else {
$version = '';
}
if ($name ne $prev && $chk == 1) {
$vf = "$base/$name/.version";
## print STDERR "> $vf\n";
if (-e $vf) {
@def = grep /ModulesVersion/, `cat $vf`;
@w = split(' ', $def[0]);
$defVer = $w[2];
$defVer =~ s/\"//g;
## print STDERR "$name $defVer\n";
} else {
$defVer = '?';
}
}
#
## print STDERR "$defVer:$version:$line";
#
if ($defVer eq '?') {
if ($useHTML) {
printf "<tr><td><tt>%-35s</tt></td><td>%s</td></tr>\n", $name.'/'.$version, $descr;
} else {
printf "%-35s:%s\n", $name.'/'.$version, $descr;
}
} elsif ($version eq $defVer) {
if ($useHTML) {
printf "<tr><td><tt>%-35s</tt></td><td>%s - def. version, others may be avail.</td></tr>\n", $name, $descr;
} else {
## printf "%-35s:%s (other versions may be avail.)\n", $name, $descr;
printf "%-35s:%s - def. version, others may be avail.\n", $name, $descr;
}
}
#
$prev = $name;
}
}
if ($table) { print "</table><p>\n"; }
$time = scalar localtime(time());
$time =~ s/ (..):(..):(..) (....)/ $4 at $1:$2/;
if ($useHTML) {
print <<__EOF__
<p class="version">
Module list last updated as of $time with <tt>mk-module-list.pl</tt> $verNo</span>
<body></body></html>
__EOF__
} else {
print "=:Module list last updated as of ".$time." with mk-module-list.pl $verNo\n";
}
#