PHPackages                             php-io-extensions/cuda - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. php-io-extensions/cuda

ActivePhp-ext

php-io-extensions/cuda
======================

PHP-Controllable CUDA Runtime + OpenGL interop extension

0.7.x-dev(today)01↑2900%MITCPHP &gt;=8.2

Since Aug 9Pushed todayCompare

[ Source](https://github.com/php-io-extensions/cuda)[ Packagist](https://packagist.org/packages/php-io-extensions/cuda)[ RSS](/packages/php-io-extensions-cuda/feed)WikiDiscussions 0.7.x Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

php-cuda
========

[](#php-cuda)

[![PHP](https://camo.githubusercontent.com/c43902a50e55ff766fc179e27d9b9a292ef8fcadbdd4d855bb077a334e2f9b46/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135253230382e322d3737376262343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net)[![CUDA](https://camo.githubusercontent.com/89137d5023c2822d46b0a90dc467761bdfa743eaa3af981384093ee0ce39e137/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f435544412d25453225383925413525323031322e302d373642393030)](https://developer.nvidia.com/cuda-toolkit)[![Built with Zephir](https://camo.githubusercontent.com/8e72a9e9874ec036e66f84af12bd028857d1f200674b7acaa9eb97271a123f7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d5a65706869722d666636613030)](https://zephir-lang.com/)[![Platform](https://camo.githubusercontent.com/fb2fe619bdae5c21e845da6d3dbbf795df60e1899baab4e6c24a004b04253e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6c696e75782532302537432532306a6574736f6e2d6c6967687467726579)](#requirements)[![License: MIT](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](#license)

> PHP extension for the CUDA **Runtime** API plus **CUDA–OpenGL interop** — built with [Zephir](https://zephir-lang.com/), installable via [PHP PIE](https://github.com/php/pie).

`cuda` exposes CUDA Runtime device, memory, stream, and event APIs to PHP 8.2+ as namespaced static methods under `Cuda\Cuda\Cuda`, plus thin data objects (`CudaDevicePtr`, `CudaHostPtr`, `CudaStream`, `CudaEvent`, `CudaGraphicsResource`) that store opaque native pointers in public `fd`.

`Cuda\Cuda\CudaGL` adds in-package CUDA–GL interop (PBO/texture register/map), an **embedded plasma PTX** kernel (no `nvcc` for consumers), and minimal present helpers. Windowing stays in peer extensions (`sdl3` / `glfw`).

This is **not** [CudaGraphics-PHP](https://github.com/projectsaturnstudios/CudaGraphics-PHP)(custom draw/particle kernels). Token constants (`cudaSuccess`, memcpy kinds, …) belong in a companion microscrap package, not in this extension.

---

Requirements
------------

[](#requirements)

ComponentMinimum versionNotesPHP8.2ZTS and NTS builds both supported.CUDA Toolkit12.0+Runtime + Driver + `cuda_gl_interop.h` (Jetson CUDA 13.2 OK).OpenGLdesktop GLLinked as `-lGL` for interop/present.OSLinux / Jetsonaarch64 + x86\_64 Linux. Darwin/Windows not supported.CompilerC11 toolchain`gcc` or `clang`.`php-dev` / `phpize`matches PHPRequired for any build path that is not PIE.`nvcc`maintainers onlyRegenerating embedded PTX — **not** required for PIE installs.---

Installation
------------

[](#installation)

### Via PHP PIE (recommended)

[](#via-php-pie-recommended)

```
export CUDA_HOME=/usr/local/cuda   # if not already the default
pie install php-io-extensions/cuda
```

PIE builds the committed `ext/` tree with `--enable-cuda`. No Zephir. No `nvcc`.

### Platform installer (Jetson / JetPack)

[](#platform-installer-jetson--jetpack)

```
export CUDA_HOME=/usr/local/cuda
bash install-jetpack6.sh
```

### Manual build with Zephir (maintainers)

[](#manual-build-with-zephir-maintainers)

```
export CUDA_HOME=/usr/local/cuda
bash scripts/prepare-ext.sh   # zephir generate + portable config.m4 + REGISTER fixup
cd ext && phpize && ./configure --enable-cuda && make
php -n -d extension=modules/cuda.so --ri cuda
```

### Verifying the install

[](#verifying-the-install)

```
php -m | grep cuda
php --ri cuda
php examples/proof_of_work.php
```

---

Quick start
-----------

[](#quick-start)

```
