liveBook · Manning

Hardware

As explained in Fast Python: High performance techniques for large datasets

Hardware is the physical equipment and components of a computing system that provide resources for computation and software execution.

Hardware is the physical computing equipment that runs software. For performance work, it includes the CPU, memory, local storage, and network. An optimization that helps on one architecture may be a poor choice on another, so the available resources matter alongside the data and algorithm. section 6.1 section 1.2

Follow where data lives and moves: through CPU caches, RAM, disks, local networks, and wider networks. These layers affect both processing speed and storage efficiency. For example, working with compressed data can sometimes be faster than working with uncompressed data despite the extra decompression, overturning a simple computation-only cost estimate. section 6.0

Account for a GPU transfer

To multiply every element of a 1024 × 64 matrix by 2 on a GPU, first transfer the matrix from CPU-side memory to GPU memory. The 65,536 elements can then run as separate threads. At an assumed 32 threads per block, that is 2,048 blocks. Transfer cost may outweigh the computation when the operation is this small; the CPU launches the GPU kernel. section 9.1.4

Choose an approach for the machine and workload rather than applying every available optimization. CPU design, GPUs, storage, networks, clusters, and cloud environments offer different advantages and trade-offs; Python libraries can help exploit particular hardware effects. section 1.4 section 6.1

How Fast Python: High performance techniques for large datasets covers it

How deep it goes
Surveys performance-relevant components and data movement rather than attempting an exhaustive account of computer architecture.
Examples
Uses compressed-array access and a GPU matrix operation to expose counterintuitive costs and data-transfer overhead.
What you can do after
Evaluate/understand hardware trade-offs when selecting Python performance techniques for available resources and workloads.
How it connects
Connects CPU caches, memory hierarchy, compression, storage, networking, and GPU computing to software performance.

Also explained in

Compare how 3 books explain hardware →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast Python: High performance techniques for large datasets. The section links point to the parts of the book it draws on.