How to continue a simulation from restart/dump files?

55 views
Skip to first unread message

Jiyuan

unread,
Oct 9, 2025, 6:21:53 AM (4 days ago) Oct 9
to basilisk-fr

Hi everyone,

I am running a simulation with Basilisk and I generate restart/dump files during the run. My question is: after stopping a case (either by Ctrl+C or after it finishes generating a dump file), how can I continue running it from the last saved state?

For context, my current workflow is:

# Compile the serial version
qcc -o tangaroa tangaroa.c -lm -L$BASILISK/gl -lglutils -lfb_tiny

# Run the serial version to generate a restart file
./tangaroa 

# Compile the MPI version with dump file support
qcc -source -D_MPI=1 -DDUMP=1 tangaroa.c
mpicc -DDUMP=1 -Wall -std=c99 -D_XOPEN_SOURCE=700 -O2 _tangaroa.c -o tangaroa_mpi \
      -lm -L/home/sjy/basilisk/src/gl -lglutils -lfb_tiny

# Run the MPI version, which generates dump files periodically
mpirun -np 4 ./tangaroa_mpi 

After stopping the run, I am not sure how to restart the simulation from the last saved state. Could anyone please advise the recommended way to continue a case?

Thanks in advance!






Edoardo Cipriano

unread,
Oct 9, 2025, 7:55:54 AM (4 days ago) Oct 9
to basilisk-fr
Hi,

Take your last snapshot-%d/dump-%d file and rename it "restart".

As you can see at line 169 of tangaroa.c, the restore() function looks for a file called restart.

Alternatively, you can include:


which creates a "restart" file before stopping a simulation, after a given time, expressed as:

mpirun -np 4 ./tangaroa --maxruntime h:m:s

Best,
Edoardo

Jiyuan

unread,
Oct 10, 2025, 4:46:57 AM (3 days ago) Oct 10
to basilisk-fr
Dear Edoardo,

Thank you very much for your help. I was able to successfully solve the problem using the second method. I would like to clarify one more point: is it possible to run the simulation directly with MPI from the beginning, rather than first running it in serial to generate a restart file and then switching to parallel?

Best regards,
Jiyuan

Edoardo Cipriano

unread,
Oct 10, 2025, 6:11:46 AM (3 days ago) Oct 10
to basilisk-fr
Hi Jiyuan,

Yes, it is possible to run the simulation directly with MPI from the beginning, because the function dump() is able to write a snapshot file even when using MPI. Therefore, there is no need to generate the restart file in serial, you can use MPI from the beginning.

Best,
Edoardo
Reply all
Reply to author
Forward
0 new messages