• Uncategorized

About linux : MPI-error-in-shell-script-when-trying-to-run-locally

Question Detail

I am trying to run a shell script for a job locally on a workstation. I am getting an MPI error 

     *** Launching local simulation with 1 launch. ***
    No protocol specified
    [1,0]<stderr>: ERROR: Could not read environment variables "LES_CURRENT_LAUNCH" and "LES_TOTAL_LAUNCHES"
    [1,1]<stderr>: ERROR: Could not read environment variables "LES_CURRENT_LAUNCH" and "LES_TOTAL_LAUNCHES"
    
     MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with
     errorcode 21.

The shell script i am trying to run is attached below. The LES_TOTAL_LAUNCHES is defined in the script and I am not sure why it cant read the variable. Also at “[[ “$LES_TOTAL_LAUNCHES” -ne 1 ]] && es=”es” || es=”” it shows as unbounded variables…………………………………………………………………………………………………………………………………………………………

    #!/bin/bash
set -e -u -o pipefail

# change number of launches here, if desired
export LES_TOTAL_LAUNCHES=1

# print usage message, following docopt.org format
if [[ $# -gt 3 || $# -lt 1 || ( $# -ge 1 && ("$1" = "-h" || "$1" = "--help")) ]]; then
    echo "  Usage: $0 [--previous=<previous_path>] [--series] <simulation_name>"
    exit 1
fi

# get absolute path to the base directory
# (parent directory of the one containing this script)
base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd -P )"

# detect machine & set variables that depend on it
# NOTE: the ${var-} is needed in case the variable is not defined, due to "set -u"
if [[ "${CC_CLUSTER-}" = "cedar" ]]; then
    machine="cedar"
    simulations="${SCRATCH}/simulations"
    batch_script="${base_dir}/run/job_cedar.sh"
elif [[ -d "/moto" ]]; then
    machine="terremoto"
    simulations="/moto/trl/users/$(whoami)/simulations"
    batch_script="${base_dir}/run/job_terremoto.sh"
elif [[ "$USER" = "ec2-user" ]]; then
    machine="parlange"
    simulations="/home/ec2-user/simulations"
    batch_script="${base_dir}/run/run_parlange.sh"
else
    machine="local"
    simulation_path="${base_dir}"
fi

# launch local simulation
if [[ "$machine" = "local" ]]; then

    # remove output directory if necessary
    if [[ -e "$base_dir/output" ]]; then
        read -p "Local output directory will be overwritten. Proceed? [y/N] " -n 1 -r
        echo
        if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
            echo "Aborted."
            exit 1
        else
            rm -rf "$base_dir/output"
        fi
    fi

    # set variables & launch
    export OMP_NUM_THREADS=1
    [[ "$LES_TOTAL_LAUNCHES" -ne 1 ]] && es="es" || es=""
    echo " *** Launching local simulation with $LES_TOTAL_LAUNCHES launch$es. *** "
    [[ "$LES_TOTAL_LAUNCHES" -ne 1 ]] && echo "ERROR: multiple local launches not yet supported!" && exit 1
    cd "$base_dir"
    mpirun -np 2 --tag-output build/bin/les-mpi
    exit 0
fi



# confirm before actually launching
if [[ "$launch_series" == true ]]; then
    echo "Launching ${#series_configs[@]} simulations for machine '$machine'."
else
    echo "Launching a simulation for machine '$machine'."
fi
echo "Path: ${simulation_path}"
echo "Number of (re-)launches per simulation: ${LES_TOTAL_LAUNCHES}"
read -p "Ready to launch. Proceed? [y/N] " -n 1 -r
echo
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
    echo "Aborted."
    exit 1
fi

Any help will be appreciated……………………………………………………………………………………………………………………………………………………………………….

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.