Quick Start

This section gives an overview of how to install and use MISO.

Installation

MISO is available on GitHub (https://github.com/is-isee/MISO). To clone the repository, run the following command.

git clone https://github.com/is-isee/MISO.git

Usage

CPU version

MISO is compiled with CMake. As an example, let us run the 2D Orszag-Tang vortex problem.

cd demo/mhd2d_vortex
cmake -B build -DUSE_CUDA=OFF
make -C build

This produces the executable build/mhd2d_vortex.

The 2D Orszag-Tang vortex problem can be run as follows.

mpiexec -n 2 ./build/mhd2d_vortex

With MPI, appropriate environment variables and options may be required. For Open MPI, the shell script demo/mhd2d_vortex/app_run.sh sets the environment variables automatically and runs the command above.

./app_run.sh

The simulation results are saved in demo/mhd2d_vortex/data. If the run is stopped partway, it resumes from the saved data. To restart the run from the beginning, delete the demo/mhd2d_vortex/data/ directory. You can also delete the data as follows.

./app_clean.sh

The simulation parameters are controlled by editing demo/mhd2d_vortex/config.yaml. For example, the number of grid points can be changed as follows.

grid:
    i_size: 256
    j_size: 256

CUDA version

The CUDA version requires the NVIDIA HPC SDK. To compile the CUDA version, pass the CMake option -DUSE_CUDA=ON.

cd demo/mhd2d_vortex
cmake -B build -DUSE_CUDA=ON
make -C build

The executable build/mhd2d_vortex and how to run it are the same as for the CPU version. The required runtime options and environment variables may depend on your environment, so treat the following as an example.

mpiexec -n 2 --bind-to none --mca pml ob1 --mca btl tcp,self,vader --mca coll ^hcoll --mca osc ^ucx ./build/mhd2d_vortex

When running the GPU version with multiple processes, we recommend options such as --map-by ppr:N:node (N is the number of processes per node) and -x CUDA_VISIBLE_DEVICES=M,L,... (M, L, … are the CUDA device numbers available on each node). For example, to run 4 processes in total on 2 nodes with 2 processes per node and 1 CUDA device per process:

mpiexec -n 4 --map-by ppr:2:node --bind-to none -x CUDA_DEVICE_ORDER=PCI_BUS_ID -x CUDA_VISIBLE_DEVICES=0,1 --mca pml ob1 --mca btl tcp,self,vader --mca coll ^hcoll --mca osc ^ucx ./build/mhd2d_vortex

The configuration file is demo/mhd2d_vortex/config.yaml. For the 1D shock tube problems (demo/hd1d_shock_tube, demo/mhd1d_shock_tube), there is a configuration file for each of the x, y, and z directions:

  • demo/hd1d_shock_tube/config/config_x.yaml

  • demo/hd1d_shock_tube/config/config_y.yaml

  • demo/hd1d_shock_tube/config/config_z.yaml

To choose a file, pass it as a command-line argument at run time.

cd demo/hd1d_shock_tube
mpiexec -n 1 ./build/hd1d_shock_tube --config ./config/config_x.yaml

The x direction is used by default.

Python module pymiso

MISO provides a Python module for analysis. Install it from the root directory of the repository as follows.

# for normal users
pip install -e ".[viz]"

# minimum install
pip install -e .

# for developers
pip install -e ".[viz,dev]"

The simulation results can be read as follows.

import pymiso
import matplotlib.pyplot as plt

# relative path to the data directory
d = pymiso.Data("./demo/mhd2d_vortex/data")

n_step = 80
d.load(n_step)
plt.pcolormesh(d.x, d.y, d.ro)
plt.show()

Each demo problem includes a visualization script. For example, to visualize the results of the 2D Orszag-Tang vortex problem, run demo/mhd2d_vortex/plot_data.py.

cd demo/mhd2d_vortex
python plot_data.py

The resulting image files are saved in demo/mhd2d_vortex/figs.