Skip to content

Commit 801d724

Browse files
Merge pull request #30 from guido-orcl/main
PR cuOpt
2 parents 1f0e63e + 23646dd commit 801d724

5 files changed

Lines changed: 92 additions & 102 deletions

File tree

cuopt/introduction/introduction.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,47 @@
22

33
## About this Workshop
44

5-
In this workshop we will run Nvidia container on oci instance with an A10 shape which has GPU. You will launch an A10 instance with oracle linux and run a set of commands to achieve it.
5+
In this workshop we will run NVIDIA container on oci instance with an A10 shape which has GPU. You will launch an A10 instance with oracle linux and run a set of commands to achieve it.
66

7-
NVIDIA cuOpt is an optimization tool that specializes in routing. It is run as a microservice in the cloud using the container provided. The cuOpt microservice leverages OpenAPI standards, serving endpoints running on port 5000 (by default) to accept optimization input data and return optimized routing solutions.
87

98
Estimated Workshop Time: 45 minutes
109

1110
### Objectives
1211

13-
Objective of this workshop is to set-up Nvidia container on oci instance with an A10 shape which has GPU.
12+
Objective of this workshop is to set-up NVIDIA container on oci instance with an A10 shape which has GPU.
1413

1514
In this workshop, you will learn how to:
1615

17-
* Configure & set-up Nvidia container on oci instance
16+
* Configure & set-up NVIDIA container on oci instance
1817

1918
### Prerequisites
2019

2120
This lab assumes you have:
2221

2322
* An Oracle Cloud account.
24-
* Administrator permissions or permissions to use the OCI Compute, Identity Domains, A10 images, NGC API Key.
23+
* Administrator permissions or permissions to use the OCI Compute, Identity Domains and A10 shapes
24+
25+
## What Is NVIDIA cuOpt?
26+
27+
NVIDIA cuOpt is an open-source, GPU-accelerated engine for decision optimization, excelling in mixed-integer programming (MIP), linear programming (LP), and vehicle routing problems (VRPs). Designed to tackle large-scale problems with millions of variables and constraints, cuOpt enables accelerated decision-making.
28+
29+
NVIDIA cuOpt run as a microservice in the cloud using the container provided. The cuOpt microservice leverages OpenAPI standards, serving endpoints running on port 8000 (by default) to accept optimization input data and return optimized routing solutions.
30+
31+
## How cuOpt Is Being Used
32+
33+
### Supply Chain Management
34+
Optimizing resource allocation in complex supply chains requires efficiently distributing limited resources while adapting to real-time changes.
35+
36+
### Fleet Management
37+
Efficient scheduling and route planning are essential for managing inbound and outbound transportation of goods and vehicles, especially for long-haul fleets.
38+
39+
### Last-Mile Delivery
40+
Efficiently dispatching truck fleets from distribution centers to retail stores and end customers is critical for minimizing costs and meeting delivery expectations.
41+
2542

2643
## Learn More
2744

