Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ As we learned, MPI does not construct buffers from variables; it reads a specifi

In a given programming language, an array can be _row major oriented_ or _column major oriented_. In a row-major oriented language (most of them, including C/C++ and Python) a two-dimensional array is represented in memory in terms of its indices as

{{< diagram >}}
{{< diagram alt="Diagram showing a 4×4 two-dimensional array stored in row-major order, where elements are laid out row by row and the second index changes fastest in memory." >}}
flowchart LR
A[0,0] --- B[0,1]
B --- C[0,2]
Expand All @@ -40,7 +40,7 @@ In C/C++ the rows may or may not be contiguous in memory, but the elements of ea

In a column-major oriented language (Fortran and some others such as Matlab, Julia, and R) the layout is by column. These languages also count from 1, at least by default, as represented below.

{{< diagram >}}
{{< diagram alt="Diagram showing a 4×4 two-dimensional array stored in column-major order, where elements are laid out column by column and the first index changes fastest in memory." >}}
flowchart LR
A[1,1] --- B[2,1]
B --- C[3,1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The landscape service has several tasks to perform.   

We can draw a graph to help us understand the sequence of events.

{{< diagram >}}
{{< diagram alt="Diagram showing landscaping workflow: turn off security system, perform mowing, edging, and weeding in parallel, set sprinklers, then turn security system back on." >}}
graph TD;
A(Turn off Security System) --> B(Edge Lawn)
A(Turn off Security System) --> C(Mow Lawn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ menu:

We can represent the optimization process with a flowchart:

{{< diagram >}}
{{< diagram alt="Flowchart of the optimization process: profile code, tune the slowest section, check for performance improvement, then repeat or try a different solution." >}}
graph TD;
A(Profile or time) --> B(Tune the slowest section);
B --> C{Performance increase?};
Expand All @@ -20,7 +20,7 @@ C -- No --> E(Try a different solution);
D --> A
{{< /diagram >}}

There are many approaches to speeding up sections, some specific to Python and some more generic. In this section we will consider several possibilities.
There are many many approaches to speeding up sections, some specific to Python and some more generic. In this section we will consider several possibilities.

### Avoid for Loops

Expand Down