Skip to content

Commit

Permalink
Add man page for cuda support
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Jan 23, 2025
1 parent 0befa5c commit df3cb91
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 5 deletions.
17 changes: 15 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif
# This must never include the 'hack' directory
export PATH := $(shell $(GO) env GOPATH)/bin:$(PATH)

docs: $(patsubst %.md,%,$(wildcard *[15].md))
docs: $(patsubst %.md,%,$(wildcard *[157].md))

%.1: %.1.md
### sed is used to filter http/s links as well as relative links
Expand All @@ -35,13 +35,26 @@ docs: $(patsubst %.md,%,$(wildcard *[15].md))
-e 's/\\$$/ /g' $< | \
$(GOMD2MAN) -in /dev/stdin -out $@

%.7: %.7.md
### sed is used to filter http/s links as well as relative links
### replaces "\" at the end of a line with two spaces
### this ensures that manpages are rendered correctly
@$(SED) -e 's/\((ramalama[^)]*\.md\(#.*\)\?)\)//g' \
-e 's/\[\(ramalama[^]]*\)\]/\1/g' \
-e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \
-e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \
-e 's/\\$$/ /g' $< | \
$(GOMD2MAN) -in /dev/stdin -out $@

.PHONY: install
install: docs
install -d ${DESTDIR}/${MANDIR}/man1
install -m 0644 ramalama*.1 ${DESTDIR}/${MANDIR}/man1
install -m 0644 links/ramalama*.1 ${DESTDIR}/${MANDIR}/man1
install -d ${DESTDIR}/${MANDIR}/man5
install -m 0644 ramalama*.5 ${DESTDIR}/${MANDIR}/man5
install -d ${DESTDIR}/${MANDIR}/man7
install -m 0644 ramalama*.7 ${DESTDIR}/${MANDIR}/man7

install -d ${DESTDIR}/${DATADIR}/ramalama
install -m 0644 ramalama.conf ${DESTDIR}/${DATADIR}/ramalama
Expand All @@ -53,4 +66,4 @@ install-tools:

.PHONY: clean
clean:
$(RM) -f ramalama*.1 ramalama*.5
$(RM) -f ramalama*.1 ramalama*.5 ramalama*.7
110 changes: 110 additions & 0 deletions docs/ramalama-cuda.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
% ramalama 7

# Setting Up RamaLama with CUDA Support on Linux systems

This guide walks through the steps required to set up RamaLama with CUDA support.

## Install the NVIDIA Container Toolkit
Follow the installation instructions provided in the [NVIDIA Container Toolkit installation guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).

### Installation using dnf/yum (For RPM based distros like Fedora)

* Install the NVIDIA Container Toolkit packages

```bash
sudo dnf install -y nvidia-container-toolkit
```
> **Note:** The Nvidia Container Toolkit is required on the host for running CUDA in containers.
### Installation using APT (For Debian based distros like Ubuntu)

* Configure the Production Repository

```bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey
sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg

curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
```

* Update the packages list from the repository

```bash
sudo apt-get update
```
* Install the NVIDIA Container Toolkit packages

```bash
sudo apt-get install -y nvidia-container-toolkit
```
> **Note:** The Nvidia Container Toolkit is required for WSL to have CUDA resources while running a container.
## Setting Up CUDA Support

For additional information see: [Support for Container Device Interface](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/cdi-support.html)

# Generate the CDI specification file

```bash
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
```

# Check the names of the generated devices

Open and edit the NVIDIA container runtime configuration:

```bash
nvidia-ctk cdi list
INFO[0000] Found 1 CDI devices
nvidia.com/gpu=all
```

> **Note:** Generate a new CDI specification after any configuration change most notably when the driver is upgraded!
## Testing the Setup
**Based on this Documentation:** [Running a Sample Workload](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/sample-workload.html)

---


* **Test the Installation**
Run the following command to verify setup:

```bash
podman run --rm --device=nvidia.com/gpu=all fedora nvidia-smi
```

# **Expected Output**
Verry everything is configured correctly, with output similar to this:

```text
Thu Dec 5 19:58:40 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 565.72 Driver Version: 566.14 CUDA Version: 12.7 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3080 On | 00000000:09:00.0 On | N/A |
| 34% 24C P5 31W / 380W | 867MiB / 10240MiB | 7% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 35 G /Xwayland N/A |
| 0 N/A N/A 35 G /Xwayland N/A |
+-----------------------------------------------------------------------------------------+
```

## SEE ALSO
**[ramalama(1)](ramalama.1.md)**, **[podman(1)](https://github.com/containers/podman/blob/main/docs/podman.1.md)**

## HISTORY
Jan 2025, Originally compiled by Dan Walsh <[email protected]>
6 changes: 5 additions & 1 deletion docs/ramalama-run.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ This program is a Python script that allows the user to interact with a terminal
[end of text]
```

## NVIDIA CUDA Support

See **[ramalama-cuda(7)](ramalama.7.md)** for setting up the host Linux system for CUDA support.

## SEE ALSO
**[ramalama(1)](ramalama.1.md)**
**[ramalama(1)](ramalama.1.md)**, **[ramalama-cuda(7)](ramalama-cuda.7.md)**

## HISTORY
Aug 2024, Originally compiled by Dan Walsh <[email protected]>
6 changes: 5 additions & 1 deletion docs/ramalama-serve.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@ Yaml=MyTinyModel.yaml
WantedBy=multi-user.target default.target
```

## NVIDIA CUDA Support

See **[ramalama-cuda(7)](ramalama.7.md)** for setting up the host Linux system for CUDA support.

## SEE ALSO
**[ramalama(1)](ramalama.1.md)**, **[ramalama-stop(1)](ramalama-stop.1.md)**, **quadlet(1)**, **systemctl(1)**, **podman-ps(1)**
**[ramalama(1)](ramalama.1.md)**, **[ramalama-stop(1)](ramalama-stop.1.md)**, **quadlet(1)**, **systemctl(1)**, **podman-ps(1)**, **[ramalama-cuda(7)](ramalama-cuda.7.md)**

## HISTORY
Aug 2024, Originally compiled by Dan Walsh <[email protected]>
2 changes: 1 addition & 1 deletion docs/readme/wsl2-docker-cuda.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Follow the installation instructions provided in the [NVIDIA Container Toolkit i

---

### Example: Installation using APT (For Distros like Ubuntu)
### Installation using APT (For Distros like Ubuntu)

1. **Configure the Production Repository:**
```bash
Expand Down
1 change: 1 addition & 0 deletions rpm/python-ramalama.spec
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ will run the AI Models within a container based on the OCI image.
%{_datadir}/%{pypi_name}/ramalama.conf
%{_mandir}/man1/ramalama*.1*
%{_mandir}/man5/ramalama*.5*
%{_mandir}/man7/ramalama*.7*

%changelog
%autochangelog

0 comments on commit df3cb91

Please sign in to comment.