Git Product home page Git Product logo

perf-book's Introduction

Build PDF Windows

X (formerly Twitter) Follow GitHub Repo stars

perf-book

This is a repository with source files of the book "Performance Analysis and Tuning on Modern CPU" by Denis Bakhvalov, et al.

Second edition work in progress! Planned changes are outlined in the google document. The planned new table of contents is in new_toc.md.

My goal is to accumulate as much knowledge as possible from all the best experts in the industry. And of course, share that knowledge with you. Contributions are welcome.

Contributing

There are many ways how you can help.

  • You can author a section(s) on a topic you are an expert in. But let me know before you start.
  • Small improvements are welcome without prior approval, just open a new PR.
  • Feel free to propose ideas for new content.
  • Reviewers with all backgrounds are needed.

Check out the discussions page to start.

For examples on how to add images, table, code listings, etc, see how-to.md.

Building a book (pdf)

At the moment, building a PDF only works on Windows and Linux. MacOS requires building some components (e.g. pandoc-crossref from sources).

Requirements:

  • Python3. Install natsort module: pip install natsort.
  • pandoc - install version 2.9.
  • install pandoc filters: pip install pandoc-fignos pandoc-tablenos
  • install pandoc-crossref. This one requires manual installation. I just downloaded the binary from here and copied it to the same place where pandoc-fignos is.
  • MiKTeX - check Yes for automatic package installation

Run:

# Linux bash and Windows cmd prompt
python export_book.py && pdflatex book.tex && bibtex book && pdflatex book.tex && pdflatex book.tex

# Windows powershell
function Run-Block-With-Error($block) {
    $ErrorActionPreference="Stop"
    Invoke-Command -ScriptBlock $block
}
Run-Block-With-Error {python.exe export_book.py; pdflatex book.tex; bibtex book; pdflatex book.tex; pdflatex book.tex}

As a result, book.pdf will be generated. The first compilation may be slow due to the installation of required packets.

License

Creative Commons Zero v1.0 Universal

perf-book's People

Contributors

aaupov avatar alois-xx avatar cf-natali avatar chusab avatar dendibakh avatar denisbakhvalov avatar jan-wassenberg avatar pveentjer avatar stanciuadrian avatar thanelmas avatar thetheodor avatar thewatchmen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perf-book's Issues

Thanks for the book...but i have error on pdflatex

I'm running win10 wsl 1.0 (windows subsystem for linux). I hope it run on only commandline because I don't have X windows installed (too big!) I've also installed MiKTeX using ubuntu 20.04 guide and finished up with shared set up. This is the portion of the error when building the book:

./chapters/13-Glossary/13-0 Glossary.md'
./chapters/14-Appendix/Appendix-A.md
./chapters/14-Appendix/Appendix-B.md
[WARNING] Note with key '12' defined at line 29 column 1 but not used.
[WARNING] Note with key '4' defined at line 30 column 1 but not used.

pandoc-fignos: Bad reference: @fig:Averages1.

pandoc-fignos: Bad reference: @fig:Averages2.

pandoc-fignos: Bad reference: @fig:BB_default.

pandoc-fignos: Bad reference: @fig:BB_better.

pandoc-fignos: Bad reference: @fig:FuncGroup_default.

pandoc-fignos: Bad reference: @fig:FuncGroup_better.

pandoc-fignos: Bad reference: @fig:MT_Scaling.

pandoc-fignos: Bad reference: @fig:MT_cycles.
pdflatex: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

$

what is libQt5Core.so.5 ? i've also installed pdflatex but no change in the error :(
any idea what i'm missing?

[Suggestion] Move some sections in Chapter 7. CPU Features For Performance Analysis to appendix

Currently, we have in Chapter 7. CPU Features For Performance Analysis:

7-1 Top-Down Microarchitecture Analysis (TMA)
7-2 Last Branch Record (LBR)
7-3 Precise Event Based Sampling (PEBS)
7-4 Intel Processor Traces (PT)

Not all of this stuff is relevant to the broad audience, but some people would still like to know this.
So maybe the appendix would be a better place for some of the sections.
For example, Intel PT is a good candidate.

Incorrect the code line number on page 96

Looks like on page 96 there is a typo. The text there references to dependency introduced inside the loop. The loop starts at line 5, really. But the dependency is on the line 6.

image

Windows build fail with UnicodeDecodeError

The error log:

Traceback (most recent call last):
  File "D:\workspace\perf-book-main\export_book.py", line 74, in <module>
    lines = f.readlines()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 3820: illegal multibyte sequence

the reason is that file encoding is not utf-8. I add the param of encoding="utf-8", it build suceed。

