-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpi_usage_analysis.py
executable file
·71 lines (52 loc) · 2.69 KB
/
mpi_usage_analysis.py
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
#!/usr/bin/env python3
# coding: utf-8
from AnalysisModule.analysismanager import AnalysisManager
from AnalysisModule.MPIAnalysisModule.CallAnalysis import MPICallAnalysis
from AnalysisModule.DefineAnalysis import DefineAnalysis
from AnalysisModule.HybridAnalysisModule.OpenMPAnalysis import OpenmpAnalysis
from AnalysisModule.HybridAnalysisModule.OpenACCAnalysis import OpenaccAnalysis
from AnalysisModule.HybridAnalysisModule.CudaAnalysis import CudaAnalysis
from AnalysisModule.HybridAnalysisModule.CudaAnalysis import OpenCLAnalysis
from AnalysisModule.PostProcessModule.post_process import post_process_data
import argparse
import pandas as pd
import os
def parseArgs():
parser = argparse.ArgumentParser()
parser.add_argument('--output', default='output.csv',
help='result data')
parser.add_argument('--intermediate', default='intermediate.csv',
help='intermediate "raw" data before cross-referencing')
parser.add_argument('--code_locations', default='code_locations.csv',
help='name of the csv file, where the repository urls are located')
parser.add_argument('--repo_path', default='repositories',
help='Path where all the repositories should be downloaded to')
parser.add_argument('--refresh_repos', action='store_true',
help='Re download all repositories and re-fresh their analysis results')
parser.add_argument('--delete_repos', action='store_true',
help='Delete all repositories after analysis')
return parser.parse_args()
def main():
args = parseArgs()
# create dir where the repositories will bbe downloaded to
if not os.path.isdir(args.repo_path):
os.mkdir(args.repo_path)
# set up the Analysis Manager handeling all the analysis
repoAnalyzer = AnalysisManager(args.intermediate, args.repo_path, args.refresh_repos, not args.delete_repos)
repoAnalyzer.register_analysis(MPICallAnalysis())
repoAnalyzer.register_analysis(DefineAnalysis())
repoAnalyzer.register_analysis(OpenmpAnalysis())
repoAnalyzer.register_analysis(OpenaccAnalysis())
repoAnalyzer.register_analysis(OpenCLAnalysis())
repoAnalyzer.register_analysis(CudaAnalysis())
# read in the code location information
df = pd.read_csv(args.code_locations, header=0)
# run Analysis
intermediate_result_df = repoAnalyzer(df)
# intermediate results will be written by the analysis Manager
print("Repository Analysis Complete")
result_df = post_process_data(intermediate_result_df)
result_df.to_csv(args.output, index=False)
print(f"Result file written: {args.output}")
if __name__ == "__main__":
main()