Pragformer commited on
Commit
cd15d50
1 Parent(s): 83fdac1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -28
app.py CHANGED
@@ -76,11 +76,45 @@ def is_reduction(code_txt, label):
76
  # Define GUI
77
 
78
  with gr.Blocks() as pragformer_gui:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  gr.Markdown(
80
  """
81
- # PragFormer Pragma Classifiction
82
 
83
-
84
  In past years, the world has switched to many-core and multi-core shared memory architectures.
85
  As a result, there is a growing need to utilize these architectures by introducing shared memory parallelization schemes to software applications.
86
  OpenMP is the most comprehensive API that implements such schemes, characterized by a readable interface.
@@ -98,35 +132,15 @@ with gr.Blocks() as pragformer_gui:
98
 
99
  ![](https://user-images.githubusercontent.com/104314626/165228036-d7fadd8d-768a-4e94-bd57-0a77e1330082.png)
100
 
101
- Link to [PragFormer](https://arxiv.org/abs/2204.12835) Paper
102
- """)
103
 
104
- with gr.Row():
105
-
106
- with gr.Column():
107
- gr.Markdown("## Input")
108
- with gr.Row():
109
- with gr.Column():
110
- drop = gr.Dropdown(list(data.keys()), label="Random Code Snippet", value="LLNL/AutoParBench/benchmarks/Autopar/NPB3.0-omp-c/BT/bt/129")
111
- sample_btn = gr.Button("Sample")
112
-
113
- pragma = gr.Textbox(label="Pragma")
114
-
115
- code_in = gr.Textbox(lines=5, label="Write some code and see if it should be parallelized with OpenMP")
116
- submit_btn = gr.Button("Submit")
117
- with gr.Column():
118
- gr.Markdown("## Results")
119
- label_out = gr.Textbox(label="Label")
120
- confidence_out = gr.Textbox(label="Confidence")
121
 
122
- with gr.Row():
123
- private = gr.Textbox(label="Private", visible=False)
124
- reduction = gr.Textbox(label="Reduction", visible=False)
 
 
125
 
126
- submit_btn.click(fn=predict, inputs=code_in, outputs=[label_out, confidence_out])
127
- submit_btn.click(fn=is_private, inputs=code_in, outputs=private)
128
- submit_btn.click(fn=is_reduction, inputs=code_in, outputs=reduction)
129
- sample_btn.click(fn=fill_code, inputs=drop, outputs=[pragma, code_in])
130
 
131
 
132
  pragformer_gui.launch()
 
76
  # Define GUI
77
 
78
  with gr.Blocks() as pragformer_gui:
79
+
80
+ gr.Markdown(
81
+ """
82
+ # PragFormer Pragma Classifiction
83
+
84
+ """)
85
+
86
+ #with gr.Row(equal_height=True):
87
+ with gr.Column():
88
+ gr.Markdown("## Input")
89
+ with gr.Row():
90
+ with gr.Column():
91
+ drop = gr.Dropdown(list(data.keys()), label="Random Code Snippet", value="LLNL/AutoParBench/benchmarks/Autopar/NPB3.0-omp-c/BT/bt/129")
92
+ sample_btn = gr.Button("Sample")
93
+
94
+ pragma = gr.Textbox(label="Pragma")
95
+
96
+ code_in = gr.Textbox(lines=5, label="Write some code and see if it should be parallelized with OpenMP")
97
+ submit_btn = gr.Button("Submit")
98
+ with gr.Column():
99
+ gr.Markdown("## Results")
100
+
101
+ with gr.Row():
102
+ label_out = gr.Textbox(label="Label")
103
+ confidence_out = gr.Textbox(label="Confidence")
104
+
105
+ with gr.Row():
106
+ private = gr.Textbox(label="Private", visible=False)
107
+ reduction = gr.Textbox(label="Reduction", visible=False)
108
+
109
+ submit_btn.click(fn=predict, inputs=code_in, outputs=[label_out, confidence_out])
110
+ submit_btn.click(fn=is_private, inputs=code_in, outputs=private)
111
+ submit_btn.click(fn=is_reduction, inputs=code_in, outputs=reduction)
112
+ sample_btn.click(fn=fill_code, inputs=drop, outputs=[pragma, code_in])
113
+
114
  gr.Markdown(
115
  """
116
+ ## Description
117
 
 
118
  In past years, the world has switched to many-core and multi-core shared memory architectures.
119
  As a result, there is a growing need to utilize these architectures by introducing shared memory parallelization schemes to software applications.
120
  OpenMP is the most comprehensive API that implements such schemes, characterized by a readable interface.
 
132
 
133
  ![](https://user-images.githubusercontent.com/104314626/165228036-d7fadd8d-768a-4e94-bd57-0a77e1330082.png)
134
 
 
 
135
 
136
+ ## How it Works?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
+ To use the PragFormer tool, you will need to input a C language for-loop. You can either write your own code or use the samples
139
+ provided in the dropdown menu, which have been gathered from GitHub. Once you submit the code, the PragFormer model will analyze
140
+ it and predict whether the for-loop should be parallelized using OpenMP. If the PragFormer model determines that parallelization
141
+ is necessary, two additional models will be used to determine if private or reduction clauses are needed.
142
+ """)
143
 
 
 
 
 
144
 
145
 
146
  pragformer_gui.launch()