279 lines
9.5 KiB
Plaintext
279 lines
9.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "19051402",
|
|
"metadata": {
|
|
"tags": []
|
|
},
|
|
"source": [
|
|
"<img src=\"./images/DLI_Header.png\" width=400/>"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "67ed6062",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Fundamentals of Accelerated Data Science #"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a65f57f0",
|
|
"metadata": {},
|
|
"source": [
|
|
"## 00 - Introduction ##\n",
|
|
"Welcome to NVIDIA's Deep Learning Institute workshop on the Fundamentals of Accelerated Data Science. This interactive lab offers practical experience with every stage of the development process, empowering participants to tailor solutions for their unique applications."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "50d32b6c",
|
|
"metadata": {},
|
|
"source": [
|
|
"**Learning Objectives**\n",
|
|
"<br>\n",
|
|
"In this workshop, you will learn: \n",
|
|
"* Overview of data science\n",
|
|
"* Demonstrations of data science workflows\n",
|
|
"* How acceleration is achieved\n",
|
|
"* How to design operations to maximize GPU acceleration\n",
|
|
"* Implications of acceleration"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "3a02c2b6",
|
|
"metadata": {},
|
|
"source": [
|
|
"### JupyterLab ###\n",
|
|
"For this hands-on lab, we use [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/) to manage our environment. The [JupyterLab Interface](https://jupyterlab.readthedocs.io/en/stable/user/interface.html) is a dashboard that provides access to interactive iPython notebooks, as well as the folder structure of our environment and a terminal window into the Ubuntu operating system. The first view includes a **menu bar** at the top, a **file browser** in the **left sidebar**, and a **main work area** that is initially open to this \"introduction\" notebook. \n",
|
|
"\n",
|
|
"<p><img src=\"images/jl_launcher.png\" width=720></p>\n",
|
|
"\n",
|
|
"* The file browser can be navigated just like any other file explorer. A double click on any of the items will open a new tab with its content. \n",
|
|
"* The main work area includes tabbed views of open files that can be closed, moved, and edited as needed. \n",
|
|
"* The notebooks, including this one, consist of a series of content and code **cells**. To execute code in a code cell, press `Shift+Enter` or the `Run` button in the menu bar above, while a cell is highlighted. Sometimes, a content cell will get switched to editing mode. Executing the cell with `Shift+Enter` or the `Run` button will switch it back to a readable form.\n",
|
|
"* To interrupt cell execution, click the `Stop` button in the menu bar or navigate to the `Kernel` menu, and select `Interrupt Kernel`. \n",
|
|
"* We can use terminal commands in the notebook cells by prepending an exclamation point/bang(`!`) to the beginning of the command.\n",
|
|
"* We can create additional interactive cells by clicking the `+` button above, or by switching to command mode with `Esc` and using the keyboard shortcuts `a` (for new cell above) and `b` (for new cell below)."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "4492c58d",
|
|
"metadata": {},
|
|
"source": [
|
|
"<a name='e1'></a>\n",
|
|
"### Exercise #1 - Practice ###\n",
|
|
"**Instructions**: <br>\n",
|
|
"* Try executing the simple print statement in the below cell.\n",
|
|
"* Then try executing the terminal command in the cell below."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e69a6515",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"# activate this cell by selecting it with the mouse or arrow keys then use the keyboard shortcut [Shift+Enter] to execute\n",
|
|
"print('This is just a simple print statement.')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e54fe372",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"!echo 'This is another simple print statement.'"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "c2e5151b-4842-465e-a20d-bb64af66d011",
|
|
"metadata": {},
|
|
"source": [
|
|
"<a name='e2'></a>\n",
|
|
"### Exercise #2 - Available GPU Accelerators ###\n",
|
|
"The `nvidia-smi` (NVIDIA System Management Interface) command is a powerful utility for managing and monitoring NVIDIA GPU devices. It will print information about available GPUs, their current memory usage, and any processes currently utilizing them. \n",
|
|
"\n",
|
|
"**Instructions**: <br>\n",
|
|
"* Execute the below cell to learn about this environment's available GPUs. "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "08d543eb-a951-4eb9-8107-b13c01b3ac46",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"!nvidia-smi"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "adee74e3-613a-4986-be34-ff3ae113ccc7",
|
|
"metadata": {},
|
|
"source": [
|
|
"**Note**: Currently, GPU memory usage is minimal, with no active processes utilizing the GPUs. Throughout our session, we'll employ this command to monitor memory consumption. When conducting GPU-based data analysis, it's advisable to maintain approximately 50% of GPU memory free, allowing for operations that may expand data stored on the device."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "f0839f2e-dfe3-4d8f-8010-ed8445c171fb",
|
|
"metadata": {},
|
|
"source": [
|
|
"<a name='e3'></a>\n",
|
|
"### Exercise #3 - Magic Commands ###\n",
|
|
"The Jupyter environment come installed with *magic* commands, which can be recognized by the presence of `%` or `%%`. We will be using two magic commands liberally in this workshop: \n",
|
|
"* `%time`: prints summary information about how long it took to run code for a single line of code\n",
|
|
"* `%%time`: prints summary information about how long it took to run code for an entire cell\n",
|
|
"\n",
|
|
"**Instructions**: <br>\n",
|
|
"* Execute the below cell to import the `time` library. \n",
|
|
"* Execute the cell below to time the single line of code. \n",
|
|
"* Execute the cell below to time the entire cell. "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "b1c34489-7812-4ffe-bd2e-748a52903481",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"from time import sleep"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "db1d5de9-f6e6-4984-8c32-f13b51aa27db",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"# %time only times one line\n",
|
|
"%time sleep(2) \n",
|
|
"sleep(1)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "daf2f6f0-58a9-43a5-af8f-0b69b4a2a3a8",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"%%time\n",
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"# %%time will time the entire cell\n",
|
|
"sleep(1)\n",
|
|
"sleep(1)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "42ed873e-f7b5-4668-8e96-ce31d53d43b1",
|
|
"metadata": {},
|
|
"source": [
|
|
"<a name='e4'></a>\n",
|
|
"### Exercise #4 - Jupyter Kernels and GPU Memory ###\n",
|
|
"The compute backend for Jupyter is called the *kernel*. The Jupyter environment starts up a separate kernel for each new notebook. The many notebooks in this workshop are each intended to stand alone with regard to memory and computation. \n",
|
|
"\n",
|
|
"To ensure we have enough memory and compute for each notebook, we can clear the memory at the conclusion of each notebook in two ways: \n",
|
|
"1. Shut down the kernel with `ipykernel.kernelapp.IPKernelApp.do_shutdown()` or\n",
|
|
"2. Shut down the kernel through the *Running Terminals and Kernels* panel. \n",
|
|
"\n",
|
|
"**Instructions**: <br>\n",
|
|
"* Execute the below cell to shut down and restart the current kernel. \n",
|
|
"* Shut down the current kernel through the *Running Terminals and Kernels* panel.\n",
|
|
"\n",
|
|
"<p><img src=\"images/kernel_restart.png\" width=720></p>\n",
|
|
"\n",
|
|
"**Note**: Restarting the kernel from the *Kernel* menu will only clear the memory for *the current notebook's kernel*, while notebooks other than the one we're working on may still have memory allocated for *their unique kernels*. "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "98e05b77-6019-428b-8e18-a2477692ef6f",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# DO NOT CHANGE THIS CELL\n",
|
|
"import IPython\n",
|
|
"app = IPython.Application.instance()\n",
|
|
"app.kernel.do_shutdown(True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "0321075e-433e-42d4-b849-de3fa17b54e1",
|
|
"metadata": {},
|
|
"source": [
|
|
"**Note**: Executing the provided code cell will shut down the kernel and activate a popup indicating that the kernel has restarted."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "8e950df2",
|
|
"metadata": {},
|
|
"source": [
|
|
"**Well Done!** Let's move to the [next notebook](1-01_section_overview.ipynb). "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "b604003a",
|
|
"metadata": {},
|
|
"source": [
|
|
"<img src=\"./images/DLI_Header.png\" width=400/>"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.10.15"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|