texFile = 'book.tex'
editTexFile = 'book_edit.tex'

with open(texFile, 'r', encoding="utf-8") as f:
    lines = f.readlines()

with open(editTexFile, 'w', encoding="utf-8") as g:
    chapterRefs = []
    prev = ""

Section 3.7 on SIMD Multiprocessors : clarify reference

Section 3.7 starts with "in contrast to the MIMD approach described in the previous section"

But the previous section is about virtual memory. Abbreviation MIMD is also never explained (although it can be inferred from the context).

Cut text on the page 37

On page 37 on the bottom the the text is cut:

image

In the digital version of the book the text is printed correctly.

image

Failed to get a complete build

Nice book!

I have pandoc 2.16.2 and pandoc-crossref (built with pandoc 2.16) installed, however, I got the error LaTeX Error: Environment pandoccrossrefsubfigures undefined.

I ignored all the error messages and finally got a pdf book with 176 pages. I don't know if it is a complete book.

Here is the detailed message

Underfull \hbox (badness 10000) in paragraph at lines 1442--1442
[][][]\T1/lmr/m/n/9 (+20) Book ``Work-load Mod-el-ing for Com-puter Sys-tems Pe
r-for-mance Eval-u-a-tion'' -
[23 <./img//1/CompDist2.png>]

! LaTeX Error: Environment pandoccrossrefsubfigures undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.1470 \begin{pandoccrossrefsubfigures}

Env. info

macOS Big Sur

$ pandoc --version
pandoc 2.16.2
Compiled with pandoc-types 1.22.1, texmath 0.12.3.3, skylighting 0.12.1,
citeproc 0.6, ipynb 0.1.0.2
User data directory: /Users/gavin/.local/share/pandoc
Copyright (C) 2006-2021 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

$ pandoc-crossref --version
pandoc-crossref v0.3.12.1 git commit 0a47293d7d47aa763e82204e13deabc8f1a041c4 (HEAD) built with Pandoc v2.16.2, pandoc-types v1.22.1 and GHC 8.10.7

$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)
kpathsea version 6.3.0
Copyright 2018 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.34; using libpng 1.6.34
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.00

$ bibtex --version
BibTeX 0.99d (TeX Live 2018)
kpathsea version 6.3.0
Copyright 2018 Oren Patashnik.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the BibTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the BibTeX source.
Primary author of BibTeX: Oren Patashnik.

Perf Stat Topdown Not Available

Thanks for this wonderful book. It's a pleasure to read it and there's a lot to learn from it.

Section 6.1.1 paragraph "Step1: Identify the Bottleneck" mentions:

As of Linux kernel 4.8, perf has an option --topdown used in perf stat command that prints TMA Level 1 metrics.

and that the benchmark was run with:

We ran the experiments on the machine equipped with Intel Core i5-8259U CPU (Skylake based) and 16GB of DRAM (DDR4 2400 MT/s), running 64-bit Ubuntu 20.04 (kernel version 5.13.0-27).

Is this correct or could further clarification be helpful?

I cannot run the example because I receive the error System does not support topdown. I have the following configuration:

  • Kernel version: 5.15.0-92-generic
  • Alder Lake, i7-12850HX

There's also a stackoverflow post mentioning that topdown is only available for Alderlake on Linux 6.5

Target platform’s minimum alignment requirements: example is needed

image

In the text snippet above it would be beneficial to have an example of what is "minimum alignment requirement". When I read that sentence for the first time I was sure that "minimum alignment requirements" is 64 bytes. But later, after I read that sentence 5 times I understood that here you mean values like 4, 8 or16.

[Suggestion] Custom releases

Hello,

Firstly, I greatly appreciate your effort. Thank you so much for reading this.

I do have a comment, which is more of a question. Would it be possible to provide additional release formats, such as A5 PDF (for printing two pages on a single A4), or better yet, to simplify or automate the build process to support more recent Pandoc versions, without relying directly on copied binaries, if possible?

Time per instruction on pipelined machine

Hi, I was confused by this formula on page 31:
"Time per instruction on pipelined machine = Time per instruction on non-pipelined machine / Number of pipe stage"

My understanding is that the time per instruction is the same on pipelined machine or non-pipelined machine, since pipeline only improves the throughput but not the latency. If the "Time per instruction on pipelined machine" is decreased compared to non-pipeline machine, the only reason is that the frequency increases. Is there any misunderstanding here?

Table title is not noticible

It is hard to notice the table title in the book.

For example, on page 12 the font of the Table 1 title is the same as font the rest of text in the book and it took me a while to find the Table 1 referenced elsewhere :)

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.