Skip to content

Commit 30d416e

Browse files
authored
Survey Enhancement: Matrix Multiplication Details & Response Download (#45)
* update survey of GEMM about matrix dimensions. * update the survey that after submission, user can either download PDF or print the answers
1 parent 5813d86 commit 30d416e

7 files changed

Lines changed: 1858 additions & 654 deletions

File tree

app/globals.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,50 @@ body {
146146
border-color: #3b82f6 !important;
147147
}
148148
}
149+
150+
/* Print styles for survey response summary */
151+
@media print {
152+
.no-print {
153+
display: none !important;
154+
}
155+
156+
.print-break {
157+
page-break-before: always;
158+
}
159+
160+
.print-avoid-break {
161+
page-break-inside: avoid;
162+
}
163+
164+
body {
165+
font-size: 12px;
166+
line-height: 1.4;
167+
}
168+
169+
.survey-summary {
170+
color: #000 !important;
171+
background: #fff !important;
172+
}
173+
174+
.survey-summary h1,
175+
.survey-summary h2,
176+
.survey-summary h3 {
177+
color: #000 !important;
178+
}
179+
180+
.survey-summary .bg-blue-50,
181+
.survey-summary .bg-green-50,
182+
.survey-summary .bg-gray-50 {
183+
background: #f8f9fa !important;
184+
border: 1px solid #dee2e6 !important;
185+
}
186+
187+
.survey-summary button {
188+
display: none !important;
189+
}
190+
191+
.survey-summary .shadow-lg,
192+
.survey-summary .shadow-xl {
193+
box-shadow: none !important;
194+
}
195+
}

app/survey/matrix-multiplication-data.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const matrixMultiplicationData: SurveySection[] = [
117117
id: 'gemm-matrix-size',
118118
title: 'Matrix Size Range',
119119
type: 'checkbox',
120-
content: 'What are your typical matrix dimensions?',
120+
content: 'What are your typical maximum matrix dimensions? (Please consider the largest dimension across m, n, k in C = A×B where A is m×k and B is k×n)',
121121
options: [
122122
'Small (< 100)',
123123
'Medium (100 - 1,000)',
@@ -126,6 +126,22 @@ export const matrixMultiplicationData: SurveySection[] = [
126126
'Extreme (> 100,000)'
127127
]
128128
},
129+
{
130+
id: 'gemm-matrix-shape',
131+
title: 'Typical Matrix Shapes',
132+
type: 'checkbox',
133+
content: 'What are the typical shapes of your matrices in multiplication operations? Select all that apply:',
134+
options: [
135+
'Square matrices (m ≈ n ≈ k)',
136+
'Tall-skinny matrices (m >> k, n small)',
137+
'Wide-short matrices (m small, n >> k)',
138+
'Block-outer product (k small, m and n large)',
139+
'Block-inner product (m and n small, k large)',
140+
'General rectangular (no dominant pattern)',
141+
'Varies significantly by operation',
142+
'Other (please specify):'
143+
]
144+
},
129145
{
130146
id: 'gemm-batch-size',
131147
title: 'Batch Size',

app/survey/nla-app-sim/page.tsx

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import { useState, useEffect, useMemo, useRef } from 'react';
44
import { surveyData, SurveyQuestion } from '../index';
55
import { supabase } from '@/lib/supabase';
6+
import SurveyResponseSummary from '@/components/SurveyResponseSummary';
7+
import { generateSurveyPDF } from '@/lib/pdfGenerator';
68

79
interface FormData {
810
[key: string]: string | string[] | boolean;
@@ -806,38 +808,35 @@ export default function NlaAppSimSurveyPage() {
806808
);
807809
};
808810

811+
const handleDownloadPDF = () => {
812+
try {
813+
generateSurveyPDF(formData, surveyData);
814+
} catch (error) {
815+
console.error('Error generating PDF:', error);
816+
alert('Error generating PDF. Please try again.');
817+
}
818+
};
819+
820+
821+
const handlePrint = () => {
822+
window.print();
823+
};
824+
825+
const handleSubmitAnother = () => {
826+
setSubmitted(false);
827+
setFormData({});
828+
setCompletedSections(new Set());
829+
setCollapsedSections(new Set(surveyData.map(section => section.id)));
830+
};
831+
809832
if (submitted) {
810833
return (
811-
<div className="min-h-screen bg-gray-50 py-12">
812-
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
813-
<div className="bg-white rounded-lg shadow-lg p-8 text-center">
814-
<div className="text-green-600 mb-4">
815-
<svg className="w-16 h-16 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
816-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
817-
</svg>
818-
</div>
819-
<h1 className="text-2xl font-bold text-gray-900 mb-4">Thank You!</h1>
820-
<p className="text-gray-600 mb-6">
821-
Your survey response has been submitted successfully. We appreciate your input for our NLA operations and benchmarking preparation!
822-
</p>
823-
{formData['multiple-use-cases'] === 'Yes, multiple distinct use cases' &&
824-
formData['total-use-cases'] !== 'Just this one' && (
825-
<p className="text-blue-600 mb-6">
826-
You indicated that you have multiple use cases. Please feel free to submit another response for a different use case of your library.
827-
</p>
828-
)}
829-
<button
830-
onClick={() => {
831-
setSubmitted(false);
832-
setFormData({});
833-
}}
834-
className="bg-blue-600 text-white px-6 py-2 rounded-md hover:bg-blue-700 transition-colors"
835-
>
836-
Submit Another Response
837-
</button>
838-
</div>
839-
</div>
840-
</div>
834+
<SurveyResponseSummary
835+
formData={formData}
836+
onDownloadPDF={handleDownloadPDF}
837+
onPrint={handlePrint}
838+
onSubmitAnother={handleSubmitAnother}
839+
/>
841840
);
842841
}
843842

0 commit comments

Comments
 (0)