From cd08451d2600e207bf0f9f3f3a9ef06d362d4311 Mon Sep 17 00:00:00 2001 From: Mohammed Tanash <mtanash2@unl.edu> Date: Wed, 3 Jul 2024 15:29:06 -0500 Subject: [PATCH] Add documentation for running JupyterLab code in SWAN --- .../running_jupyter_lab_code.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 content/applications/submitting_jupyter_code/running_jupyter_lab_code.md diff --git a/content/applications/submitting_jupyter_code/running_jupyter_lab_code.md b/content/applications/submitting_jupyter_code/running_jupyter_lab_code.md new file mode 100644 index 00000000..d819ae77 --- /dev/null +++ b/content/applications/submitting_jupyter_code/running_jupyter_lab_code.md @@ -0,0 +1,55 @@ ++++ +title = "Running JupyterLab Code (Running ipynb files) at HCC" +description = "How to run JupyterLab (ipynb) Code on HCC resources." ++++ + +If you are looking to run JupyterLab (ipynb Code) via HCC Slurm job, then you need to follow one of these methods: + +## Method 1: Running ipynb file using the Open OnDemand JupyterLab interface + +1- open your Jupyter Notebook with your written code. + +2- From the **"File"** menue choose **"Save and Export Notebook As"** and select **"Executable Script"**. This step will save the Python script on your local computer. + +3- Copy your exported code into HCC Swan cluster. + +4- Now, you can create a SLURM submit file with the loaded system-wide kernels in your SLURM submit script. + +5- Finall, you can run your Python script by adding **python test.py** in your SLURM submit script where **test.py** is the name of your Python file. + +{{% notice info %}} +If you have used your custom kernel, then you will need to load the anaconda module using the command **module load anaconda** in the SLURM submit script and activate your custom conda environment as shownin https://hcc.unl.edu/docs/applications/user_software/using_anaconda_package_manager/#creating-custom-anaconda-environments. +{{% /notice %}} + +## Method 2: Running ipynb file using ipython + +In this method,**ipython** and **nbconvert** are required. Note that the majority of system-wide kernels already have **ipython** and **nbconvert** installed. If that is not the case, please email us at hcc-support@unl.edu.. + +1- Create a SLURM submit file with the loaded system-wide kernels in your SLURM submit script. + +2- Now, you can run your Python script by adding **ipython -c "%run test.ipynb"** in your SLURM submit script where **test.py** is the name of your Python file. + + +{{% notice info %}} +If you want to use your custom kernel, then you will need to make sure **ipython** and **nbconvert** are installed in the conda environment, then you will need to load the anaconda module using the command **module load anaconda** in the SLURM submit script and activate your custom conda environment as shownin https://hcc.unl.edu/docs/applications/user_software/using_anaconda_package_manager/#creating-custom-anaconda-environments. + +{{% /notice %}} + + + + +## Method 3: Running ipynb file using jupyter-nbconvert + +In this method **nbconvert** is required. Note that the majority of system-wide kernels already have **nbconvert** installed. If that is not the case, please email us at hcc-support@unl.edu.. + +1- Create a SLURM submit file with the loaded system-wide kernels in your SLURM submit script. + +2- Now, you can run your Python script by adding **jupyter-nbconvert --execute --clear-output test.ipynb** in your SLURM submit script where **test.py** is the name of your Python file. + + +{{% notice info %}} +If you want to use your custom kernel, then you will need to make sure **nbconvert** are installed in the conda environment, then you will need to load the anaconda module using the command **module load anaconda** in the SLURM submit script and activate your custom conda environment as shownin https://hcc.unl.edu/docs/applications/user_software/using_anaconda_package_manager/#creating-custom-anaconda-environments. + +{{% /notice %}} + + -- GitLab