-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwith_dask
46 lines (34 loc) · 1.38 KB
/
with_dask
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
import dask
# ONLY RUN THIS CELL ONCE
# NOTE: you may need to change the project number
from dask_jobqueue import PBSCluster
from dask.distributed import Client
proj = YOURPROJECTNUMBERINASTRING
# Setup your PBSCluster
cluster = PBSCluster(
cores=1, # The number of cores you want
memory='40GB', # Amount of memory
processes=1, # How many processes
queue='casper', # The type of queue to utilize (/glade/u/apps/dav/opt/usr/bin/execcasper)
local_directory='$TMPDIR', # Use your local directory
resource_spec='select=1:ncpus=1:mem=20GB', # Specify resources
project=proj, # Input your project ID here
walltime='02:00:00', # Amount of wall time
interface='ib0', # Interface to use
)
# Scale up
#cluster.scale(18)
cluster.adapt(minimum=1,maximum=2)
# Change your url to the dask dashboard so you can see it
dask.config.set({'distributed.dashboard.link':'https://jupyterhub.hpc.ucar.edu/stable/user/{USER}/proxy/{port}/status'})
# Setup your client
client = Client(cluster)
client
# ----------------------------------------------------- Continue with whatever you want
# ----------------------------------------------------- Close dask
cluster.close()
client.shutdown()
# ----------------------------------------------------- Dasked
ensemble_mean = xr.open_dataset('/glade/work/cassiacai/ensemble_mean.nc', chunks = {})
# Now do the rest of the code...