Goals:
Walk through a navigating within a Jupyter Notebook session
Demonstrate options and features available in Jupyter Notebooks
Initial Screen Navigation and Options
Upon connecting, you are presented the jupyter dashboard which serves as your home page for jupyter notebook. The Jupyter Notebook screen is rather simple with 3 tabs:
|
---|
What are Kernels?
A Jupyter kernel is the computational engine behind the code execution in Jupyter notebooks.
Most users think of this as the “compiler” or programming language used when running code cells.
The Kernel empowers you to execute code in different programming languages like Python, R, or Julia or other languages and instantly view the outcomes within the notebook interface.
Once you open a new notebook, you may be prompted to select a kernel
| |
Default Kernels on ARCC HPC Resources currently include:
HPC-wide kernels are titled by packages installed and available when launched Users can also create user-defined kernels from conda environments (Covered in a subsequent module. See: Launching Jupyter Kernels from Conda Environments) |
Open a New Blank Notebook
From the Right side of the File Management Tab: New->Notebook-> Select from a list of kernels. Choose This should open a new browser tab/window with a blank Jupyter notebook named: If we go back to our previous Jupyter tab/window containing the file browser from which we launched our notebook, this new file shows up in the list, and has a green icon to it’s left, meaning it is currently running: |
New Notebook - New Options
When a notebook is open a new browser tab is created showing the notebook user interface (UI).
This allows for interactive editing and running of the notebook document.
|
Menu Bar with Dropdowns
Note: Jupyter extensions can create new top-level menus in the menu bar. | |
Right of the menu bar, the current kernel is listed |
Toolbar Actions
- Save and checkpoint notebook |
Notebook Cell Types
We can use the cell type option in the toolbar to set cell type in the notebook body:
|
Code
|
---|
Markdown
|
---|
Raw NBConvert
|
Where are we?
Previously, we said the file management tab shows the filesystem accessible to the user, rooted by the directory from which the notebook was launched. In the file management tab we can see root directory, and within it, the Desktop, Documents, and Downloads, and ondemand directories. We could just assume the file manager is showing our home directory. But how would we find out for certain? |
Running with a Python kernel, we can use our jupyter notebook to get this information from the system:
Note: New input cells are code cell types by defaultWith the information from our output cell, we can conclude that OnDemand launches Jupyter from your $HOME |
|
How to get to directories outside of $HOME?
If we select the default Python 3 (ipykernel), we are presented with the file explorer showing our home directory as it’s rooted location. This means we can’t go up any further in system’s directory structure.
| |
|
What Packages are Available in our Kernel?
In our notebook, we can see which modules are available by opening a new cell with the + button. In our cell box, set as “code” use the python Hitting tab after |
New Cell in our Notebook
Since we appear to have a large number of packages available in this environment, we’ll import one we expect to be there. In our bottom-most cell, add to the import command by typing an import for a common package used in mathematic and multi dimensional matrix computations - numpy. |
Run this command with the run button
Our output results in an error: |
|
Load a different kernel
Depending on the HPC’s native environment, you may have other kernels available. |
To load a different kernel, we go to the Kernel option in our drop down menu then navigate to “Change kernel”.
|
The new kernel is loaded as shown in the top right of our notebook.
|
No available kernels have all the software I need - Now what?
Next Steps
Previous | Workshop Home | Next |