# Finding exact command that was executed

**URL:** <https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680>\
**Category:** New to AiiDA\
**Tags:** question, aiida\
**Created:** [September 22, 2025, 6:55am UTC](https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680 "2025-09-22T06:55:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Walser52](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/walser52/32/332_2.png) [@Walser52](https://aiida.discourse.group/u/Walser52)\
**Post date:** [September 22, 2025, 6:55am UTC](https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680/1 "2025-09-22T06:55:59Z")

</div>

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?

```python
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:

```bash
(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

```

```auto
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.

```

```auto
Host: hpc.giki.edu.pkFramework: btlComponent: sm

```

```auto
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):

```

```auto
mca_bml_base_open() failed → Returned “Not found” (-13) instead of “Success” (0)

```

```auto
[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

```

```auto
*** 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.

---

<div class="post-metadata">

**Author:** ![t-reents](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/t-reents/32/82_2.png) [@t-reents](https://aiida.discourse.group/u/t-reents)\
**Post date:** [September 22, 2025, 8:20am UTC](https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680/2 "2025-09-22T08:20:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mbercx](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/mbercx/32/345_2.png) [@mbercx](https://aiida.discourse.group/u/mbercx)\
**Post date:** [September 22, 2025, 8:32am UTC](https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680/3 "2025-09-22T08:32:09Z")

</div>

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`](https://aiida.readthedocs.io/projects/aiida-core/en/stable/topics/calculations/usage.html#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](https://github.com/aiidateam/aiida-core/issues/4980#issuecomment-1481257616) 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:

> <https://github.com/aiidateam/team-compass/issues/12>
>
> \## Motivation
> 
> When computers and codes were originally designed, a certain le…vel of rigidity on their properties was established in order to try to impose a stricter level of control over the preservation of the provenance. However, the frequent changes an updates that computer clusters perform on their systems forces users to be also updating the ways in which they access those resources. Part of this required versatility was taken into account by allowing some parameters of computer access to be set in the \`configuration\` of the computer, rather than in its attributes during setup. However, many users find that this is not enough and express frustration at the limitations that these entities still have.
> 
> Some examples include:
> 
> \- After updating software in clusters, some software change location and thus the respective code needs to be updated or changed to a new one. Creating a new code is the natural solution, but it tends to then over-complicate querying later.
> 
> \- One may want to set up a computer to be able to be used with different schedulers (specially considering the inclusion of meta-schedulers such as \[aiida-hyperqueue\](https://github.com/aiidateam/aiida-hyperqueue)), but by doing so the remote folders created by one are technically in a different computer and thus copying of files between those is not allowed.
> 
> \## Desired Outcome
> 
> Rethink how immutability works in the computer and code nodes, what restrictions can be relaxed, which ones we want to keep to ensure a cleaner provenance, and what other options can we offer users to facilitate dealing with these immutability problems in the cases that need to remain.
> 
> \## Impact
> 
> This will potentially improve usability for all users of AiiDA.
> 
> \## Complexity
> 
> Since this is not a bug or missing feature, but a direct consequence of how we enforce the "respect" for the provenance and this clashing or resulting inconvenience in practical usage, the biggest issue here is to rethink a more general principle of AiiDA. Since this is coming from unforeseen practical inconvenience, it is worth it to first try to do a thorough compilation of user frustrations and also some thinking into other potential problems.
> 
> \## Progress
> 
> The first task should be to do a comprehensive analysis of the situation and gather any remaining use case that may be relevant to consider.

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

---

<div class="post-metadata">

**Author:** ![Walser52](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/walser52/32/332_2.png) [@Walser52](https://aiida.discourse.group/u/Walser52)\
**Post date:** [September 22, 2025, 10:52am UTC](https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680/4 "2025-09-22T10:52:55Z")

</div>

> [@t-reents](#):
>
> `builder.metadata.dry_run = True`

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:

```auto
#!/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?

```bash
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.

---

<div class="post-metadata">

**Author:** ![t-reents](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/t-reents/32/82_2.png) [@t-reents](https://aiida.discourse.group/u/t-reents)\
**Post date:** [September 22, 2025, 11:41am UTC](https://aiida.discourse.group/t/finding-exact-command-that-was-executed/680/5 "2025-09-22T11:41:53Z")

</div>

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.
