Generates a 600×600 Mandelbrot set image every 10 seconds using CUDA, serves it as PNG over HTTP on port 5000 (GET /).
- Run:
kubectl apply -f k8s-deployment.yaml- Access via port-forward
kubectl port-forward -n gpu-demo svc/gpu-demo-service 5000:5000Then open your browser at http://localhost:5000 - it will serve the latest Mandelbrot PNG.
More deployment examples can be found in the examples/ directory.
Two header-only libraries must be placed in this directory before building.
curl -L -o httplib.h \
https://raw.githubusercontent.com/yhirose/cpp-httplib/master/httplib.hcurl -L -o stb_image_write.h \
https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h# Build image locally
make build
# Run
make run
# Push to a registry
make push REGISTRY=docker.io/myorg TAG=v1.0| Variable | Default | Description |
|---|---|---|
IMAGE |
gpu-demo-cpp |
Base image name |
TAG |
latest |
Image tag |
REGISTRY |
(empty) | Registry prefix, e.g. docker.io/x |
GPU_IMAGE |
$(IMAGE):$(TAG) |
Full image reference |
- CMake ≥ 3.16
- C++17-capable compiler (GCC 9+, Clang 10+)
- CUDA Toolkit ≥ 11.x and
nvcc
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target gpu_demo
./build/gpu_demoSet the PORT environment variable to change the listening port (default 5000).
The project is released under the Apache 2.0 License.
