# C++ - Starting paraller instances of an executable from a C++ code

Can I start parallel run of LAMMPS from inside a C++ code. Is it possible to compile my code and then do mpirun with my compiled code. I also have one system command inside the code, which starts parallel instances of LAMMPS with mpirun.

• This should be possible in principle. Do you have a deeper question? Jun 9 '15 at 20:55
• @BillBarth Yeah it should be possible but it is not working. My code looks like this: Main(){ .....MPI_BARRIER If(id of processor = 0 ) then do system (mpirun -np 16 -f {Nodelist} ./lammps)}}. This is happenning in main and I am submitting my job as mpirun -np 16 ./a.out, where a.out is exe Jun 10 '15 at 19:28
• You can't run mpirun from a job that is already running in parallel. If you run mpirun -np 16 ./a.out, then you already have 16 instances of main() running, so all you need to do is calling the LAMMPS executable directly from each of these instances of main(). Jun 11 '15 at 11:44