Cuda4cpu logo

Cuda4cpu

MCP server for compiling, running, and checking CUDA or HIP kernels on CPUs without a GPU or CUDA toolkit.

Install Cuda4cpu

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for cuda4cpu, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

The cuda4cpu MCP server lets AI agents compile, run, and check CUDA and HIP programs through a standard MCP stdio connection. It uses cuda4cpu to build .cu files with GCC or Clang, execute kernels as native CPU code, and report compiler diagnostics, runtime output, warnings, and source-level findings. Reach for it when an agent needs to validate GPU code on a Linux or WSL 2 machine without GPU hardware, especially in CI or local development.

Use cases

  • Compile CUDA kernels in GPU-free CI environments
  • Run agent-written CUDA or HIP programs on a CPU
  • Check kernels for memory errors and synchronization bugs
  • Debug individual CUDA threads with gdb and sanitizers

Key features

  • MCP tools for compile, run, and check workflows
  • CPU execution of CUDA and HIP programs
  • Source-line compiler and runtime diagnostics
  • Checks for memory errors, undefined behavior, and barrier issues
  • gdb, AddressSanitizer, UBSan, and Valgrind support
  • stdio transport with Docker deployment support

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

9/9 checks healthy over the last 35d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars8Stargazers on the source repository.
Last commit3d agoMost recent push to the default branch.

How Cuda4cpu works

What cuda4cpu does

cuda4cpu runs CUDA and HIP source on ordinary CPUs rather than requiring a GPU, nvcc, or the CUDA toolkit. Its MCP component, cuda4cpu-mcp, exposes that workflow to coding agents. Agents can submit source files or programs built with cuda4cpu, then receive compilation diagnostics, execution results, and automated kernel checks.

The underlying runtime supports CUDA-style execution concepts including shared memory, atomics, streams, events, CUDA graphs with stream capture, warp operations, cooperative groups, several low-precision numeric types, and HIP compilation. The project reports that 184 of 209 programs drawn from NVIDIA, Rodinia, and AMD example collections build and pass unchanged.

How it works

The server communicates over MCP using stdio. The agent starts cuda4cpu-mcp as a local subprocess, or starts the equivalent container command with the project directory mounted. The server invokes cuda4cpu’s compiler and runtime against the supplied code, so kernels execute as native code across CPU cores.

Three MCP tools cover the main workflow:

  • compile builds CUDA or HIP code and returns compiler diagnostics at source locations, along with notices about cuda4cpu features used by the program but not implemented.
  • run executes a compiled program and returns its exit status, output, and cuda4cpu warnings.
  • check performs the project’s diagnostic checks and returns a verdict with findings tied to source lines.

Checks use sanitizers, altered memory initialization, and multiple thread execution orders. They can expose memory errors, undefined behavior, missing synchronization, and barrier-related problems that may be difficult to reproduce on a GPU. The standalone cuda4cpu-check command can also inspect source files or existing programs and returns exit code 1 when it finds a problem.

Setup and configuration

The supported quick-start environment is Linux or WSL 2 on x86-64 with GCC 14 or newer and Python 3. The latest Linux x86-64 release can be unpacked into ~/.local. A Docker image is also available with cuda4cpu, GCC, and CMake included. Building from source requires CMake 3.25 or newer and Ninja.

After installation, register the local server with an MCP client using a command such as:

Terminal
claude mcp add cuda4cpu -- cuda4cpu-mcp

A container deployment can mount the working directory and run the server interactively:

Terminal
docker run -i --rm -v "$PWD:$PWD" ghcr.io/javier-cabezas/cuda4cpu

The container can access only directories explicitly mounted into it. The server is registered in the MCP Registry as io.github.javier-cabezas/cuda4cpu.

Tools and capabilities

The compiler wrappers accept regular C++ compiler options through cuda4cpu-c++, while cuda4cpu-nvcc accepts nvcc-style options. Debugging can use gdb, AddressSanitizer, UBSan, and Valgrind. CUDA threads are represented as fibers, allowing breakpoints, stepping, and backtraces inside individual kernel threads. Diagnostics identify CUDA thread and block coordinates when a kernel crashes or a sanitizer reports an error.

Execution scheduling can be changed to help reveal synchronization bugs. CUDA4CPU_SCHEDULE=reverse runs block threads in reverse order, while CUDA4CPU_SCHEDULE=random uses a randomized order; a seed can be supplied to reproduce a randomized run. The runtime also detects blocks whose threads reach different __syncthreads() calls.

Limitations and notes

The documented quick-start target is x86-64 Linux or WSL 2, rather than a native GPU runtime. CPU execution is intended for testing and debugging CUDA or HIP behavior; it does not provide GPU performance characteristics. Code using features that cuda4cpu has not implemented can be identified by the compile tool, and the project’s compatibility results show that some programs do not pass unchanged.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Cuda4cpu

cuda4cpu is an MCP server that connects AI agents to CPU-based CUDA and HIP execution through cuda4cpu. Its main tools—compile, run, and check—build kernels, execute programs, return diagnostics and output, and find memory, synchronization, and undefined-behavior issues without requiring a GPU or CUDA toolkit.

Install cuda4cpu from the latest Linux x86-64 release, build it from source, or use the provided Docker image, then register `cuda4cpu-mcp` as an MCP stdio server. The quick-start environment is Linux or WSL 2 on x86-64 with GCC 14 or later and Python 3.

Yes, cuda4cpu works with Cursor through its MCP configuration. Add a server entry that starts `cuda4cpu-mcp`, or use the Docker command with the project directory mounted so the server can access the source files.

Yes, cuda4cpu runs CUDA and HIP kernels as native CPU code and does not require a GPU, `nvcc`, or the CUDA toolkit. GCC or Clang compile `.cu` files through the cuda4cpu wrappers, after which the resulting program runs on the CPU.

Use the MCP `check` tool or the `cuda4cpu-check` command. The checks run programs with sanitizers, altered memory initialization, and different thread orders, and can report missing synchronization, divergent barriers, memory errors, and other findings with source locations.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewCuda4cpu AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/cuda4cpu?style=directory)](https://allmcps.com/mcp/cuda4cpu)
HTML Embed
<a href="https://allmcps.com/mcp/cuda4cpu"><img src="https://allmcps.com/api/badge/cuda4cpu?style=directory" alt="Cuda4cpu on AllMCPs" /></a>