Skip to content

Instantly share code, notes, and snippets.

View jacobtomlinson's full-sized avatar

Jacob Tomlinson jacobtomlinson

View GitHub Profile
@jacobtomlinson
jacobtomlinson / README.md
Last active June 13, 2024 09:43
Run dask-cuda on a SLURM HPC

When using LocalCUDACluster on a single node it is possible to scale your work out on a SLURM based HPC with a few small tweaks.

First install the Dask Runners package. (Note: this is a prototype and will be merged into dask-jobqueue in the future)

pip install git+https://github.com/jacobtomlinson/dask-hpc-runner.git

Then replace LocalCUDACluster with the SLURMRunner class.

station mean_temp
Abha 18.0
Abidjan 26.0
Abéché 29.4
Accra 26.4
Addis Ababa 16.0
Adelaide 17.3
Aden 29.1
Ahvaz 25.4
Albuquerque 14.0
@jacobtomlinson
jacobtomlinson / run.py
Created November 2, 2023 17:21
Databrick run
import os
import subprocess
import time
import socket
DB_IS_DRIVER = os.getenv('DB_IS_DRIVER')
DB_DRIVER_IP = os.getenv('DB_DRIVER_IP')
if DB_IS_DRIVER == "TRUE":
print("This node is the Dask scheduler.")
@jacobtomlinson
jacobtomlinson / beam_k8s.py
Last active May 12, 2023 13:42
Apache Beam Dask Limitation MRE
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.runners.dask.dask_runner import DaskRunner
from dask.distributed import Client, performance_report
class NoopDoFn(beam.DoFn):
def process(self, item):
import time
time.sleep(0.1)
@jacobtomlinson
jacobtomlinson / beam_k8s.py
Created May 11, 2023 13:41
Apache Beam Dask Limitation MRE
import warnings
import time
from contextlib import contextmanager
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.runners.dask.dask_runner import DaskRunner
from dask.distributed import Client
from distributed.versions import VersionMismatchWarning
@jacobtomlinson
jacobtomlinson / notebook.yaml
Last active February 2, 2023 17:40
Kubernetes manifest to launch a Jupyter Notebook running RAPIDS ready for use with the Dask Operator
apiVersion: v1
kind: ServiceAccount
metadata:
name: jovyan
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: jovyan
rules:
@jacobtomlinson
jacobtomlinson / example.yaml
Created November 7, 2022 14:34
Example DaskCluster resource
apiVersion: kubernetes.dask.org/v1
kind: DaskCluster
metadata:
name: demo
spec:
worker:
replicas: 2
spec:
containers:
- name: worker
@jacobtomlinson
jacobtomlinson / README.md
Last active October 28, 2022 11:41
Recording textual demos with vhs

Install vhs.

$ conda create -n textual-demo python=3.10 -y

$ conda activate textual-demo

$ pip install textual

$ vhs < demo.tape
@jacobtomlinson
jacobtomlinson / notebook.ipynb
Last active March 11, 2022 17:40
Launch a hybrid CPU and GPU Dask cluster and use annotations to pin work to specific hardware
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jacobtomlinson
jacobtomlinson / poke.py
Created January 6, 2022 14:36
Poke Dask dashboard
# A script that gives a local Dask cluster something to do without stressing hardware.
# Useful for testing the dashboard.
import time
from dask_ctl import get_cluster
from dask.distributed import Client, wait
from dask import delayed