Ask Your Question
1

Run Sagemath codes on a cluster.

asked 2022-03-29 14:39:14 +0200

lijr07 gravatar image

updated 2022-03-29 16:54:34 +0200

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

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2022-03-29 16:08:23 +0200

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.

edit flag offensive delete link more

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 ( 2022-03-29 16:58:42 +0200 )edit

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 ( 2022-03-29 17:47:08 +0200 )edit

@tmonteil, thank you very much.

lijr07 gravatar imagelijr07 ( 2022-03-29 19:00:15 +0200 )edit
1

answered 2022-03-29 15:11:39 +0200

FrédéricC gravatar image

Nihao

use the unix command "Screen"

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

edit flag offensive delete link more

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 ( 2022-03-29 15:31:13 +0200 )edit

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

export TERM=screen
tmonteil gravatar imagetmonteil ( 2022-03-29 16:10:28 +0200 )edit

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

lijr07 gravatar imagelijr07 ( 2022-03-29 16:52:44 +0200 )edit

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 ( 2022-03-30 00:35:46 +0200 )edit

@max, thank you very much for your suggestions!

lijr07 gravatar imagelijr07 ( 2022-03-30 15:11:20 +0200 )edit

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: 2022-03-29 14:39:14 +0200

Seen: 48 times

Last updated: Mar 29