Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying The C++ Programmer's Mindset
  • Table Of Contents Toc
  • Feedback & Rating feedback
The C++ Programmer's Mindset

The C++ Programmer's Mindset

By : Sam Morley
close
close
The C++ Programmer's Mindset

The C++ Programmer's Mindset

By: Sam Morley

Overview of this book

Solve complex problems in C++ by learning how to think like a computer scientist. This book introduces computational thinking—a framework for solving problems using decomposition, abstraction, and pattern recognition—and shows you how to apply it using modern C++ features. You'll learn how to break down challenges, choose the right abstractions, and build solutions that are both maintainable and efficient. Through small examples and a large case study, this book guides you from foundational concepts to high-performance applications. You’ll explore reusable templates, algorithms, modularity, and even parallel computing and GPU acceleration. With each chapter, you’ll not only expand your C++ skillset, but also refine the way you approach and solve real-world problems. Written by a seasoned research engineer and C++ developer, this book combines practical insight with academic rigor. Whether you're designing algorithms or profiling production code, this book helps you deliver elegant, effective solutions with confidence.
Table of Contents (19 chapters)
close
close
18
Index

Coordinating between GPU threads

Within a single warp or thread block, there are methods of communicating and synchronizing threads. The main mechanisms are the synchronization primitives, such as __syncthreads, which block progress until all active threads in the block reach the same point, and shared memory. Shared memory is shared between all the threads in a block, so it can be used as a fast interchange for data, usually as a store for temporary values that are sequentially updated by all the threads in the block. Using only these two mechanisms, one can implement a fairly efficient matrix multiplication kernel with relatively little effort:

__global__ void matrix_mul(
    float* __restrict__ C, // m by n matrix, row major
    const float* __restrict__ A, // m by k matrix, row major
    const float* __restrict__ B, // k by n matrix, row major
    int m, int n, int k) {
    constexpr int tile_size = 16; // block is tile_size by tile_size
    int tx = threadIdx.x;
    int ty...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
The C++ Programmer's Mindset
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon