Files
metabuilder/mojo/examples/gpu-intro
johndoe6345789 d772201bf1 feat: Replace placeholder examples with official Modular Mojo examples
Added official examples from github.com/modular/modular:
- gpu-intro, gpu-functions, gpu-block-and-warp (GPU programming)
- layout_tensor, layouts (tensor operations)
- life (Conway's Game of Life)
- operators (custom operators)
- process (subprocess handling)
- python-interop (Python integration)
- testing (unit test patterns)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:40:19 +00:00
..

Get started with GPU programming tutorial solution

This directory contains a complete solution for the Get started with GPU programming tutorial project, which is an implementation of a simple vector addition GPU kernel using Mojo. Please refer to the tutorial for an explanation of the code and concepts.

This example requires a supported GPU to run the kernel. If your system doesn't have a supported GPU, you can compile the program but the only output you'll see when you run it is:

No compatible GPU found

Files

This directory contains the following files:

  • vector_addition.mojo is the only source file for the tutorial solution, containing the kernel function and the main program.

  • pixi.toml is a Pixi project file containing the project dependencies and task definitions.

Run the code

If you have Pixi installed, you can execute the example by running the following command:

pixi run mojo vector_addition.mojo