First time here? Check out the FAQ!

Ask Your Question
1

Run Sagemath codes on a cluster.

asked 2 years ago

lijr07 gravatar image

updated 2 years ago

I am running a Sagemath program on a cluster. The way I do this is to use sage command line on a terminal and copy program to the terminal. But the problem is when I close the terminal, the program stops. How to run the program on a cluster without stopping when we close the terminal? Thank you very much.

Edit: when I tried to use screen command and copy the codes to sage command lines. The following errors appears. image description

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 2 years ago

tmonteil gravatar image

Alternative suggestion : use tmux.

Hint: if you do not know whether a tmux session is already running, you can run tmux attach || tmux.

Preview: (hide)
link

Comments

@tmonteil, thank you very much. It seems that this works. So I just run tmux and then run sage and run the program on sage. If I close the local terminal, the program will still run on the supercomputer. Am I correct?

lijr07 gravatar imagelijr07 ( 2 years ago )

Yes, and when you come back, you can reattach your session with tmux attach. There are also a lot of keyboard sortcuts.

tmonteil gravatar imagetmonteil ( 2 years ago )

@tmonteil, thank you very much.

lijr07 gravatar imagelijr07 ( 2 years ago )
1

answered 2 years ago

FrédéricC gravatar image

Nihao

use the unix command "Screen"

https://linuxize.com/post/how-to-use-...

Preview: (hide)
link

Comments

@FrédéricC, thank you very much. I typed screen and then run sagemath and copied the codes to sagemath. But then it is said that there is some errors on the codes. But when I do not type screen in the beginning, it works well. Do you know why this happens?

lijr07 gravatar imagelijr07 ( 2 years ago )

Perhaps some issues with copying/pasting. You can try to do (before running screen) :

export TERM=screen
tmonteil gravatar imagetmonteil ( 2 years ago )

@tmonteil, thank you very much. The problem still exists. I attached a picture (in the post) which shows the errors.

lijr07 gravatar imagelijr07 ( 2 years ago )

I'd suggest saving your code to a file and loading it to Sage via load(...) command. This would eliminate the need of copying and pasting and related issues.

Max Alekseyev gravatar imageMax Alekseyev ( 2 years ago )

@max, thank you very much for your suggestions!

lijr07 gravatar imagelijr07 ( 2 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2 years ago

Seen: 1,789 times

Last updated: Mar 29 '22