class:phy3026

This is an old revision of the document!


Class materials in git

git clone https://github.com/monttj/computational-physics

Prepare your computing environment

Install MobaXterm

https://mobaxterm.mobatek.net/download.html

MobaXterm

Connect to server

Ask to tutor to create accounts for students. Start local terminal in mobaxterm.

ssh -p PORT -X YOURID@210.117.210.IP

Jupyter notebook

To write and excute python code in your local browser, you need to create ssh tunnel to server. First, make sure you are using unique port number for tunnel. Follow the lines in the server.

jupyter notebook --generate-config
vi /home/YOURID/.jupyter/jupyter_notebook_config.py

Then you can excute jupyter in server.

jupyter-notebook --no-browser

You can check your port number in c.NotebookApp.port = 8888. Now, create tunnel in your LOCAL(in desktop) terminal (not in server!).

ssh -p PORT -f -N -L localhost:TunnelPort:localhost:TunnelPort YOURID@210.117.210.XX

Please don't confuse PORT (port to connect server when login) and TunnelPort (port to listen data from the server)!

The address to jupyter notebook will appear in the terminal. Copy & paste into local internet browser.

*Run .py in jupyter notebook*

%run some_code.py

*Disable ssh tunnel*

This is optional. But it can be required if you are using your own laptop without logout/restart, whatever. Find pid with ssh -p XXX…. (which is ssh tunnel command you wrote in terminal), then quit it.

ps -elf | grep ssh
kill -9 <PID>
  • class/phy3026.1567572806.txt.gz
  • Last modified: 2023/03/06 13:44
  • (external edit)