Does your Ubuntu guest's "dmesg" or /var/log/messages show any activity at the time the process is killed? If the virtual machine fills its 4 GBytes of RAM, the Linux kernel's out-of-memory (OOM) killer will step in and terminate a process in the guest -- often it kills the process which is using the most RAM, which would probably be your Fortran program.
If it's the OOM killer which is responsible, you'll either need to find a way to allocate additional RAM to the virtual machine (Can you nudge it up to 6 GBytes? Can you add additional physical RAM to your host system?), or rearrange your Fortran program to reduce its memory requirements.
Thank you dariusd
here it is what the "dmsg" command reports:
[ 1036.251805] [ 2786] 1000 2786 3464195 915345 3868 984519 0 SISLDG-swe
[ 1036.251806] Out of memory: Kill process 2786 (SISLDG-swe) score 924 or sacrifice child
[ 1036.251808] Killed process 2786 (SISLDG-swe) total-vm:13856780kB, anon-rss:3661332kB, file-rss:48kB
Do you think I can estimate the amount of RAM needed by my program (SISLDG-swe) before running it? Is there a quick and simple way to do this?
There's no straightforward way to estimate the program's memory usage without inspecting its input and algorithm. Clearly it needs to use more than 3.66 GBytes.
Try powering the VM off and then adjusting its memory allocation up from 4096 MB towards 6320 MB. You might also be able to configure swap space within the Ubuntu guest, which will use hard disk space as extra "memory"... but that will be very slow, particularly for a computationally intensive workload. Your best option is to try increasing the amount of RAM available to the virtual machine, adding more physical RAM to the host if necessary (and if possible).