I'm doing simulation with Quantum ESPRESSO, and it's my first time to run it on a server using ssh. I ran some calculations yesterday then I logout using the command exit, when I checked the calculations today I noticed that file.out is stuck in the same line sense the morning, so I assumed that the calculation stopped since yesterday after logging out.

Can logging out from the server stop the calculation? if yes how can I logout and close my laptop without affecting the calculation?

I also want to know how can I check the completed calculations without using nano command to check if the job is done for each single file?


2 Answers 2


Question: Does loging out from the server stop my Quantum ESPRESSO calculations? Answer: It depends on how you are submitting your jobs.

Some examples:

  • Using mpirun -np 16 pw.x <scf.in> scf.out & (with the & at the end) will allow you to logout and the job will continue running in the background. Here you can close your laptop.
  • Using mpirun -np 16 pw.x <scf.in> scf.out (without the & at the end) will kill your job as soon you logout or even close the connection. In order to the job keep running, you have to remains connected to the server, so, closing your laptop will kill the jobs.
  • Using a submission script for the workload manager (Torque, PBS, SLURM, etc.): you can logout and your job will keep running at the background.

Question: I also want to know how can I check the completed calculations without using nano command to check if the job is done for each single file?
Answer: It will depend on how you submitted the job.
If you used a workloader, then you need to use the command to check jobs. For example, using SLURM: squeue -u $USER, will return all the jobs, using squeue -u $USER -t RUNNING will return only the running jobs and using squeue -u $USER -t PENDING will show you the pending jobs.
If you submitted the job as mpirun -np 16 pw.x <scf.in> scf.out &, for example, using the command ps -U $USER -u $USER u will return all the process executed by the current user.

  • 1
    $\begingroup$ It might not be enough to add '&' at the end as this will cause the process to stop when the shell is closed. It might be needed to add nohup in the beginning for the process to run even if the shell closes. See here for more. $\endgroup$ Commented May 12, 2023 at 14:32
  • $\begingroup$ @RashidRafeek, nope, adding & is enough, even when you close the terminal (this is how I send my jobs in my servers). The option to use nohup is welcome when you want to keep all the output from the program, if any. $\endgroup$
    – Camps
    Commented May 12, 2023 at 16:24
  • $\begingroup$ You are right, in normal cases adding '&' is enough. But if the shell is terminated unexpectedly, it will cause the program to send a SIGHUP signal to its child processes, and will thereby terminate the child processes. And nohup is resilient to such cases. You can test it by forcefully closing the ssh connection to the server, by maybe killing the ssh process as described here and then login again and check whether the program is still running. I suspect that the OP is facing this issue. $\endgroup$ Commented May 12, 2023 at 17:29
  • $\begingroup$ There is a reason why I specifically asked the OP to empirically test what would actually happen, rather than just assert that the & method, which I strongly doubted would work anyway, works or not. $\endgroup$ Commented May 12, 2023 at 17:40
  • $\begingroup$ Whether or not & "works" in this situation is highly dependent on the configuration of your system. Apparently, RedHat-based systems have the behavior you describe, but not all systems do. This is why there's programs (like nohup and disown) whose primary function (and name) is based around disconnecting programs from the user interface signalling system. $\endgroup$
    – R.M.
    Commented May 13, 2023 at 12:11

To run big big Quantum ESPRESSO simulations it is recommended to submit a batch job to the server.

If your server is not one of those centrally managed ones, then you should be using terminal multiplexers like tmux or screen which allow you to keep programs running even after logging out.

  • $\begingroup$ to run an scf calculation for example I just use the command mpirun -np 16 pw.x <scf.in> scf.out& that what was giving to me by a professor here and it works $\endgroup$
    – Camilla
    Commented May 12, 2023 at 12:38
  • $\begingroup$ Yes, that works. But have you tested if it would continue to work if you log out? It is easy to empirically test this: do a 1 CPU test of a simple system that finishes in 2 minutes, and then rerun it and log out. If it does not finish in 5 minutes after you log back in, then it is clear that logging out was fatal to that method of running. $\endgroup$ Commented May 12, 2023 at 12:40
  • $\begingroup$ Any command you sent in terminal that has at the end the symbol &, will remain running after you log out. $\endgroup$
    – Camps
    Commented May 12, 2023 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .