Finding exact command that was executed

I have a simple code (given below) for the Espresso plugin based on the tutorial. It’s not really working. It’s possible that the command I use on the terminal is slightly different. I tried setting up code with different settings from prepend-text etc.

The command I usually run is on the lines of:

mpirun -np 2 --mca btl self,vader pw.x < pwscf.in > pwscf.out

So:

  • Is there a way I can find the exact command that aiida executed so that I can compare?
  • Is there a way to update an existing code without creating a new one?
code_pk = 323
code = aiida.orm.load_code(code_pk)
structure = aiida.orm.load_node(105)
pseudo_family = load_group('SSSP/1.3/PBE/efficiency')
pseudos = pseudo_family.get_pseudos(structure=structure)
parameters = {
'CONTROL': {'calculation': 'scf', },
'SYSTEM': {'ecutwfc': 30.,  # wave function cutoff in Ry
'ecutrho': 240.,  # density cutoff in Ry
  },
}
KpointsData = DataFactory('core.array.kpoints')
kpoints = KpointsData()
kpoints.set_kpoints_mesh([4,4,4])
builder = code.get_builder()
builder.structure = structure
builder.pseudos = pseudos
builder.parameters = Dict(parameters)
builder.kpoints = kpoints
builder.metadata.options.resources = {'num_machines': 1}
from aiida.engine import submit
calcjob_node = submit(builder)

The process report is given below:

(aiidapy313) [misbah@hpc _prelim]$ verdi process report 356*** 356: None*** (empty scheduler output file)*** Scheduler errors:
As of version 3.0.0, the “sm” BTL is no longer available in Open MPI.

Efficient, high-speed same-node shared memory communication support inOpen MPI is available in the “vader” BTL.  To use the vader BTL, youcan re-run your job with:

mpirun --mca btl vader,self,... your_mpi_application
A requested component was not found, or was unable to be opened.  Thismeans that this component is either not installed or is unable to beused on your system (e.g., sometimes this means that shared librariesthat the component requires are unable to be found/loaded).  Note thatOpen MPI stopped checking at the first component that it did not find.
Host:      hpc.giki.edu.pkFramework: btlComponent: sm
It looks like MPI_INIT failed for some reason; your parallel process islikely to abort.  There are many reasons that a parallel process canfail during MPI_INIT; some of which are due to configuration or environmentproblems.  This failure appears to be an internal failure; here’s someadditional information (which may only be relevant to an Open MPIdeveloper):
mca_bml_base_open() failed → Returned “Not found” (-13) instead of “Success” (0)
[hpc:44175] *** An error occurred in MPI_Init[hpc:44175] *** reported by process [465764353,0][hpc:44175] *** on a NULL communicator[hpc:44175] *** Unknown error[hpc:44175] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,[hpc:44175] ***    and potentially your MPI job)_aiidasubmit.sh: line 8: --mca: command not found
*** 5 LOG MESSAGES:
±> WARNING at 2025-09-22 06:53:03.494035+00:00| There was nonempty stderr in the whoami command: open terminal failed: not a terminal
±> WARNING at 2025-09-22 06:53:07.442177+00:00| key ‘symmetries’ is not present in raw output dictionary
±> ERROR at 2025-09-22 06:53:07.521282+00:00| ERROR_OUTPUT_STDOUT_INCOMPLETE
±> ERROR at 2025-09-22 06:53:07.527939+00:00| Both the stdout and XML output files could not be read or parsed.
±> WARNING at 2025-09-22 06:53:07.530391+00:00| output parser returned exit code<305>: Both the stdout and XML output files could not be read or parsed.

Thank you for your help.

Hi @Walser52

To inspect the submission file that was used, you can run verdi calcjob inputcat <your-pk> _aiidasubmit.sh. This will print/cat the content of the file in your terminal.

Moreover, since you are using a single PwCalculation, you can also set builder.metadata.dry_run = True before submitting. This will not submit any calculation but rather writes the input and submission file into submit_test (and creates a sub-directory based on the date and time for each dry-run) in your current working directory. In this way, you can also inspect how the submission will look like without actually submitting it to a remote machine.

Hope that helps.

2 Likes

Lightning-fast response @t-reents. ^^ Some additional comments from my end:

  1. Another hidden gem is verdi calcjob gotocomputer. This will have you ssh into the remote machine, where you can see all the files of the corresponding calculation job. I often try to figure out what I need in the _aiidasubmit.sh file to get the calculation to run for that machine, then adapt my metadata.options accordingly.

  2. Regarding updating a code, AiiDA doesn’t let you at the moment. It’s been a pet peeve of mine for some time. The reason is of course that in case you can update a code, you would change the history or provenance of any calculations that used that code. Having a “copy-on-edit” feature has also been proposed in this context, but we never settled on a solution that got implemented.

Note that the message in the report is not generated by AiiDA, it will simply pipe the stderr into _scheduler-stderr.txt and report that. So the actual message is from the scheduler on your remote machine.

EDIT: Let me also link a road map item on this topic:

@geiger_j this is something I might work on in the next coding days. :slight_smile:

Thanks a lot. I now understand that I should have used the option mpirun_extra_params to modify my mpirun. The option I actually used was append-text and that generated the following output:

#!/bin/bashexec > _scheduler-stdout.txt
exec 2> _scheduler-stderr.txt
‘mpirun’ ‘-np’ ‘1’ ‘/usr/local/bin/pw.x’ ‘-in’ ‘aiida.in’  > ‘aiida.out’

–mca btl vader,self

Unfortunately I’ve tried this on the terminal and it says no such option. How do I pass the –mca btl vader,self to my mpirun?

verdi code create core.code.installed --label pw --computer localhost --filepath-executable /usr/local/bin/pw.x --default-calc-job-plugin quantumespresso.pw --non-interactive --mpirun_extra_params “–mca btl vader,self”

Edit:
I have been able to setup the right command from the builder by using:

builder.metadata.options.mpirun_extra_params = ['--mca', 'btl','vader,self']

Still not sure how to setup the code from the terminal so that it does it automatically.

Happy to hear that it helped.

builder.metadata.options.mpirun_extra_params = [‘–mca’, ‘btl’,‘vader,self’]

This is indeed the right way to do it.

As you also pointed out, you can’t directly specify this as a separate option in the cli when creating a Code. The only way I see to do it permanently is to change/setup the mpirun-command of a Computer. However, this might not be the best approach, since you might have multiple Codes associated to that Computer that don’t require this option.
Hence, the best way is indeed to just set the mpirun_extra_params in your submission scripts.

1 Like