" '/data/project/triplab/backups/react/G/REACT/Participant Data/Development for Databases and Syntax/REACT_annotation_development/QC_urban_pedestrian_sets_oct_2021/Inaara/Completed Frames/106199_61/frame13851_2020-08-03 09_23_31.485000-05_00.jpg',\n",
" title=\"File Count By File Size\", xlabel='Size Group',ylabel='Count')\n",
"f2.show()"
]
}
}
],
],
"metadata": {
"metadata": {
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Example Dask Workflow
## Example Dask Workflow
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
frompathlibimportPath
frompathlibimportPath
fromrc_gpfsimportcompute
fromrc_gpfsimportcompute
```
```
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
with_cuda=True
with_cuda=True
manager=compute.start_local_cluster(
manager=compute.start_local_cluster(
with_cuda,
with_cuda,
threads_per_worker=10,
threads_per_worker=10,
local_directory='/scratch/local',
local_directory='/scratch/local',
rmm_pool_size='70 GiB',
rmm_pool_size='70 GiB',
rmm_managed_memory=True,
rmm_managed_memory=True,
pre_import='cudf,rmm')
pre_import='cudf,rmm')
```
```
%% Output
%% Output
WARNING:bokeh.server.util:Host wildcard '*' will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly
WARNING:bokeh.server.util:Host wildcard '*' will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Cluster settings:
Cluster settings:
-`threads_per_worker`: start 10 threads in all available GPUs
-`threads_per_worker`: start 10 threads in all available GPUs
-`local_directory`: local working directory for dask worker processes
-`local_directory`: local working directory for dask worker processes
-`rmm_pool_size`: initialize a 70 GiB memory pool to greatly reduce the number of memory allocation requests during work. If needed, dask can still utilize up to the maximum VRAM, this is just an initial allocation
-`rmm_pool_size`: initialize a 70 GiB memory pool to greatly reduce the number of memory allocation requests during work. If needed, dask can still utilize up to the maximum VRAM, this is just an initial allocation
-`pre_import`: pre-load workers with the given libraries
-`pre_import`: pre-load workers with the given libraries
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
### Dask Dashboard
### Dask Dashboard
If you're on the same network as the compute node (either VPN or sshuttle), you can access the dask dashboard in your browser by going to `<node_ip>:8787`. Jobs on `c0241` will have a dashboard at `172.20.201.241:8787`. You can print the link using the `dashboard_link` property as well, but that will most likely show `127.0.0.1` as the IP which will not work.
If you're on the same network as the compute node (either VPN or sshuttle), you can access the dask dashboard in your browser by going to `<node_ip>:8787`. Jobs on `c0241` will have a dashboard at `172.20.201.241:8787`. You can print the link using the `dashboard_link` property as well, but that will most likely show `127.0.0.1` as the IP which will not work.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
manager.dashboard_link
manager.dashboard_link
```
```
%% Output
'http://127.0.0.1:8787/status'
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
!hostname--ip-address
!hostname--ip-address
```
```
%% Output
172.20.201.241
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
It's advised to have the dashboard available, especially when using methods like `persist()` that look like they have completed successfully but are still running computation in the background
It's advised to have the dashboard available, especially when using methods like `persist()` that look like they have completed successfully but are still running computation in the background
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
### Shutdown Cluster
### Shutdown Cluster
It's imperative to shut down the cluster when you're done working. There have been a number of instances where I've restarted the kernel in the middle of a dask compute task where the worker processes could not be successfully killed. This caused the dask watchdog process to timeout which caused NHC to put the node into a drain state. Load increased consistently until the node became unresponsive and had to be rebooted. Before ending your job, call `manager.shutdown()` to close both the dask client and cluster objects.
It's imperative to shut down the cluster when you're done working. There have been a number of instances where I've restarted the kernel in the middle of a dask compute task where the worker processes could not be successfully killed. This caused the dask watchdog process to timeout which caused NHC to put the node into a drain state. Load increased consistently until the node became unresponsive and had to be rebooted. Before ending your job, call `manager.shutdown()` to close both the dask client and cluster objects.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
#manager.shutdown()
#manager.shutdown()
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Dask Analysis
## Dask Analysis
This setup assumes you're using a LocalCUDACluster and so sets the default dataframe backend to `cudf` instead of `pandas`. Remember that every partition is a `cudf.DataFrame` which is mostly compatible with a pandas-style workflow but not always. A common issue is when trying to do anything semi-complicated with datetimes, like cutting into groups. It's generally better to convert those to unix timestamps first (ints) and work from there.
This setup assumes you're using a LocalCUDACluster and so sets the default dataframe backend to `cudf` instead of `pandas`. Remember that every partition is a `cudf.DataFrame` which is mostly compatible with a pandas-style workflow but not always. A common issue is when trying to do anything semi-complicated with datetimes, like cutting into groups. It's generally better to convert those to unix timestamps first (ints) and work from there.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
importdask.dataframeasdd
importdask.dataframeasdd
importdask
importdask
dask.config.set({'dataframe.backend':'cudf'})
dask.config.set({'dataframe.backend':'cudf'})
```
```
%% Output
%% Output
<dask.config.set at 0x2aabe78824d0>
<dask.config.set at 0x2aabe7362e10>
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
This example also uses one of the flat parquet datasets from a single GPFS policy run, but can be extended to the hive structure with very minor modifications
This example also uses one of the flat parquet datasets from a single GPFS policy run, but can be extended to the hive structure with very minor modifications
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
### Dataframe Indexing
### Dataframe Indexing
If you're using the flat parquet, it's highly advised to not set an index after setting up the dataframe unless the `path` column is excluded from the dataset. This causes a large shuffle that must be done mostly in-memory, and the `path` column alone can exceed 80 GB in `data-project` GPFS logs. This can be worked around by reading just a few columns and setting up managed memory (`rmm`) in the cluster options which was done at the beginning of the notebook. This allows most compute to take place, but I wouldn't depend on it for everything.
If you're using the flat parquet, it's highly advised to not set an index after setting up the dataframe unless the `path` column is excluded from the dataset. This causes a large shuffle that must be done mostly in-memory, and the `path` column alone can exceed 80 GB in `data-project` GPFS logs. This can be worked around by reading just a few columns and setting up managed memory (`rmm`) in the cluster options which was done at the beginning of the notebook. This allows most compute to take place, but I wouldn't depend on it for everything.
If you need a dataset that has already been indexed by path, use the hive dataset versions instead. Those are found in `/data/rc/gpfs-policy/data/gpfs-hive/{data-project,data-user,scratch}`. These have not all been computed yet though so a desired dataset may be unavailable.
If you need a dataset that has already been indexed by path, use the hive dataset versions instead. Those are found in `/data/rc/gpfs-policy/data/gpfs-hive/{data-project,data-user,scratch}`. These have not all been computed yet though so a desired dataset may be unavailable.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
### Example: Arranging Files into Groups By Similar Size
### Example: Arranging Files into Groups By Similar Size
'/data/project/triplab/backups/react/G/REACT/Participant Data/Development for Databases and Syntax/REACT_annotation_development/QC_urban_pedestrian_sets_oct_2021/Inaara/Completed Frames/106199_61/frame13851_2020-08-03 09_23_31.485000-05_00.jpg',