An email thread started from a question from Leo [1] stimulated me to add a QQz on Paul's experience back in 2009. As \QuickQuizLabel{} inside \QuickQuizSeries{} doesn't work in -nq builds, define \QuickQuizLabelRel{}{} and put it in front of the series. Link: [1] https://www.spinics.net/lists/perfbook/msg03824.html Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> Cc: Leonardo Brás <leobras.c@xxxxxxxxx> --- v2: Place new QQz next to QQz 3.7 -- cpu/overheads.tex | 28 +++++++++++++++++++++++----- qqz.sty | 16 ++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/cpu/overheads.tex b/cpu/overheads.tex index 0d8270bf6e17..a89c71158bf9 100644 --- a/cpu/overheads.tex +++ b/cpu/overheads.tex @@ -290,12 +290,15 @@ nanoseconds, or more than seven hundred clock cycles. A CAS operation consumes almost a full microsecond, or almost two thousand clock cycles. -\QuickQuiz{ +\QuickQuizLabelRel{\QspeedOfLightAtoms}{1} % cann't put label inside QQSeries + +\QuickQuizSeries{% +\QuickQuizB{ Surely the hardware designers could be persuaded to improve this situation! Why have they been content with such abysmal performance for these single-instruction operations? -}\QuickQuizAnswer{ +}\QuickQuizAnswerB{ The hardware designers \emph{have} been working on this problem, and have consulted with no less a luminary than the late physicist Stephen Hawking. @@ -423,9 +426,24 @@ thousand clock cycles. \Cref{sec:cpu:Hardware Free Lunch?} looks at what else hardware designers might be able to do to ease the plight of parallel programmers. -}\QuickQuizEnd - -\QuickQuizLabel{\QspeedOfLightAtoms} +}\QuickQuizEndB +% +\QuickQuizE{ + \Cref{tab:cpu:Performance of Synchronization Mechanisms on 16-CPU 2.8GHz Intel X5550 (Nehalem) System} + in the answer to \QuickQuizARef{\QspeedOfLightAtoms} says that + In-Core CAS is faster than both of Same-CPU CAS and In-Core Blind CAS\@. + What is happening there? +}\QuickQuizAnswerE{ + I \emph{was} surprised by the data I obtained and did a rigorous + check of their validity. + I got the same result persistently. + One theory that might explain the observation would be: + The two threads in the core are able to overlap their accesses, + while the single CPU must do everything sequentially. + Unfortunately, there seems to be no public documentation explaining + why the Intel X5550 (Nehalem) system behaved like that. +}\QuickQuizEndE +} % End of \QuickQuizSeries \begin{table} \rowcolors{1}{}{lightgray} diff --git a/qqz.sty b/qqz.sty index a3a9f22d1ba9..5c7eb5340194 100644 --- a/qqz.sty +++ b/qqz.sty @@ -156,6 +156,11 @@ % To create a macro referencing the previously defined quick quiz: % \QuickQuizLabel{\QQname} +% +% When labeling a QQz inside \QuickQuizSeries{}, use +% \QuickQuizLabelRel{\QQname}{rel} +% in front of the series. +% % To reference the macro in the text: % \QuickQuizRef{\QQname} % To reference the answer of the macro in the text: @@ -166,6 +171,11 @@ \newcommand{\QuickQuizLabel}[1]{ \edef#1{\thechapter.\thequickquizctrP} } +\newcommand{\QuickQuizLabelRel}[2]{ + \addtocounter{quickquizctrP}{#2} + \QuickQuizLabel{#1} + \addtocounter{quickquizctrP}{-#2} +} \newcommand{\QuickQuizRef}[1]{% \hyperref[QQ.#1]{Quick Quiz~#1}% } @@ -176,6 +186,12 @@ \newcommand{\QuickQuizLabel}[1]{ \edef#1{\thechapter.\thequickquizctr} } +\newcommand{\QuickQuizLabelRel}[2]{ + \addtocounter{quickquizctr}{#2} + \QuickQuizLabel{#1} + \addtocounter{quickquizctr}{-#2} +} + \newcommand{\QuickQuizRef}[1]{% \hyperref[QQ.#1]{Quick Quiz~#1}% } base-commit: 14440e232cc1b2580dc1a73f873dc29fe3aea02b -- 2.25.1