Jupyter and Python
Many excellent tutorials and pedagogical resources on the use of deep learning packages are available online and are structured as Jupyter notebooks, which interleave code and a markdown-based narrative. This enables users to both learn new concepts and easily run those codes on their own, or to modify as they see fit. In some cases, a convenient option is provided to run the notebook directly on a free resource that can host Jupyter notebooks, such as Google Colab or Microsoft Learn. These resources can be useful for getting started, or for understanding the action of different computational operations, but do not generally support running large or long-running jobs, which the high-end systems at TACC are geared towards. Therefore, even if you start with one of the tutorial notebooks hosted online and then modify it for your own needs, you will want to download that code to your local machine and then transfer it to one or more of the TACC systems in order to run there. (Follow this link for more information about transferring files to Frontera at TACC machines.)
If you wish to run Jupyter notebooks on TACC machines, the TACC Analysis Portal provides an interface enabling you to run notebook-based jobs on those resources.
But while Jupyter notebooks are useful in many different contexts, you might not want to be constrained by them in order to run large deep learning jobs on dedicated computational resources. Fortunately, Jupyter enables you to extract the underlying Python source code so that you can run Python jobs from the command line rather than notebooks through the Jupyter interface. The process of source code extraction looks slightly different depending on whether you want to use the command line, or via the GUI in either the newer "jupyter lab" interface (JupyterLab) or the older "jupyter notebook" interface:
- command line:
jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb
- jupyter lab: Select File > Export Notebook As... > Executable Script
- jupyter notebook: Select File > Download As > Python (.py)
One caveat to this process involves any jupyter/ipython "magic" commands that might be present in the original notebook. ("Magic" commands begin with %
or %%
, and represent additional functionality provided by jupyter/ipython that are not part of the Python language itself.) Upon source code export using one of the methods listed above, any magic commands will be converted to a call to the get_ipython
function that is part of the IPython library. For example, the magic command
will get converted to the statement
Unless you plan to run batch jobs using the ipython interpreter, you will probably want to remove or comment out those calls to get_python()
and ensure that the rest of the program can run as a standalone program using the python (python3) interpreter. Fortunately, magic commands are typically used to facilitate interactive computing, and are not generally associated with the core numerical operations that a program is carrying out.