Menu

about parallel static simulation

Technical
liang
2015-05-19
2015-07-28
  • liang

    liang - 2015-05-19

    Dear All,
    The example in ParallelHCDipolar.py show that one can do computing in remote computer by writing a pbs script, however I want to do parallel computing in my local multicore workstation. After installation I obtain two executable file: Execute_MPSMain( serial computation) and Execute_MPSParallelMain(parallel version). It seems that only Execute_MPSMain is used. Is Execute_MPSParallelMain used for parallel computation in local workstation? But I donnot Know how to use it and How I can assign the core number in parallel computing? For example I want to use only 6 cores to do computing if I have 12 cores in my workstation.
    Best regards
    Jun-Jun Liang

     
  • Anonymous

    Anonymous - 2015-05-19

    Hi Jun-Jun,
    The Python script, ParallelHCDipolar.py, is used to generate a PBS script for a supercomputer platform. You can definitely run parallel simulation on your workstation. In order to do this, you need an MPI library (OpenMPI, IntelMPI or Portland Group MPI). Try the following command mpiexec -n 6 ./Execute_MPSParrallelMain TMP/filestub in a terminal to run simulation with Execute_MPSParrallelMain.
    Thanks.

    Wei

     

    Last edit: Anonymous 2015-05-19
  • liang

    liang - 2015-07-24

    Dear Wei,
    Can Execute_MPSParrallelMain be added in tools.py by substituting Execute_MPSMain? then we can use parallel OSMPS easily. I have try it but donot not suceed.
    Thanks
    Jun-Jun Liang

     
  • Anonymous

    Anonymous - 2015-07-24

    Hi Jun-Jun,
    You cannot substitute Execute_MPSMain by Execute_MPSParrallelMain to run a parallel simulation. Thanks.

    Wei

     
  • Daniel Jaschke

    Daniel Jaschke - 2015-07-24

    Hi Jun-Jun,

    I might know a work around, although it is maybe not the answer you were looking for. The current implementation for 'Execute_MPSParallelMain' is oriented for cluster, so when you submit some script to your cluster. I guess you want to run it with MPI on your local machine.

    Try to use the option 'customAppl' in your main python file. For a different named serial main it looks like (I tested this):
    mps.runMPS(MainFiles, RunDir='./', customAppl='myMain')

    For a MPI you may need something like this (without guarantee for 8 cores):
    mps.runMPS(MainFiles, RunDir='./', customAppl='srun -n 8 ./Execute_MPSParallelMain')

    Please tell me if that works or not.

    Best regards,

    Daniel

     
  • liang

    liang - 2015-07-25

    Hi Daniel,
    I have tested it in my main python file. for a MPI file: mps.runMPS(MainFiles, RunDir='', customAppl='mpiexec -n 8 ./Execute_MPSParallelMain'), it give the following message:

    "mpiexec -n 8 Execute_MPSParallelMain" TMP/Bose_Hubbard_staticst_0.0t_1_0.0N_4Main.nml
    /bin/sh: mpiexec -n 8 Execute_MPSParallelMain: command not found
    Traceback (most recent call last):
    File "pair_superfluid.py", line 74, in <module>
    mps.runMPS(MainFiles,RunDir='',customAppl='mpiexec -n 8 Execute_MPSParallelMain')
    File "/Library/Python/2.7/site-packages/MPSPyLib/tools.py", line 143, in runMPS
    raise Exception("Fatal error with return code "+str(ret_val)+"!")
    Exception: Fatal error with return code 127!

    but mpiexec -n 8 Execute_MPSParallelMain do works in my computor:

    mpiexec -n 8 Execute_MPSParallelMain
    forrtl: No such file or directory
    forrtl: severe (29): file not found, unit 16, file

    the error is that python cannot find "mpiexec", Maybe we should change function execute(command) in tools.py.

    Is srun a mpi file like mpiexec? it doesnot exit in my computoer, and what's myMain in mps.runMPS(MainFiles, RunDir='./', customAppl='myMain').

    Best Regards.
    Jun-Jun Liang

     
    • Anonymous

      Anonymous - 2015-07-26

      Hi Jun-Jun,
      Try the following steps.
      1) Use WriteParallelFiles method in your simulation. This will create files for Fortran to read and a PBS/Slurm script. That PBS/Slurm script is not useful for you. You just need those files for Fortran.
      2) Add a line: mps.subprocess.call(["mpiexec -n 8 Execute_MPSParallelMain outputdir/jobID"]) after WriteParallels method. You don't need to import subprocess package in your simulation script, because mps will load it up for you.
      This is the easiest way with minimum modifications I can think of.
      Hopefully, this would work. If it does not work, please let me know.
      Thanks.

      Wei

       
  • Anonymous

    Anonymous - 2015-07-26

    Hi Jun-Jun,
    This is the follow up of my last reply, In step 2, you need to pass a list of string to subprocess call, if you don't want to specify shell=True. What I mean is the following:
    mps.subprocess.call(["mpiexec", "-n", "8", "Execute_MPSParallelMain", "outputdir/jobID"])
    If shell=True, it should be
    mps.subprocess.call(["mpiexec -n 8 Execute_MPSParallelMain outputdir/jobID"],shell=True)
    You can use either one. It is up to you.
    In last message, I assumed that you used parameter template, not parameter dictionary including parameter you want to loop over in serial code. For this point, please take a look at ParallelHCDipolar.py.
    Thank you.

    Best
    Wei

     
  • liang

    liang - 2015-07-28

    Hi, Wei,
    I test your advice in Example file "ParallelHCDipolar.py", in which I do a little change. It works.
    In ParallelHCDipolar.py the following is added:
    mps.subprocess.call(["mpiexec -n 8 Execute_MPSParallelMain TMP/HCDipolar"],shell=True)

    behind the original part:
    staticsParameters=mps.WriteMPSParallelFiles(parameters_template,
    Operators,H,comp_info,iterparams,iters,PostProcess=PostProcess)

    and nothing else need to be changed.
    ==========
    It seems that WriteParallelFiles cannot create files for Fortran to read.
    Best
    Jun-Jun Liang

     

    Last edit: liang 2015-07-28

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.