D3DEnergetic / FIDASIM

A Neutral Beam and Fast-ion Diagnostic Modeling Suite
http://d3denergetic.github.io/FIDASIM/
Other
29 stars 19 forks source link

MPI OpenMP iris install #240

Open shaunhaskey opened 3 years ago

shaunhaskey commented 3 years ago

Is OpenMP supposed to be the more 'default'/most reliable multiprocessing option for FIDASIM at the moment? I noticed the official install of fidasim/v2.0 on iris seemed to be running slowly, turns out it was built for MPI and I was running it like it was built for OpenMP: ./fidasim def_inputs nprocessors (because I thought that was the more standard option):

module load fidasim/v2.0
cd $FIDASIM_dir
[haskeysr@irisc v2.0]$ ./fidasim 
   ____ ____ ___   ___    ____ ____ __  ___
  / __//  _// _ \ / _ |  / __//  _//  |/  /
 / _/ _/ / / // // __ | _\ \ _/ / / /|_/ / 
/_/  /___//____//_/ |_|/___//___//_/  /_/  

Version: v2.0.0

FIDASIM is released as open source code under the MIT Licence.
For more information visit http://d3denergetic.github.io/FIDASIM/

usage: mpirun -np [num_processes] ./fidasim namelist_file

fidasim/dev however is built for OpenMP.

Which 'version' is preferred, and is it worth building both and having fidasim_mpi and fidasim_omp executables in the 'official' install locations with a symlink for fidasim to the more standard option?

lstagner commented 3 years ago

For the development version OpenMP is recommended because of the mixed species changes made the MPI version slower. I still haven't figured out a way to make merging neutral particle reservoirs more efficient using MPI. The v2.0 release should still use MPI.

The submit_fidasim script automatically determines whether the executable is OpenMP or MPI and submits the job accordingly. This is done by looking for MPI/OpenMP libraries inside the executable. (see below)

check_output = lambda args: subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0]

def is_mpi_executable(executable):
    ldd_out = check_output(['ldd',executable])

    libraries = {}
    for line in ldd_out.splitlines():
        match = re.match(r'\t(.*) => (.*) \(0x', line.decode('utf-8'))
        if match:
            libraries[match.group(1)] = match.group(2)

    return any('libmpi' in s for s in libraries.keys())
shaunhaskey commented 3 years ago

@lstagner Hmmm fun way of figuring out if it is MPI or OpenMP :). I am running it from OMFIT land, so I'm generating my own job scripts and not using the submit_fidasim. For now will just hard code what to do for each version - maybe think about doing what you are in that method at some point. You don't like the idea of having both an omp and mpi executable in the public installs?