Skip to content

Commit 4f986f8

Browse files
committed
add holoscan
1 parent 7b922b0 commit 4f986f8

File tree

12 files changed

+886
-0
lines changed

12 files changed

+886
-0
lines changed

holoscan/CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing to this repository
2+
3+
We welcome your contributions! There are multiple ways to contribute.
4+
5+
## Opening issues
6+
7+
For bugs or enhancement requests, please file a GitHub issue unless it's
8+
security related. When filing a bug remember that the better written the bug is,
9+
the more likely it is to be fixed. If you think you've found a security
10+
vulnerability, do not raise a GitHub issue and follow the instructions in our
11+
[security policy](./SECURITY.md).
12+
13+
## Contributing code
14+
15+
We welcome your code contributions. Before submitting code via a pull request,
16+
you will need to have signed the [Oracle Contributor Agreement][OCA] (OCA) and
17+
your commits need to include the following line using the name and e-mail
18+
address you used to sign the OCA:
19+
20+
```text
21+
Signed-off-by: Your Name <[email protected]>
22+
```
23+
24+
This can be automatically added to pull requests by committing with `--sign-off`
25+
or `-s`, e.g.
26+
27+
```text
28+
git commit --signoff
29+
```
30+
31+
Only pull requests from committers that can be verified as having signed the OCA
32+
can be accepted.
33+
34+
## Pull request process
35+
36+
1. Ensure there is an issue created to track and discuss the fix or enhancement
37+
you intend to submit.
38+
1. Fork this repository.
39+
1. Create a branch in your fork to implement the changes. We recommend using
40+
the issue number as part of your branch name, e.g. `1234-fixes`.
41+
1. Ensure that any documentation is updated with the changes that are required
42+
by your change.
43+
1. Ensure that any samples are updated if the base image has been changed.
44+
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
45+
what your changes are meant to do and provide simple steps on how to validate.
46+
your changes. Ensure that you reference the issue you created as well.
47+
1. We will assign the pull request to 2-3 people for review before it is merged.
48+
49+
## Code of conduct
50+
51+
Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd
52+
like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC].
53+
54+
[OCA]: https://oca.opensource.oracle.com
55+
[COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/

holoscan/LICENSE.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2025 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.

holoscan/README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Deploy NVIDIA Holoscan on Oracle Linux A10 Instance
2+
3+
## Introduction
4+
This Oracle Cloud Infrastructure (OCI) Terraform stack deploys an A10 (VM.GPU.A10.1) instance running Oracle Linux, installs NVIDIA Holoscan, and configures all required dependencies, including Docker and the NVIDIA container toolkit. The deployment occurs within an existing Virtual Cloud Network (VCN) and allows SSH access to the deployed VM for administration and troubleshooting. Additionally, a Jupyter Notebook service is set up to facilitate Holoscan usage.
5+
6+
## Getting Started
7+
This code is created to run as a stack in the OCI Resource Manager(ORM). Upload the code as a folder or .zip file to the ORM to create a stack and configure the required parameters.
8+
9+
### Prerequisites
10+
Before deploying, ensure you have the following:
11+
12+
1. **OCI Account**: A valid Oracle Cloud Infrastructure (OCI) account with access to GPU instances.
13+
2. **NVIDIA NGC API Key**: Required to pull the Holoscan container image from NVIDIA's NGC Catalog. You can generate an API key by following the instructions in NVIDIA's documentation: [Generate Your NGC Keys](https://docs.nvidia.com/nemo/retriever/extraction/ngc-api-key/).
14+
3. **SSH Key Pair**: A public SSH key for accessing the deployed instance.
15+
4. **Existing VCN and Public Subnet**: The deployment requires an existing VCN and a public subnet in OCI.
16+
17+
### Required Inputs
18+
19+
The following variables are visible and need to be configured in the deployment UI of the OCI ORM:
20+
21+
| Parameter | Description |
22+
| ----------------------- | --------------------------------------------------------------------- |
23+
| **Compartment OCID** | OCI Compartment where the GPU VM will be deployed. |
24+
| **VCN ID** | ID of the Virtual Cloud Network where resources will be provisioned. |
25+
| **Subnet ID** | The public subnet within the VCN for deployment. |
26+
| **VM Display Name** | Custom display name for the VM instance. |
27+
| **SSH Public Key** | Your public SSH key for remote access. |
28+
| **Availability Domain** | The availability domain where the instance will be deployed. |
29+
| **NVIDIA API Key** | Required to authenticate with NVIDIA NGC and pull the Holoscan image. |
30+
31+
## Notes/Issues
32+
33+
### Deployment Time
34+
- The apply job itself will complete in a few minutes in the ORM, meaning the VM will be successfully created. The output will include both a public IP and a private IP. Nevertheless the depoyment is not complete at that time, because a *cloudinit.sh* script will run after that on the VM. Running the *cloudinit.sh* script **takes approximately 10 minutes**, as it includes pulling the Holoscan container image and setting up the environment. During this time, the **Jupyter Notebook link will not be immediately available**.
35+
36+
- To **monitor the progress** of the *cloudinit.sh* script, SSH into the VM and run:
37+
```
38+
tail -f /var/log/cloud-init-output.log
39+
```
40+
41+
### CloudInit Script Automation
42+
43+
The *cloudinit.sh* script does the following:
44+
45+
1. **Install required packages** (Docker, NVIDIA container toolkit, and Python dependencies).
46+
47+
2. **Configure Docker** to use NVIDIA's runtime.
48+
49+
3. **Authenticate to NVIDIA NGC** and pull the Holoscan container.
50+
51+
4. **Run the Holoscan container** with GPU support, mounting required volumes.
52+
53+
5. **Start a Jupyter Notebook service**, accessible on port **8888**, to facilitate interactive exploration of Holoscan.
54+
55+
6. **Configure firewall rules** to allow access to Jupyter Notebook.
56+
57+
## Jupyter Notebooks Folder
58+
59+
**Note:** The Jupyter notebooks folder is initially empty.
60+
61+
After the *cloudinit.sh* script completes, you can access the Jupyter Notebook by navigating to:
62+
`http://<public_ip>:8888`
63+
64+
Once inside, browse to the `holoscan_jupyter_notebooks` directory to create and manage your notebooks.
65+
66+
For example notebooks and detailed guidance, refer to the official NVIDIA Holoscan documentation:
67+
[Holoscan by Example](https://docs.nvidia.com/holoscan/sdk-user-guide/holoscan_by_example.html)
68+
69+
## URLs
70+
[NVIDIA Holoscan](https://developer.nvidia.com/holoscan-sdk)
71+
[Holoscan by Example](https://docs.nvidia.com/holoscan/sdk-user-guide/holoscan_by_example.html)
72+
73+
74+
## Contributing
75+
<!-- If your project has specific contribution requirements, update the
76+
CONTRIBUTING.md file to ensure those requirements are clearly explained. -->
77+
78+
This project welcomes contributions from the community. Before submitting a pull
79+
request, please [review our contribution guide](./CONTRIBUTING.md).
80+
81+
## Security
82+
83+
Please consult the [security guide](./SECURITY.md) for our responsible security
84+
vulnerability disclosure process.
85+
86+
## License
87+
Copyright (c) 2024 Oracle and/or its affiliates.
88+
89+
Licensed under the Universal Permissive License (UPL), Version 1.0.
90+
91+
See [LICENSE](LICENSE.txt) for more details.
92+
93+
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.

holoscan/SECURITY.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Reporting security vulnerabilities
2+
3+
Oracle values the independent security research community and believes that
4+
responsible disclosure of security vulnerabilities helps us ensure the security
5+
and privacy of all our users.
6+
7+
Please do NOT raise a GitHub Issue to report a security vulnerability. If you
8+
believe you have found a security vulnerability, please submit a report to
9+
[[email protected]][1] preferably with a proof of concept. Please review
10+
some additional information on [how to report security vulnerabilities to Oracle][2].
11+
We encourage people who contact Oracle Security to use email encryption using
12+
[our encryption key][3].
13+
14+
We ask that you do not use other channels or contact the project maintainers
15+
directly.
16+
17+
Non-vulnerability related security issues including ideas for new or improved
18+
security features are welcome on GitHub Issues.
19+
20+
## Security updates, alerts and bulletins
21+
22+
Security updates will be released on a regular cadence. Many of our projects
23+
will typically release security fixes in conjunction with the
24+
Oracle Critical Patch Update program. Additional
25+
information, including past advisories, is available on our [security alerts][4]
26+
page.
27+
28+
## Security-related information
29+
30+
We will provide security related information such as a threat model, considerations
31+
for secure use, or any known security issues in our documentation. Please note
32+
that labs and sample code are intended to demonstrate a concept and may not be
33+
sufficiently hardened for production use.
34+
35+
[1]: mailto:[email protected]
36+
[2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html
37+
[3]: https://www.oracle.com/security-alerts/encryptionkey.html
38+
[4]: https://www.oracle.com/security-alerts/

holoscan/cloud_init.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource local_file cloudinit {
2+
content = templatefile("${path.module}/cloudinit.sh",
3+
{
4+
PUB_KEY = var.ssh_public_key,
5+
nvidia_api_key = var.nvidia_api_key,
6+
})
7+
filename = "${path.module}/cloudinit.sh"
8+
}
9+
10+
data "cloudinit_config" "config" {
11+
depends_on = [local_file.cloudinit]
12+
gzip = false
13+
base64_encode = true
14+
part {
15+
filename = "cloudinit.sh"
16+
content_type = "text/x-shellscript"
17+
content = file("${path.module}/cloudinit.sh")
18+
}
19+
}

holoscan/cloudinit.sh

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/bin/bash
2+
3+
# Function to broadcast and log messages
4+
broadcast() {
5+
echo "$1"
6+
}
7+
8+
log() {
9+
echo "$1" >> /var/log/script.log
10+
}
11+
12+
# Main script execution starts here
13+
echo "Running cloudinit.sh script"
14+
15+
# Add public key to OPC user
16+
echo "Adding public key to OPC authorized_keys"
17+
sudo -u opc sh -c "echo ${PUB_KEY} >> /home/opc/.ssh/authorized_keys"
18+
19+
# Install essential packages including git
20+
echo "Installing necessary packages..."
21+
dnf install -y dnf-utils zip unzip gcc git
22+
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
23+
dnf remove -y runc
24+
25+
# Install Docker
26+
echo "Installing Docker..."
27+
dnf install -y docker-ce --nobest
28+
systemctl enable docker.service
29+
30+
# Get API key from Terraform variable
31+
api_key="${nvidia_api_key}"
32+
33+
# Install NVIDIA container toolkit for Docker
34+
broadcast "Installing NVIDIA container toolkit for Docker..."
35+
log "Installing NVIDIA container toolkit for Docker..."
36+
distribution=$(. /etc/os-release; echo $ID$VERSION_ID)
37+
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo >/dev/null
38+
sudo yum install -y nvidia-container-toolkit >/dev/null
39+
sudo systemctl restart docker
40+
broadcast "NVIDIA container toolkit installed successfully."
41+
log "NVIDIA container toolkit installed successfully."
42+
43+
# Generate CDI configuration for Docker
44+
broadcast "Configuring CDI for Docker..."
45+
log "Configuring CDI for Docker..."
46+
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml >/dev/null
47+
broadcast "CDI configured successfully for Docker."
48+
log "CDI configured successfully for Docker."
49+
50+
# Setup NVIDIA driver persistence across reboots
51+
broadcast "Enabling NVIDIA persistence daemon..."
52+
log "Enabling NVIDIA persistence daemon..."
53+
nvidia-persistenced
54+
sudo systemctl enable nvidia-persistenced
55+
broadcast "NVIDIA persistence daemon enabled."
56+
log "NVIDIA persistence daemon enabled."
57+
58+
# Configure Docker to use NVIDIA runtime
59+
broadcast "Configuring Docker to use NVIDIA runtime..."
60+
log "Configuring Docker to use NVIDIA runtime..."
61+
sudo tee /etc/docker/daemon.json > /dev/null <<EOF
62+
{
63+
"runtimes": {
64+
"nvidia": {
65+
"path": "nvidia-container-runtime",
66+
"runtimeArgs": []
67+
}
68+
}
69+
}
70+
EOF
71+
sudo systemctl restart docker
72+
broadcast "Docker configured to use NVIDIA runtime."
73+
log "Docker configured to use NVIDIA runtime."
74+
75+
# Start Docker and add OPC user to Docker group
76+
echo "Starting Docker service..."
77+
systemctl start docker.service
78+
usermod -aG docker opc
79+
80+
# Install Python packages
81+
echo "Installing Python packages..."
82+
python3 -m pip install --upgrade pip wheel oci
83+
python3 -m pip install --upgrade setuptools
84+
python3 -m pip install oci-cli langchain six
85+
86+
# Grow filesystem
87+
echo "Expanding filesystem..."
88+
/usr/libexec/oci-growfs -y
89+
90+
# Optional firewall configuration
91+
# broadcast "Configuring firewall..."
92+
# log "Configuring firewall..."
93+
# sudo firewall-cmd --zone=public --add-port=8888/tcp --permanent
94+
# sudo firewall-cmd --reload
95+
# broadcast "Firewall configuration complete."
96+
# log "Firewall configuration complete."
97+
98+
# Holoscan installation
99+
broadcast "Logging in to nvcr.io..."
100+
log "Logging in to nvcr.io..."
101+
echo $api_key | docker login nvcr.io --username '$oauthtoken' --password-stdin >/dev/null
102+
broadcast "Logged in to nvcr.io successfully."
103+
log "Logged in to nvcr.io successfully."
104+
105+
broadcast "Pulling Holoscan image from nvcr.io..."
106+
log "Pulling Holoscan image from nvcr.io..."
107+
docker pull nvcr.io/nvidia/clara-holoscan/holoscan:v2.4.0-dgpu >/dev/null
108+
broadcast "Holoscan image pulled successfully."
109+
log "Holoscan image pulled successfully."
110+
111+
broadcast "Starting Holoscan Jupyter container..."
112+
log "Starting Holoscan Jupyter container..."
113+
114+
docker run -d \
115+
--gpus all \
116+
--net host \
117+
--ipc=host \
118+
--cap-add=CAP_SYS_PTRACE \
119+
--ulimit memlock=-1 \
120+
--ulimit stack=67108864 \
121+
-v /home/user/holoscan_examples:/examples \
122+
-v /var/run/docker.sock:/var/run/docker.sock \
123+
--name holoscan_jupyter \
124+
nvcr.io/nvidia/clara-holoscan/holoscan:v2.4.0-dgpu /bin/bash -c \
125+
"apt-get update && apt-get install -y python3-pip git && \
126+
pip3 install jupyter && \
127+
mkdir -p /workspace/holoscan_jupyter_notebooks && \
128+
jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root --no-browser --NotebookApp.token='' --NotebookApp.password='' --notebook-dir=/workspace"
129+
130+
broadcast "Holoscan Jupyter container started successfully."
131+
log "Holoscan Jupyter container started successfully."
132+
133+
# Stop and configure firewall
134+
echo "Configuring firewall..."
135+
systemctl stop firewalld
136+
firewall-offline-cmd --zone=public --add-port=8888/tcp
137+
systemctl start firewalld
138+
139+
broadcast "Cloudinit.sh script completed."
140+
log "Cloudinit.sh script completed."

0 commit comments

Comments
 (0)