Context7
Up-to-date docs for AI agents
作者による説明(英語の原文)
Compile, run and check CUDA and HIP kernels without a GPU: wrong results, races, memory errors
この3つを1つのスコアにまとめることはしません。意見、測定、人気はそれぞれ別のものだからです。
このサーバーのやさしい解説はまだ書いていません。以下はレジストリから読み取った事実です。
使っているAIアプリを選んで、設定をコピーしてください。
必要なもの
どのアプリを使っていますか?
上でアプリを選んでください。選んだアプリを覚えておくので、次からはボタンに「…にインストール」と表示されます。
Claude Desktop → Settings → Developer → Edit Config を開き、claude_desktop_config.json にこれを貼り付けます
{
"mcpServers": {
"cuda4cpu": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/javier-cabezas/cuda4cpu:0.5.0"
]
}
}
}ターミナルでこれを実行します
claude mcp add cuda4cpu -- docker run -i --rm ghcr.io/javier-cabezas/cuda4cpu:0.5.0プロジェクトの .cursor/mcp.json、または ~/.cursor/mcp.json に貼り付けます
{
"mcpServers": {
"cuda4cpu": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/javier-cabezas/cuda4cpu:0.5.0"
]
}
}
}ブラウザがアプリを開いてよいか確認し、そのあとアプリが設定を表示して確認を求めます。キーの値は空欄のままなので、自分で入力してください。
プロジェクトの .vscode/mcp.json に貼り付けます
{
"servers": {
"cuda4cpu": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/javier-cabezas/cuda4cpu:0.5.0"
]
}
}
}ブラウザがアプリを開いてよいか確認し、そのあとアプリが設定を表示して確認を求めます。キーの値は空欄のままなので、自分で入力してください。
これはパソコンで動くサーバーですが、ChatGPTがつなげるのはインターネット上のサーバーだけです。ほかのアプリを選んでください。
選んだアプリは、この端末のCookieに保存されます。アカウントは不要です。
この設定は、作者のレジストリ登録情報から作成しています。READMEと違う場合は、READMEに従ってください。
パソコンで動くサーバーです。インストールすると、ツール一覧がAIアプリに表示されます。
誰でも見られる情報をチェックしており、コードは読んでいません。当てはまらない項目は数に入れていません。 · 2026年11月7日にチェック
レジストリ名は、リポジトリを所有するGitHubアカウント javier-cabezas で確認済みです
このリポジトリはまだGitHubから読み取っていません
このリポジトリはまだGitHubから読み取っていません
これはパソコンで動くため、インターネット上のエンドポイントはありません
パソコンで動き、代わりにローカルの設定を使います
パソコンで動くサーバーです。ツール一覧を読み取れるのは、インターネット上のエンドポイントがある場合だけです
レジストリでこのカテゴリにある有効なすべてのサーバーと比較しています。スターは、公開者がリポジトリの所有者である場合だけ数えます。
当てはまる基本チェック1項目のうち1項目に合格しました。コードは読んでいません。キーやトークンを追加する前に、サーバーがどんなアクセスを求めているかを確認し、必要な権限だけを持つキーを使ってください。
レジストリには必須のキーは載っていません。ただし、最初に使うときにサインインを求めるサーバーもあります。
あなたのパソコンで動きます。必要なときにAIアプリが起動し、データは作者のサーバーを通りません(サーバー自体がオンラインサービスを呼び出す場合を除きます)。
GitHubリポジトリの最終更新は–、最新バージョン(0.5.0)がレジストリに届いたのは3 日前です。
Claude Desktop、Claude Code、Cursor、VS CodeなどのMCP対応アプリで使えます。パソコンにDockerも必要です。
同じカテゴリには:Context7, Codebase Memory, Exa
同じカテゴリで、ほかの作者が作ったサーバー。スターの多い順。
カードの見方:★ GitHubスターi3つの柱:レビュー · チェック · 利用状況i更新=最新バージョンをレジストリに公開した日i
Up-to-date docs for AI agents
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Connect AI agents to Exa for web search, content fetching, and multi-step research.
作者のリポジトリから書かれたとおりにコピーしたものです。PopNx MCPは内容を確認・推奨していません。HTML、画像、スクリプトは取り除いています。リンクはこのサイトの外へ移動します。
Run CUDA and HIP programs on your CPU, unmodified, with your regular C++ compiler. No GPU, no nvcc, no CUDA toolkit: GCC or Clang compile your .cu files, and the kernels run as native code on every core.
$ cuda4cpu-c++ -O2 vecadd.cu -o vecadd
$ ./vecadd c[42] = 126, computed on cuda4cpu: AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
cuda4cpu-mcp, an MCP server for Claude Code, Cursor or any MCP client, compiles, runs and checks CUDA and HIP code, and reports wrong results, missing barriers and memory errors at their source lines.__syncthreads(), threads of a block that reach different barriers, reads of memory never written, and allocations never freed.grid.sync()), atomics, half precision, bfloat16 and 8-bit floats, streams, events, and CUDA graphs with stream capture. HIP code compiles too.You need Linux (or WSL 2) on x86-64, with GCC 14 or later and Python 3, as on Ubuntu 24.04 (sudo apt-get install g++-14 python3). Install the latest release in ~/.local:
mkdir -p ~/.local
curl -fsSL https://github.com/javier-cabezas/cuda4cpu/releases/latest/download/cuda4cpu-linux-x86_64.tar.gz | tar -xz -C ~/.local --strip-components=1
Then compile any .cu file with cuda4cpu-c++, which takes the same options as your C++ compiler, or with cuda4cpu-nvcc, which takes nvcc's:
cuda4cpu-c++ -O2 vecadd.cu -o vecadd
./vecadd
With Docker, there's nothing else to install: the image has cuda4cpu, GCC and CMake.
docker run --rm -u "$(id -u):$(id -g)" -v "$PWD:/src" -w /src ghcr.io/javier-cabezas/cuda4cpu \
cuda4cpu-nvcc -O2 vecadd.cu -o vecadd
From source, which needs CMake 3.25+ and Ninja too, and builds and runs the tests:
git clone https://github.com/javier-cabezas/cuda4cpu.git
cd cuda4cpu cmake --workflow --preset release cmake --install build/release --prefix /usr/local
See docs/usage.md for the other ways to install it and the build options.
A missing `__syncthreads()`. On a GPU, this kernel can pass its tests for a long time: only the first thread of each warp reads what another warp wrote. cuda4cpu runs the threads of a block in index order between barriers, which hides the bug too. Run them in reverse or in random order, and it shows (examples/bugs/missing_barrier.cu):
__global__ void pair_sum(const int *in, int *out)
{ shared int tile[256]; int t = threadIdx.x; int i = blockIdx.x * blockDim.x + t; tile[t] = in[i]; // Bug: a __syncthreads() is missing here out[i] = tile[t] + (t > 0 ? tile[t - 1] : 0); }
$ ./missing_barrier
PASSED: 0 wrong results $ CUDA4CPU_SCHEDULE=reverse ./missing_barrier FAILED: 65279 wrong results $ CUDA4CPU_SCHEDULE=random ./missing_barrier cuda4cpu: running threads in random order, seed 1277581447 (CUDA4CPU_SCHEDULE=random:1277581447 reproduces it) FAILED: 32593 wrong results
An out-of-bounds access, reported by AddressSanitizer with the kernel's line (examples/bugs/out_of_bounds.cu):
$ cuda4cpu-c++ -g -fsanitize=address out_of_bounds.cu -o out_of_bounds
$ ./out_of_bounds ==8457==ERROR: AddressSanitizer: use-after-poison on address 0x7c81561e2630 ... READ of size 4 at 0x7c81561e2630 thread T4 #0 0x65457dfe1ad5 in scale(float*, int) .../out_of_bounds.cu:27 ... 0x7c81561e2630 is located 4400 bytes inside of 4608-byte region [0x7c81561e1500,0x7c81561e2700) ... cuda4cpu: error: CUDA thread (76, 0, 0) of block (4, 0, 0) made the error that the sanitizer reports above, in the kernel launched at out_of_bounds.cu:37.
The array has 1100 floats, 4400 bytes: cuda4cpu rounds allocations up to 256 bytes and poisons the rest, so the first element past the end is reported, as use-after-poison. Without the sanitizer, the crash is reported with its CUDA thread and block too.
Divergent barriers. CUDA requires every thread of a block to reach the same __syncthreads(), and cuda4cpu reports blocks whose threads don't:
cuda4cpu: warning: threads of block (0, 0, 0) reached different __syncthreads() calls,
at kernel.cu:12 and kernel.cu:15. CUDA requires every thread of a block to reach the same one.
gdb in a CUDA thread. Each CUDA thread is a fiber with its own stack, so breakpoints, stepping and backtraces work as in any program. cuda4cpu's gdb script adds the built-in variables:
(gdb) break kernel.cu:42 if $threadIdx("x") == 6 && $blockIdx("x") == 2
(gdb) run (gdb) cuda4cpu thread (6, 0, 0) of block (2, 0, 0), lane 6; blocks of (64, 1, 1) threads, grid of (8, 1, 1) blocks
docs/debugging.md has the details.
A coding agent on a machine without a GPU can write CUDA, but it can't run it, so it can't tell whether a kernel works. cuda4cpu-mcp gives it a way to find out: an MCP server that compiles, runs and tests CUDA and HIP code with cuda4cpu, and runs the checks above for it. Register it with your agent, for example Claude Code:
claude mcp add cuda4cpu -- cuda4cpu-mcp # installed from a release, or build/release/tools/cuda4cpu-mcp
claude mcp add cuda4cpu -- docker run -i --rm -v "$PWD:$PWD" ghcr.io/javier-cabezas/cuda4cpu
Other clients take the same command, for example in Cursor's mcp.json or Claude Desktop's configuration: {"mcpServers": {"cuda4cpu": {"command": "cuda4cpu-mcp"}}}. The server speaks MCP over stdio, and is listed in the MCP Registry as io.github.javier-cabezas/cuda4cpu. In Docker, it sees only the directories you mount (-v "$PWD:$PWD" above): sources given inline need none.
| Tool | What the agent gets |
|---|---|
compile | nvcc's or hipcc's diagnostics at the source's lines, and the features it uses that cuda4cpu doesn't implement |
run | the exit code, the output, and cuda4cpu's warnings |
check | a verdict, and findings with their source lines: memory errors and undefined behavior (AddressSanitizer and UBSan), results that change with the order of a block's threads (a missing __syncthreads() or __syncwarp(), a race), divergent barriers, copies in the wrong direction, hangs |
test_kernel | a test of one kernel, without writing a program: the agent gives the launch configuration and the arguments (given or generated), with expected values or a C++ reference function, and gets the elements that differ and the findings of check |
capabilities | what cuda4cpu implements and doesn't, so that the agent can tell a bug in its code from a missing feature |
Results are JSON, with a summary first. For the missing __syncthreads() above, whose program passes in the default order, check answers:
problems found
[depends on the thread order] running the threads of each block in reverse order (reverse) ends with exit code 1 instead of exit code 0; 8 of 8 other orders change the result a thread reads data that another thread of its block writes without a syncthreads() between them (or, within a warp, a syncwarp()), or threads race on the same data.
And for a SAXPY that computes its index with blockDim.y instead of blockDim.x, test_kernel with a reference that loops over the elements answers:
failed
argument 3: 998 of 1000 elements differ (largest error 1998) [1] 5, expected 3 [2] 13, expected 5 ...
A clean check means that nothing showed up in the orders and checks it ran, not that a program has no race. Programs run with your permissions, each in a temporary directory and its own process group, killed at a time-out: the server doesn't sandbox them. docs/debugging.md describes every tool and its arguments.
CMake. Fetch cuda4cpu and add your .cu files to a target (examples/cmake-project):
include(FetchContent)
FetchContent_Declare(cuda4cpu GIT_REPOSITORY https://github.com/javier-cabezas/cuda4cpu.git GIT_TAG v0.5.0) FetchContent_MakeAvailable(cuda4cpu)
add_executable(my_app main.cpp) cuda4cpu_add_cuda_sources(my_app kernels.cu solver.cu)
With cuda4cpu installed, find_package(cuda4cpu REQUIRED) does the same. HIP sources go through cuda4cpu_add_hip_sources.
Any build system. cuda4cpu-c++ is a compiler driver: use it like your C++ compiler, with .cu files among the inputs. cuda4cpu-hipcc does the same for HIP projects, and drops hipcc's options for AMD GPUs, so build scripts written for hipcc work unchanged:
cuda4cpu-c++ -O2 -o my_app main.cpp kernels.cu
cuda4cpu-hipcc -O2 --offload-arch=gfx90a -o my_app main.cpp kernels.cpp
GitHub Actions. Hosted runners have no GPU, but they can run your CUDA tests with cuda4cpu. The action installs a release, with the drivers on the PATH and the CMake package where find_package(cuda4cpu) finds it:
jobs:
test: runs-on: ubuntu-24.04 env: CXX: g++-14 steps:
Its outputs give the toolkit directory, for Makefiles written for nvcc (make CUDA_PATH=...), and the toolchain-file for CMake's CUDA and HIP languages. A project that fetches cuda4cpu with FetchContent needs no action.
__global__, __device__, __shared__ (static and dynamic), __constant__, __syncthreads(), every warp shuffle, vote and match, __activemask() and __syncwarp(), atomics, cuda_fp16.h, cuda_bf16.h, cuda_fp8.h, cuComplex.h, math and integer intrinsics, rounding-mode intrinsics, clock64().冒頭だけを表示しています。続きはリポジトリで読めます