-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
--- | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
labels: | ||
template: gpu-jupyterlab | ||
metadata: | ||
annotations: | ||
description: |- | ||
Start JupyterLab to run CUDA, Tensorflow, or PyTorch using GPUs | ||
with the root user. | ||
By default the GPU will not be enabled, so you can start | ||
this workspace to prepare your code and data.nOnce your the GPU has been enabled | ||
in your project, you can enable the GPU in your workspace with this command | ||
(replace jupyterlab-gpu with the name of your deployment) | ||
oc patch dc/jupyterlab-gpu | ||
--type=json -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/resources", | ||
"value": {"requests": {"nvidia.com/gpu": 1}, "limits": {"nvidia.com/gpu": 1}}}]'U | ||
📦 We recommend you to use `mamba install` to install new packages, but you can | ||
also use `pip install` or `apt-get install` | ||
📂 Use the `/workspace/persistent` folder (workspace of the JupyterLab UI) to store your data in the persistent | ||
storage | ||
🐳 You can directly use the following Docker images to work on GPU: | ||
- CUDA build, based on https://ngc.nvidia.com/catalog/containers/nvidia:cudanghcr.io/maastrichtu-ids/jupyterlab:cuda | ||
- Tensorflow build, based on https://ngc.nvidia.com/catalog/containers/nvidia:tensorflownghcr.io/maastrichtu-ids/jupyterlab:tensorflow | ||
- PyTorch build, based on https://ngc.nvidia.com/catalog/containers/nvidia:pytorchnghcr.io/maastrichtu-ids/jupyterlab:pytorch | ||
- FSL, built with NeuroDocker and CUDA:ghcr.io/maastrichtu-ids/jupyterlab:fsl-gpu | ||
Feel free to check how the GPU images are built and to customize them for your project: | ||
https://github.com/MaastrichtU-IDS/jupyterlabnnU0001F4CB️ You can find some | ||
examples for Tensorflow and PyTorch in the following repositories:nhttps://gitlab.maastrichtuniversity.nl/dsri-examples/dsri-tensorflow-workspacenhttps://gitlab.maastrichtuniversity.nl/dsri-examples/dsri-pytorch-workspacennU0001F5D1️ | ||
Use this command with your application name to delete completely your application | ||
and its persistent volumes:noc delete all,pvc,secret,configmaps,serviceaccount,rolebinding | ||
--selector app=$APPLICATION_NAME' | ||
iconClass: icon-python | ||
openshift.io/display-name: JupyterLab on GPU | ||
openshift.io/documentation-url: https://maastrichtu-ids.github.io/dsri-documentation/docs/deploy-on-gpu | ||
openshift.io/provider-display-name: Institute of Data Science, UM | ||
openshift.io/support-url: https://maastrichtu-ids.github.io/dsri-documentation/help | ||
tags: python,jupyter,gpu | ||
name: gpu-jupyterlab | ||
namespace: openshift | ||
objects: | ||
- apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
template.openshift.io/expose-password: "{.data['application-password']}" | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
name: "${APPLICATION_NAME}" | ||
stringData: | ||
application-password: "${JUPYTER_TOKEN}" | ||
- apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
name: "${APPLICATION_NAME}" | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: "${STORAGE_SIZE}" | ||
- apiVersion: apps.openshift.io/v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
name: "${APPLICATION_NAME}" | ||
spec: | ||
replicas: 1 | ||
selector: | ||
app: "${APPLICATION_NAME}" | ||
deploymentconfig: "${APPLICATION_NAME}" | ||
strategy: | ||
type: Rolling | ||
template: | ||
metadata: | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
deploymentconfig: "${APPLICATION_NAME}" | ||
spec: | ||
containers: | ||
- env: | ||
- name: JUPYTER_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
key: application-password | ||
name: "${APPLICATION_NAME}" | ||
- name: GIT_NAME | ||
value: "${GIT_NAME}" | ||
- name: GIT_EMAIL | ||
value: "${GIT_EMAIL}" | ||
- name: WORKSPACE | ||
value: "/workspace" | ||
- name: PERSISTENT_FOLDER | ||
value: "/workspace/persistent" | ||
image: "${IMAGE_NAME}" | ||
imagePullPolicy: "${IMAGE_PULL_POLICY}" | ||
name: "${APPLICATION_NAME}" | ||
ports: | ||
- containerPort: 8888 | ||
protocol: TCP | ||
- containerPort: 6006 | ||
protocol: TCP | ||
resources: | ||
limits: | ||
cpu: '64' | ||
memory: 256Gi | ||
requests: | ||
cpu: '2' | ||
memory: 8Gi | ||
volumeMounts: | ||
- mountPath: "/dev/shm" | ||
name: dshm | ||
- mountPath: "/workspace/persistent" | ||
name: data | ||
serviceAccountName: anyuid | ||
volumes: | ||
- emptyDir: | ||
medium: Memory | ||
name: dshm | ||
- name: data | ||
persistentVolumeClaim: | ||
claimName: "${APPLICATION_NAME}" | ||
test: false | ||
triggers: | ||
- type: ConfigChange | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
name: "${APPLICATION_NAME}" | ||
spec: | ||
ports: | ||
- name: 8888-tcp | ||
port: 8888 | ||
protocol: TCP | ||
targetPort: 8888 | ||
- name: 6006-tcp | ||
port: 6006 | ||
protocol: TCP | ||
targetPort: 6006 | ||
selector: | ||
app: "${APPLICATION_NAME}" | ||
deploymentconfig: "${APPLICATION_NAME}" | ||
- apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
name: "${APPLICATION_NAME}" | ||
spec: | ||
host: '' | ||
port: | ||
targetPort: 8888-tcp | ||
tls: | ||
insecureEdgeTerminationPolicy: Redirect | ||
termination: edge | ||
to: | ||
kind: Service | ||
name: "${APPLICATION_NAME}" | ||
weight: 100 | ||
parameters: | ||
- description: Must be unique in the project. It will be used to generate the application | ||
URL. | ||
displayName: Application name | ||
name: APPLICATION_NAME | ||
required: true | ||
value: jupyterlab-gpu | ||
- description: Check the description on the right for more details about available | ||
images | ||
displayName: Docker image used | ||
name: IMAGE_NAME | ||
required: true | ||
value: ghcr.io/maastrichtu-ids/jupyterlab:tensorflow | ||
- description: The password, aka. token, to access the notebook | ||
displayName: Notebook password | ||
name: JUPYTER_TOKEN | ||
required: true | ||
- description: Size of the storage allocated to the notebook persistent storage in | ||
`/workspace/persistent`. | ||
displayName: Storage size | ||
name: STORAGE_SIZE | ||
required: true | ||
value: 20Gi | ||
- description: Email used to automatically define git config --global user.name | ||
displayName: Git name | ||
name: GIT_NAME | ||
required: true | ||
value: default | ||
- description: Email used to automatically define git config --global user.email | ||
displayName: Git email | ||
name: GIT_EMAIL | ||
required: true | ||
value: [email protected] | ||
- description: Use Always to make sure the new image is pulled when you update it | ||
displayName: Image pull policy | ||
name: IMAGE_PULL_POLICY | ||
required: true | ||
value: IfNotPresent |