forward2 is a bash script to submit from your local machine a batch job to a slurm managed remote cluster and port forwards it back to your local machine.

Useful for jupyter notebook and tensorboard, amongst other things. 

The tool is available by clicking by downloading the following file forward2.tar.gz.

To access, use your CINECA HPC username and password.


Usage

On your local machine, enter the folder where forward2 is located and run the following command

$ ./forward2 [-u user] [-r resource] sbatchfile [path]
-u, --user username
-r, --resource cluster name (g100, marconi, leonardo, dgx)
-p, --port port number
-h, --help print this help
sbatchfile: sbatch script to submit that needs to be in the subfolder with the name of the cluster (you can already find some examples)
path: running path where to find your jupyter notebook on the cluster for example (default path: $HOME)

Optionally, user, resource, and port can be defined in a params.sh file located in the resource folder or in the current directory. If even the file is not found, the script asks the values and saves them in params.sh.

By default the batch script creates a forward-util directory in your cluster home where to copy the batch script and save the batch output. This default can be changed by setting RESOURCE_HOME in the params.sh file.


Usage examples

  1.  ./forward2 -u <username> -r marconi -p 47703 jupyter-conda /marconi_work/<project_name>
  2.  ./forward2 jupyter-conda -r marconi
  3.  ./forward2 tensorboard1.10 -r marconi
  4.  ./forward2 jupyter-conda /marconi_work/<project_name>
  5.  ./forward2 -r g100 jupyter-conda
  6.  ./forward2 -r dgx jupyter-lab

The script will output the different steps, and finally the instruction to connect, look for logs and end:

== Instructions ==
1. Open a browser at: http://localhost:47703/?token=5cffb394db829a61bf8d9df95def61125c411a5ee7341ed6
2. Something went wrong? Look at logs (see instruction above)
3. Use Control-C to end, cancel job and kill tunnels (twice to skip confirmation).


Add new batch scritps

New batch scripts can be added in the folder corresponding to the cluster name. Since the bash script waits for a token, if this is not written by your application, you must add echo "?token=" >&2 to your batch script, like in the tensorboard example.

  • No labels