Python wrappers in parallel mode

Hello Lammps users,

I am using python wrappers to run the lammps script. I am running some lammps command as well numpy command In the same python script

#test.py

from lammps import lammps
import numpy as np
from ctypes import *
import sys
import shutil

lmp1=lammps()
lmp1.file(“in1.lj”)
lmp1.close()

M=np.zeros((N,N),dtype=np.float)

some analysis

lmp2=lammps()
lmp2.file(“in2.lj”)
lmp2.close()

My N is very large. So when i run through

mpirun -np 8 python test.py

lammps part is running in 8 processor that’s fine but M is also created 8 times. and my system goes run out of memory.

I wanted to run analysis part as serial mode.

How should i specify lammps section as parallel mode and analysis part as serial mode.

Thanks.

Regards

Ankit Agrawal (Senior Research Fellow)

The Institute of Mathematical Sciences

Chennai

Hello Lammps users,

I am using python wrappers to run the lammps script. I am running some
lammps command as well numpy command In the same python script

#test.py
from lammps import lammps
import numpy as np
from ctypes import *
import sys
import shutil

lmp1=lammps()
lmp1.file("in1.lj")
lmp1.close()

M=np.zeros((N,N),dtype=np.float)

# some analysis

lmp2=lammps()
lmp2.file("in2.lj")
lmp2.close()

My N is very large. So when i run through
mpirun -np 8 python test.py

lammps part is running in 8 processor that's fine but M is also created 8
times. and my system goes run out of memory.
I wanted to run analysis part as serial mode.

that is not really a LAMMPS problem, but a "parallel programming with
python" issue.
you have to use a python module that supports message passing with MPI
and then use those message passing primitives to skip the serial part
of the calculation for all but one MPI rank. if that doesn't tell you
anything, you should go and learn MPI programming with python first.

axel.