0Pricing
CUDA Academy · レッスン

グローバルメモリのトレードオフ

大容量で低速ですが、すべてのスレッドから利用できます。

「グローバルメモリのトレードオフ」はCoddyKit上の無料CUDA Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはCUDA Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 CUDA Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

The Biggest Space You Have

Global memory is the GPU's main DRAM, often many gigabytes. It is where your big input and output arrays naturally live during a kernel.

Visible to Everyone

Every thread in every block can read and write global memory. That shared visibility is exactly why you copy your data there before launching. 🌍

You Allocate It with cudaMalloc

You reserve global memory from the host with cudaMalloc, which hands you a device pointer to that DRAM region.

float *d_a;
cudaMalloc(&d_a, n * sizeof(float));

Large but Slow

The catch is latency. A single global memory read can cost hundreds of clock cycles, far more than a register access ever would.

Bandwidth Is the Real Limit

Many kernels are bound not by math but by how fast bytes flow from DRAM. We call these memory-bound kernels.

Hiding Latency with Threads

The GPU hides slow reads by switching to other ready warps while one waits. This latency hiding is why having many threads matters so much.

It Persists Across Launches

Data in global memory stays put between kernel launches until you free it. You can run several kernels over the same buffers.

Cached by L2

A unified L2 cache sits in front of global memory for the whole GPU. Reused addresses can be served from it instead of slow DRAM.

Access Pattern Decides Speed

How threads map to addresses hugely affects throughput. Neighboring threads touching neighboring addresses is what later lessons call coalescing.

Minimize the Trips

The core strategy is simple: touch global memory as few times as possible. Read once, reuse on-chip, then write once.

Free What You Allocate

Because global memory is a finite resource, release it with cudaFree when you are done to avoid leaking device memory.

cudaFree(d_a);

Quick Check

Which statement best captures the tradeoff of global memory?

Recap: Big, Shared, Slow

You now know global memory is the GPU's large, all-visible DRAM that trades capacity for high latency. Touch it rarely and reuse data on-chip. 🚀

よくある質問

「グローバルメモリのトレードオフ」レッスンは無料ですか?

はい。「グローバルメモリのトレードオフ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、CUDA Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 CUDA Academyコースには全4レッスンが含まれています。

「グローバルメモリのトレードオフ」で何を学びますか?

大容量で低速ですが、すべてのスレッドから利用できます。 ブラウザで直接実行するハンズオンコードでCUDA Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

CUDA Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのCUDA Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「グローバルメモリのトレードオフ」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このCUDA Academyレッスンでコードを書いて実行できますか?

はい。すべてのCUDA Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. レジスターとローカルメモリ
  2. グローバルメモリのトレードオフ
  3. コンスタントメモリとそのキャッシュ
  4. メモリ階層のメンタルモデル
← CUDA Academyに戻る