28-
* [What Is NGC API Key?](https://docs.nvidia.com/ai-enterprise/deployment-guide-spark-rapids-accelerator/0.1.0/appendix-ngc.html)
29-
* [What is NVIDIA cuOpt?](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/cuopt/containers/cuopt)
45+
* [What is NVIDIA cuOpt?](https://catalog.ngc.NVIDIA.com/orgs/NVIDIA/teams/cuopt/containers/cuopt)
3046

3147
You may now proceed to the next lab.
3248

@@ -35,4 +51,3 @@ You may now proceed to the next lab.
3551
**Authors**
3652

3753
* **Guido Alejandro Ferreyra**, Principal Cloud Architect, NACIE
38-
* **Abhinav Jain**, Senior Cloud Engineer, NACIE

cuopt/provision/images/a10.png

-880 KB
Loading
-611 KB
Loading

cuopt/provision/images/gpu.png

-671 KB
Loading

cuopt/provision/provision.md

Lines changed: 69 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,196 +1,171 @@
1-
# Provision of Nvidia Container
1+
# Provision of NVIDIA Container
22

33
## Introduction
44

5-
This lab will take you through the steps needed to provision Nvidia container on oci instance with an A10 shape which has GPU,
5+
This lab will take you through the steps needed to provision NVIDIA container on oci instance with an A10 shape which has GPU,
66

77
Estimated Time: 45 minutes
88

9-
### About NVIDIA cuOpt
10-
11-
NVIDIA cuOpt is an optimization tool that specializes in routing. It is run as a microservice in the cloud using the container provided. The cuOpt microservice leverages OpenAPI standards, serving endpoints running on port 5000 (by default) to accept optimization input data and return optimized routing solutions.
12-
139
### Objectives
1410

15-
Provisioning of Nvidia container
11+
Provisioning of NVIDIA container
1612

1713
### Prerequisites
1814

1915
This lab assumes you have:
2016

2117
* An Oracle account
22-
* Administrator permissions or permissions to use the OCI Compute, Identity Domains, A10 images, NGC API Key.
18+
* Administrator permissions or permissions to use the OCI Compute, Identity Domains, A10 shapes available.
2319

2420
## Task 1: Launch an A10 instance
2521

2622
1. Go to Compute -> Instance -> Create Instance. Under Image and Shape choose A10 shape as shown in the image below.
2723

28-
![A10](images/a10.png)
29-
30-
2. Click on Change Image and select Gen2-GPU-2024 (one on the top) as Image Build under Oracle Linux 8. Shown in the image below.
24+
![A10](images/a10.png "List of OCI instances shapes")
3125

32-
![GPU](images/gpu.png)
26+
2. Click on Change Image and select the latest GPU version (one on the top) as Image Build under Oracle Linux 8. Shown in the image below.
3327

34-
3. Provide the information for **VCN**, **Subnet (It has to be Public)**, **Add SSH Keys (Add keys to access your instance)**
28+
![GPU](images/gpu.png "Drop down menu that show the different image build for the GPU shape")
3529

36-
Click **Create**
30+
3. Provide the information for **VCN**, **Subnet (It has to be Public)**, **Add SSH Keys (Add keys to access your instance)** and click **Create**.
3731

38-
![Create_Instance](images/create_instance.png)
32+
![Create_Instance](images/create_instance.png "Setting up instance's connection parameters")
3933

40-
## Task 2: Run Nvidia Container
34+
## Task 2: Install NVIDIA container toolkit
4135

4236
1. In few minutes the status of recently created instance will change from **Provisioning** to **Running**.
4337

44-
2. Access the instance using the public ip of the instance with the following command 'ssh -i <ssh_key> opc@public_ip'.
38+
2. Access the instance using the public ip of the instance with the following command:
4539

46-
3. Install nvidia-container-toolkit
40+
```text
41+
<copy>
42+
ssh -i <ssh_key> opc@public_ip
43+
</copy>
44+
```
45+
46+
5. Install NVIDIA-container-toolkit
4747
4848
```text
4949
<copy>
50-
curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
50+
curl -s -L https://nvidia.github.io/libNVIDIA-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
5151
</copy>
5252
```
5353
54-
4. Run the following command
54+
6. Run the following command
5555
5656
```text
5757
<copy>
5858
sudo yum install -y nvidia-container-toolkit
5959
</copy>
6060
```
6161
62-
5. Generate CDI configuration for podman
62+
7. Generate CDI configuration for podman
6363
6464
```text
6565
<copy>
6666
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
6767
</copy>
6868
```
6969
70-
6. Setup nvidia driver to be persistent across reboots
70+
8. Setup NVIDIA driver to be persistent across reboots
7171
7272
```text
7373
<copy>
7474
sudo nvidia-persistenced
7575
</copy>
7676
```
7777
78-
7. Run the following command.
78+
9. Run the following command.
7979
8080
```text
8181
<copy>
8282
sudo systemctl enable nvidia-persistenced
8383
</copy>
8484
```
8585
86-
8. Install podman
87-
88-
```text
89-
<copy>
90-
sudo dnf module install -y container-tools:ol8
91-
</copy>
92-
```
93-
94-
9. Allow containers to use device files
95-
96-
```text
97-
<copy>
98-
sudo setsebool -P container_use_devices 1
99-
</copy>
100-
```
101-
102-
```text
103-
<copy>
104-
sudo setsebool -P container_manage_cgroup on
105-
</copy>
106-
```
107-
108-
## Task 3: Generate NGC API Key
109-
110-
Follow the steps listed in the following link to generate an api key which will be used in next task. [NGC API Key](https://docs.nvidia.com/ai-enterprise/deployment-guide-spark-rapids-accelerator/0.1.0/appendix-ngc.html)
111-
112-
## Task 4: Continue with Steps to run the container
113-
114-
1. Login to nvcr.io. Use the api key generated in previous step.
86+
10. Install podman
11587
11688
```text
11789
<copy>
118-
sudo podman login nvcr.io --username '$oauthtoken' --password $api_key
90+
sudo dnf module install -y container-tools:ol8
11991
</copy>
12092
```
12193
122-
2. Pull cuopt from nvcr.io
94+
9. Allow containers to use device files
12395
12496
```text
12597
<copy>
126-
sudo podman pull nvcr.io/nvidia/cuopt/cuopt:25.08
98+
sudo setsebool -P container_use_devices 1
12799
</copy>
128100
```
129101
130-
3. Create systemd service file for cuopt
131-
132102
```text
133103
<copy>
134-
sudo tee /etc/systemd/system/cuopt.service <<EOF
135-
[Unit]
136-
Description=Podman cuopt Container
137-
After=network.target
138-
[Service]
139-
Type=simple
140-
Restart=always
141-
ExecStart=/usr/bin/podman run --rm --device nvidia.com/gpu=all -p 5000:5000 nvcr.io/nvidia/cuopt/cuopt:25.08
142-
[Install]
143-
WantedBy=multi-user.target
144-
EOF
104+
sudo setsebool -P container_manage_cgroup on
145105
</copy>
146106
```
147107
148-
4. Reload systemd and start the service
108+
## Task 3: Run NVIDIA cuOpt container
149109
150-
```text
151-
<copy>
152-
sudo systemctl daemon-reload
153-
</copy>
154-
```
110+
1. Run the cuopt image
155111
156112
```text
157113
<copy>
158-
sudo systemctl start cuopt.service
114+
sudo podman run --rm --device nvidia.com/gpu=all -p 8000:8000 -e CUOPT_SERVER_PORT=8000 docker.io/nvidia/cuopt:latest-cuda12.8-py3.12
159115
</copy>
160116
```
161117
162-
5. Enable automatic start on boot
118+
## Task 4: Test cuOpt with an API call
163119
164-
```text
120+
Open a new SSH session with the following command (leave the previous one open so you will be able to see cuOpt logs):
121+
122+
```text
165123
<copy>
166-
sudo systemctl enable cuopt.service
124+
ssh -i <ssh_key> opc@public_ip -L 8000:localhost:8000
167125
</copy>
168-
```
126+
```
127+
```text
128+
<copy>
129+
curl --location 'http://localhost:8000/cuopt/request' \
130+
--header 'Content-Type: application/json' \
131+
--header 'Accept: application/json' \
132+
--data '{
133+
"cost_matrix_data": { "data": { "0": [[0, 1], [1, 0]] } },
134+
"task_data": {
135+
"task_locations": [1],
136+
"demand": [[1]],
137+
"task_time_windows": [[0, 10]],
138+
"service_times": [1]
139+
},
140+
"fleet_data": {
141+
"vehicle_locations": [[0, 0]],
142+
"capacities": [[2]],
143+
"vehicle_time_windows": [[0, 20]]
144+
},
145+
"solver_config": { "time_limit": 1 }
146+
}'
147+
</copy>
148+
```
169149

170-
## Task 5: Test cuOpt with an API call
171150

172-
Run the following command to test the container
151+
You will receive a reqId. Now run the following command, and you should see that the request has been completed:
173152

174153
```text
175-
<copy>
176-
curl --location 'http://0.0.0.0:5000/cuopt/routes' \
177-
--header 'Content-Type: application/json' \
178-
--header "CLIENT-VERSION: custom" \
179-
-d '{
180-
"cost_matrix_data": {"data": {"0": [[0, 1], [1, 0]]}},
181-
"task_data": {"task_locations": [1], "demand": [[1]], "task_time_windows": [[0, 10]], "service_times": [1]},
182-
"fleet_data": {"vehicle_locations":[[0, 0]], "capacities": [[2]], "vehicle_time_windows":[[0, 20]] },
183-
"solver_config": {"time_limit": 2}
184-
}'
185-
</copy>
154+
<copy>
155+
curl --location 'http://localhost:8000/cuopt/result/YOUR_REQUEST_ID' \
156+
--header 'Accept: application/json'
157+
</copy>
186158
```
187159

160+
## Task 5: Discover the cuOpt documentation
161+
162+
On your local machine, go to [http://localhost:8000/cuopt/docs](http://localhost:8000/cuopt/docs), where you can also run multiple tests.
163+
188164
## Acknowledgements
189165

190166
**Authors**
191167

192168
* **Guido Alejandro Ferreyra**, Principal Cloud Architect, NACIE
193-
* **Abhinav Jain**, Senior Cloud Engineer, NACIE
194169

195170
**Last Updated By/Date:**
196-
* **Abhinav Jain**, Senior Cloud Engineer, NACIE, August 2025
171+
* **Guido Alejandro Ferreyra**, Principal Cloud Architect, NACIE, December 2025

0 commit comments

Comments
 (0)