← ClaudeAtlas

cuda-omp-translatorlisted

CUDA↔OpenMP translation pattern guide for evaluating and reviewing LLM-generated parallel code translations. Use when reviewing eval results that involve CUDA-to-OpenMP or OpenMP-to-CUDA translation pairs, when writing paper sections about translation patterns, when diagnosing why a specific translation failed to build or verify, or when creating new specs for CUDA/OpenMP kernel pairs. Covers memory model mapping, kernel launch → parallel region patterns, shared memory → threadprivate, atomic operations, and common pitfalls that cause BUILD_FAIL or VERIFY_FAIL.
SamyakJhaveri/loam · ★ 0 · AI & Automation · score 75
Install: claude install-skill SamyakJhaveri/loam
# CUDA ↔ OpenMP Translation Guide Reference for evaluating LLM-generated translations between CUDA and OpenMP. Organized by pattern category — each section describes the source construct, the correct target construct, and the failure modes LLMs commonly produce. **Trigger:** `/cuda-omp-translator` or when reviewing CUDA↔OMP eval results. ## When to use - Reviewing why an LLM translation got BUILD_FAIL or VERIFY_FAIL - Writing paper sections about translation difficulty or pattern analysis - Comparing translation quality across models for specific construct types - Creating new benchmark specs for CUDA/OpenMP kernel pairs ## Core Translation Patterns ### 1. Kernel Launch → Parallel Region **CUDA:** ```c __global__ void kernel(float *data, int n) { int tid = blockIdx.x * blockDim.x + threadIdx.x; if (tid < n) data[tid] = data[tid] * 2.0f; } // Launch: kernel<<<grid, block>>>(d_data, n); ``` **OpenMP equivalent:** ```c #pragma omp parallel for for (int tid = 0; tid < n; tid++) { data[tid] = data[tid] * 2.0f; } ``` **Common LLM failures:** - Preserving `blockIdx`/`threadIdx` arithmetic instead of using loop index - Missing `parallel for` — writing just `#pragma omp parallel` without work distribution - Adding unnecessary `num_threads()` clause that limits parallelism ### 2. Device Memory → Stack/Heap Allocation **CUDA:** `cudaMalloc`, `cudaMemcpy` (host↔device transfers) **OpenMP:** Direct pointer use (shared memory space) **Common LLM failures:** - Leavin