-
Notifications
You must be signed in to change notification settings - Fork 16
/
tau_validate
executable file
·1107 lines (912 loc) · 31.1 KB
/
tau_validate
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
import sys
import os
import subprocess
import glob
uniqID = 1
# TAU_SET_NODE=0 allows serial tests to run with MPI builds
serial_runner = "TAU_SET_NODE=0 ./simple"
parallel_runner = "mpirun -np 2 ./simple"
def outputHeader(message):
if verbose:
if html:
print(
"</pre><h2><font color=blue>\n" +
message +
"\n</font></h2><pre>")
else:
print(message + "\n")
def output(message):
if verbose:
if html:
print(
"</pre><h3><font color=green>\n" +
message +
"\n</font></h3><pre>")
else:
print(message + "\n")
def begin():
if html:
print("<html><body><pre>\n")
else:
print("------------------------------------------------------")
print("build/run : %-20s : %s" % ("test name", "stub makefile"))
print("------------------------------------------------------")
def end():
if (errorsFound == 0):
outputHeader("No Errors!")
code = 0
cleanup()
else:
print("Encountered %d errors" % errorsFound)
code = errorsFound
if (html):
print("</pre><body></html>\n")
sys.exit(code)
def usesOption(makefile, option):
opts = makefile.split('-')
for opt in opts:
if opt == option:
return True
return False
def shortMakefile(makefile):
return makefile[makefile.find("/lib/") + 5:]
def system(command, timeout_sec=None):
if verbose:
if html:
print("<b>" + os.getcwd() + "> " + command + "</b>")
else:
print(os.getcwd() + "> " + command)
sys.stdout.flush()
proc = None
try:
if verbose:
fdout = subprocess.PIPE
else:
if sys.version_info >= (3, 3):
fdout = subprocess.DEVNULL
else:
fdout = None
proc = subprocess.Popen([command], shell=True,
stdout=fdout, stderr=fdout)
stdout_data, stderr_data = proc.communicate(timeout=timeout_sec)
##The following produces unhelpful lines like "b''". Consider scrubbing these and reactivating.
#if verbose:
# print(stdout_data, file=sys.stdout)
# print(stderr_data, file=sys.stderr)
return proc.returncode
except BaseException:
# Many different exceptions can be thrown by subprocess,
# but all of them indicate an unrecoverable failure, so just
# swallow them all and return a generic error
if proc is not None:
proc.kill()
if verbose and proc is not None:
# Empty the pipes
proc.communicate()
return -1
def chdir(directory):
if verbose:
if html:
print("<b>" + os.getcwd() + "> cd " + directory + "</b>")
else:
print(os.getcwd() + "> cd " + directory)
if os.path.exists(directory) and os.path.isdir(directory):
os.chdir(directory)
def prependPath(directory):
print("<b>" + os.getcwd() + "> PATH=" + directory + ":$PATH</b>")
os.environ['PATH'] = directory + os.pathsep + os.environ['PATH']
def setEnviron(variable, value):
print("<b>" + os.getcwd() + "> export " + variable + "=" + value + "</b>")
os.environ[variable] = value
def unsetEnviron(variable):
print("<b>" + os.getcwd() + "> unset " + variable + "</b>")
del os.environ[variable]
def openTable(tests):
if html:
print("<table border=1>")
print("<tr><td rowspan=2>Stub Makefile</td>")
for test in tests:
print("<td colspan=2>" + test.name + "</td>")
print("</tr>")
print("<tr>")
for test in tests:
print("<td colspan>build</td>")
print("<td colspan>run</td>")
print("</tr>")
def closeTable():
if html:
print("</tr>")
print("</table>")
def outputSingle(tests, makefile):
if verbose and not html:
for test in tests:
print(
"%4s : %40s : %s %s" %
(test.buildresult,
test.name,
makefile,
test.message))
return
if html:
print("<tr><td>" + makefile + "</td>")
for test in tests:
if test.buildresult == "pass":
print("<td bgcolor=#64FF64>pass</td>")
elif test.buildresult == "fail":
print(
"<td bgcolor=#FF6464><a href=#%d>fail</a></td>" %
(test.errorID))
elif test.buildresult == "timeout":
print(
"<td bgcolor=#FF6464><a href=#%d>timeout</a></td>" %
(test.errorID))
else:
print("<td bgcolor=#CCCCCC>N/A</td>")
if test.runresult == "pass":
print("<td bgcolor=#64FF64>pass</td>")
elif test.runresult == "fail":
print(
"<td bgcolor=#FF6464><a href=#%d>fail</a></td>" %
(test.errorID))
elif test.runresult == "timeout":
print(
"<td bgcolor=#FF6464><a href=#%d>timeout</a></td>" %
(test.errorID))
else:
print("<td bgcolor=#CCCCCC>N/A</td>")
def outputSummary(testgrid):
first = 1
for makefile in list(testgrid.keys()):
tests = testgrid[makefile]
if first == 1:
first = 0
openTable(tests)
outputSingle(tests, makefile)
closeTable()
class Test:
def __init__(self, name, makefile):
self.name = name
self.fullmakefile = makefile
self.buildresult = "na"
self.runresult = "na"
self.message = ""
self.makefile = shortMakefile(makefile)
self.buildpath = "build"
self.errorID = 0
def checkApplicable(self):
return True
def runTest(self, timeout):
self.error("Base class runTest called")
def buildTest(self):
self.error("Base class buildTest called")
def checkResults(self):
if os.path.exists("profile.0.0.0"):
retval = system("pprof")
self.runresult = "pass"
elif os.path.exists("tautrace.0.0.0.trc"):
self.runresult = "pass"
elif os.path.exists("MULTI__GET_TIME_OF_DAY/profile.0.0.0"):
self.runresult = "pass"
elif usesOption(self.makefile, "epilog"):
self.runresult = "pass"
elif usesOption(self.makefile, "vampirtrace"):
if os.path.exists("simple.otf"):
self.runresult = "pass"
else:
self.error("Error: run succeeded, but no trace found")
self.runresult = "fail"
elif usesOption(self.makefile, "scorep"):
self.runresult = "pass"
else:
self.error("Error: run succeeded, but no profiles found")
self.runresult = "fail"
def error(self, message):
global errorsFound
global uniqID
errorsFound = errorsFound + 1
if verbose:
if html:
print(("</pre><h1><font color=red><a name=%d>\n" +
message + "\n</a></font></h1><pre>") % (uniqID))
self.errorID = uniqID
uniqID = uniqID + 1
else:
print(message + "\n")
class SimpleTest(Test):
def __init__(self, name, makefile):
Test.__init__(self, name, makefile)
def getActualTest(self):
return "simple"
def buildTest(self):
outputHeader(
"SimpleTest(" +
self.getActualTest() +
"), build (" +
self.fullmakefile +
")")
if not self.checkApplicable():
return
chdir(TEST_ROOT + "/" + self.getActualTest())
system("rm -rf " + self.buildpath)
system(
"TAU_MAKEFILE=" +
self.fullmakefile +
" TAU_TEST_MAKEFILE=" +
self.fullmakefile +
" make clean")
retval = system(
"TAU_MAKEFILE=" +
self.fullmakefile +
" TAU_TEST_MAKEFILE=" +
self.fullmakefile +
" make")
if retval != 0 or not os.path.exists("simple"):
self.error("Error: failed to build")
self.buildresult = "fail"
return
self.buildresult = "pass"
system("mkdir " + self.buildpath)
system("cp simple " + self.buildpath)
def runTest(self, timeout):
outputHeader("SimpleTest(" + self.getActualTest() +
", run (" + self.fullmakefile + ")")
if not self.checkApplicable():
return
chdir(TEST_ROOT + "/" + self.getActualTest())
if not os.path.exists(self.buildpath):
output("Nothing to run")
return
chdir(self.buildpath)
os.environ['TAU_METRICS'] = 'GET_TIME_OF_DAY'
retval = system(serial_runner, timeout)
if retval > 0:
self.error("Error: failed to run")
self.runresult = "fail"
elif retval < 0:
self.error("Error: timeout in run")
self.runresult = "timeout"
else:
self.checkResults()
def runMPITest(self, timeout):
outputHeader("MPITest(" + self.getActualTest() +
", run (" + self.fullmakefile + ")")
if parallel_runner == "":
output(
"Warning: Using default mpi launch: \"mpirun -np 2\". Set TAU_VALIDATE_PARALLEL to change")
if not self.checkApplicable():
return
chdir(TEST_ROOT + "/" + self.getActualTest())
if not os.path.exists(self.buildpath):
output("Nothing to run")
return
chdir(self.buildpath)
os.environ['TAU_METRICS'] = 'GET_TIME_OF_DAY'
retval = system(parallel_runner, timeout)
if retval > 0:
self.error("Error: failed to run")
self.runresult = "fail"
elif retval < 0:
self.error("Error: timeout in run")
self.runresult = "timeout"
else:
self.checkResults()
class CTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "C", makefile)
def getActualTest(self):
return "c"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
return True
class CompInstCTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "CompInst (C)", makefile)
def getActualTest(self):
return "compc"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if system("grep \"^TAU_COMPINST_OPTION\" " + self.fullmakefile) != 0:
return False
return True
class CompInstCPPTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "CompInst (C++)", makefile)
def getActualTest(self):
return "compcpp"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if system("grep \"^TAU_COMPINST_OPTION\" " + self.fullmakefile) != 0:
return False
return True
class CompInstF90Test(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "CompInst (F90)", makefile)
def getActualTest(self):
return "compf"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(self.makefile, "upc"):
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if system("grep \"^TAU_COMPINST_OPTION\" " + self.fullmakefile) != 0:
return False
return True
class FflinkTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "Fortran (flink)", makefile)
def getActualTest(self):
return "fflink"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(self.makefile, "upc"):
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
return True
class FcpplinkTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "Fortran (cpplink)", makefile)
def getActualTest(self):
return "fcpplink"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(self.makefile, "upc"):
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
return True
class FclinkTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "Fortran (clink)", makefile)
def getActualTest(self):
return "fclink"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(self.makefile, "upc"):
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
return True
class MpiCTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "MPI (C)", makefile)
def getActualTest(self):
return "mpic"
def checkApplicable(self):
if not usesOption(self.makefile, "mpi"):
output("Skipping, not configured with MPI")
return False
return True
def runTest(self, timeout):
self.runMPITest(timeout)
class MpiFTest(SimpleTest):
def __init__(self, makefile):
SimpleTest.__init__(self, "MPI (Fortran)", makefile)
def getActualTest(self):
return "mpif"
def checkApplicable(self):
if usesOption(self.makefile, "upc"):
return False
if not usesOption(self.makefile, "mpi"):
output("Skipping, not configured with MPI")
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
return True
def runTest(self, timeout):
self.runMPITest(timeout)
class PdtTest(Test):
def __init__(self, name, makefile):
Test.__init__(self, name, makefile)
def getActualTest(self):
return "pdt"
def buildTest(self):
outputHeader(
"Build: Test=" +
self.getActualTest() +
", Makefile=" +
self.fullmakefile +
")")
if not usesOption(self.makefile, "pdt"):
output("Skipping, not configured with PDT")
return
if not self.checkApplicable():
return
chdir(TEST_ROOT + "/" + self.getActualTest())
system("rm -rf " + self.buildpath)
system(
"TAU_MAKEFILE=" +
self.fullmakefile +
" TAU_TEST_MAKEFILE=" +
self.fullmakefile +
" make clean")
system("rm -f *.inst.*")
retval = system(
"TAU_MAKEFILE=" +
self.fullmakefile +
" TAU_TEST_MAKEFILE=" +
self.fullmakefile +
" make")
if retval != 0:
self.error("Error: failed to build")
self.buildresult = "fail"
return
if len(glob.glob("*.inst.*")) < 1:
self.error("Error: failed to instrument")
self.buildresult = "fail"
return
self.buildresult = "pass"
system("mkdir " + self.buildpath)
system("cp simple " + self.buildpath)
def runTest(self, timeout):
outputHeader(
"Run: Test=" +
self.getActualTest() +
", Makefile=" +
self.fullmakefile +
")")
if not usesOption(self.makefile, "pdt"):
output("Skipping, not configured with PDT")
return
if not self.checkApplicable():
return
chdir(TEST_ROOT + "/" + self.getActualTest())
if not os.path.exists(self.buildpath):
output("Nothing to run")
return
chdir(self.buildpath)
os.environ['TAU_METRICS'] = 'GET_TIME_OF_DAY'
retval = system(serial_runner, timeout)
if retval > 0:
self.error("Error: failed to run")
self.runresult = "fail"
elif retval < 0:
self.error("Error: timeout in run")
self.runresult = "timeout"
else:
self.checkResults()
def runMPITest(self, timeout):
outputHeader(
"Run (MPI): Test=" +
self.getActualTest() +
", Makefile=" +
self.fullmakefile +
")")
if parallel_runner == "":
output("Skipping Test (TAU_VALIDATE_PARALLEL is not set, can't run MPI)")
return
if not usesOption(self.makefile, "pdt"):
output("Skipping, not configured with PDT")
return
if not self.checkApplicable():
return
chdir(TEST_ROOT + "/" + self.getActualTest())
if not os.path.exists(self.buildpath):
output("Nothing to run")
return
chdir(self.buildpath)
os.environ['TAU_METRICS'] = 'GET_TIME_OF_DAY'
retval = system(parallel_runner, timeout)
if retval > 0:
self.error("Error: failed to run")
self.runresult = "fail"
elif retval < 0:
self.error("Error: timeout in run")
self.runresult = "timeout"
else:
self.checkResults()
class PdtTestC(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT (C)", makefile)
def getActualTest(self):
return "pdtc"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
return True
def runTest(self, timeout):
if usesOption(self.makefile, "mpi"):
self.runMPITest(timeout)
else:
PdtTest.runTest(self, timeout)
class PdtTestCPP(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT (C++)", makefile)
def getActualTest(self):
return "pdtcpp"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
return True
class PdtTestF(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT (Fortran)", makefile)
def getActualTest(self):
return "pdtf"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(self.makefile, "upc"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
return True
class PdtTestGF(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT (GFortran)", makefile)
def getActualTest(self):
return "pdtgf"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "scorep"):
return False
if usesOption(self.makefile, "upc"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
return True
class PdtMPITestC(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT-MPI (C)", makefile)
def getActualTest(self):
return "pdtmpic"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if not usesOption(self.makefile, "mpi"):
output("Skipping, not configured with MPI")
return False
return True
def runTest(self, timeout):
self.runMPITest(timeout)
class PdtMPITestCPP(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT-MPI (C++)", makefile)
def getActualTest(self):
return "pdtmpicpp"
def checkApplicable(self):
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if not usesOption(self.makefile, "mpi"):
output("Skipping, not configured with MPI")
return False
return True
def runTest(self, timeout):
self.runMPITest(timeout)
class PdtMPITestF(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT-MPI (Fortran)", makefile)
def getActualTest(self):
return "pdtmpif"
def checkApplicable(self):
if usesOption(self.makefile, "upc"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if not usesOption(self.makefile, "mpi"):
output("Skipping, not configured with MPI")
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
return True
def runTest(self, timeout):
self.runMPITest(timeout)
class PdtMPITestGF(PdtTest):
def __init__(self, makefile):
PdtTest.__init__(self, "PDT-MPI (GFortran)", makefile)
def getActualTest(self):
return "pdtmpigf"
def checkApplicable(self):
if usesOption(self.makefile, "upc"):
return False
if usesOption(
self.makefile, "mpi") and usesOption(
self.makefile, "epilog"):
return False
if not usesOption(self.makefile, "mpi"):
output("Skipping, not configured with MPI")
return False
if system("grep \"^TAU_F90 \" " + self.fullmakefile) != 0:
return False
return True
def runTest(self, timeout):
self.runMPITest(timeout)
def usage():
print("")
print(
"Usage: tau_validate [-v] [--html] [--tag <tag>] [--timeout <timeout>]")
print(" [--table <file>] [--build] [--run] <target>")
print("")
print("Options:")
print("")
print("-v Verbose output")
print("--html Output results in HTML")
print("--tag <tag> Validate only the subset of TAU stub makefiles matching <tag>")
print("--timeout <timeout> Give up if a test does not succeed after timeout ")
print(" seconds of runtime")
print("--table <file> Real-time creation of an addition <file> containing ")
print(" the summary table of the tests")
print("--build Only build")
print("--run Only run")
print("<target> Specify an arch directory (e.g. rs6000), or the lib")
print(" directory (rs6000/lib), or a specific makefile.")
print(" Relative or absolute paths are ok.")
print("")
print("Notes:")
print("tau_validate will attempt to validate a TAU installation by performing")
print("various tests on each TAU stub Makefile. Some degree of logic exists")
print("to determine if a given test applies to a given makefile, but it's not")
print("perfect.")
print("")
print("Example:")
print("")
print("bash : ./tau_validate --html --table table.html --timeout 180 x86_64 &> results.html")
print("tcsh : ./tau_validate --html --table table.html --timeout 180 x86_64 >& results.html")
print("")
print("Optional run scripts:")
print("Using the environment variables TAU_VALIDATE_SERIAL and TAU_VALIDATE_PARALLEL")
print("you can do custom execution of jobs. A sample parallel runner (app will ")
print("always be called 'simple'). The following is an example script parallel.sh")
print("(make sure it has execute permissions before running tau_validate):")
print("")
print("#!/bin/bash")
print("mpirun -np 2 ./simple")
print("")
print("With parallel runner:")
print("")
print("(using bash)")
print("export TAU_VALIDATE_PARALLEL=`pwd`/parallel.sh; ./tau_validate -v --html x86_64 &> results.html")
print("")
sys.exit(-1)
def cleanup():
chdir(TEST_ROOT)
system("find . -name \"build-*\" | xargs rm -rf")
system("find . -name \"profile.*\" | xargs rm -f")
system("find . -name \"scorep*\" | xargs rm -rf")
system("find . -name \"*.trc\" | xargs rm -f")
system("find . -name \"*.edf\" | xargs rm -f")
system("find . -name \"*.pdb\" | xargs rm -f")
system("find . -name \"*.elg\" | xargs rm -f")
system("find . -name \"core.*\" | xargs rm -f")
system("find . -name \"*.o\" | xargs rm -f")
system("find . -name \"*.inst.*\" | xargs rm -f")
system("find . -name \"simple\" | xargs rm -f")
# execution starts here
errorsFound = 0
PWD = os.getcwd()
TEST_ROOT = PWD + "/examples/validate"
args = sys.argv[1:]
verbose = False
html = False
target = ""
optRun = False
optBuild = False
optClean = False
optTag = False
nextArgTag = False
nextArgTimeout = False
separateTable = True
separateTable = False
nextArgTable = False
table_filename = None
tag = ""
timeout_sec = None
for arg in args:
if nextArgTag:
tag = arg
nextArgTag = False
elif nextArgTimeout:
try:
timeout_sec = int(arg)
except ValueError:
print("timeout must be an integer number of seconds")
print("you provided: ", arg)
usage()
nextArgTimeout = False
elif nextArgTable:
table_filename = arg
nextArgTable = False
elif arg == "-v":
verbose = True
elif arg == "--html":
verbose = True
html = True
elif arg == "--build":
optBuild = True
elif arg == "--run":
optRun = True
elif arg == "--clean":
optClean = True
elif arg == "--tag":
optTag = True
nextArgTag = True
elif arg == "--timeout":
nextArgTimeout = True
elif arg == "--table":
separateTable = True
nextArgTable = True
else:
if target != "":
usage()
target = arg
if optClean:
print("Cleaning...")
verbose = True
cleanup()
sys.exit(0)
# if neither is specified, do both
if not optRun and not optBuild:
optBuild = True
optRun = True
if target == "":
usage()
target = os.path.realpath(target)
if 'TAU_VALIDATE_SERIAL' in os.environ:
serial_runner = os.environ['TAU_VALIDATE_SERIAL']
if 'TAU_VALIDATE_PARALLEL' in os.environ:
parallel_runner = os.environ['TAU_VALIDATE_PARALLEL']
begin()