0Pricing
CUDA Academy · Ders

Ayrı Adres Alanları

Ana bilgisayar göstergesinin cihazda neden geçersiz olduğunu öğrenin.

Ayrı Adres Alanları, CoddyKit'te ücretsiz bir CUDA Academy dersidir. Bu, 4 dersinin 3. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, CUDA Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. CUDA Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Two Separate Memories

The CPU and GPU each own their own RAM. They do not share one address space, and that single fact shapes all of CUDA. 🧠

What an Address Means

A pointer is just a number naming a slot in memory. That slot only makes sense in the address space where it was created.

Host Pointers Are Local

A pointer from malloc names host memory. The GPU has no such slot, so handing it to a kernel points nowhere valid.

int* h = (int*)malloc(n * sizeof(int));

Device Pointers Are Local Too

A pointer from cudaMalloc names device memory. The CPU cannot read it directly; dereferencing it on the host crashes.

int* d;
cudaMalloc(&d, n * sizeof(int));

The Classic Mistake

Passing a host pointer into a kernel compiles fine but fails at runtime. The number is valid; the memory it names is not on the GPU.

Why It Compiles Anyway

Both pointers look like the same type to C++, so the compiler stays silent. The mismatch only bites when the GPU touches the address.

Bridging with cudaMemcpy

To move data between spaces you must copy it explicitly with cudaMemcpy. There is no automatic sharing across the divide.

cudaMemcpy(d, h, bytes, cudaMemcpyHostToDevice);

A Naming Convention Helps

Many programmers prefix host pointers with h_ and device pointers with d_. It is a habit that prevents painful mix-ups.

float *h_a, *d_a;

Kernels See Device Space

Inside a kernel every pointer you dereference must live in device memory. That is the only space the GPU threads can reach.

Unified Memory Hint

Later you will meet unified memory, one pointer valid on both sides. For now, keep host and device pointers strictly apart.

The Mental Model

Picture two rooms with no shared shelves. To use data in the other room you must carry a copy over, never just point across.

Quick Check

Let us confirm you understand separate address spaces.

Recap

You learned host and device live in separate address spaces, pointers are not interchangeable, and cudaMemcpy is how data crosses the gap. ✅

Sıkça Sorulan Sorular

“Ayrı Adres Alanları” dersi ücretsiz mi?

Evet — “Ayrı Adres Alanları” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve CUDA Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. CUDA Academy kursu toplamda 4 dersten oluşur.

“Ayrı Adres Alanları” dersinde ne öğreneceğim?

Ana bilgisayar göstergesinin cihazda neden geçersiz olduğunu öğrenin. CUDA Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

CUDA Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te CUDA Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 3. dersidir.

“Ayrı Adres Alanları” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu CUDA Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her CUDA Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. __global__ İşlev Belirteci
  2. __device__ ve __host__ İşlevleri
  3. Ayrı Adres Alanları
  4. Bir CUDA Programının Yaşam Döngüsü
← CUDA Academy Sayfasına Dön