#!/bin/bash

EXE=$(basename $0)

MY_PATH=$(readlink -f "$0")
MY_DIR=$(dirname "${MY_PATH}")
OMPI_ROOT=$(readlink -f "${MY_DIR}"/..)
HPCX_ROOT=$(readlink -f "${OMPI_ROOT}"/..)

NVHPC_HPCX_INIT=${NVHPC_HPCX_INIT:-hpcx-mt-init.sh}
NVHPC_HPCX_USE_SERIAL=${NVHPC_HPCX_USE_SERIAL:-0}
[ ${NVHPC_HPCX_USE_SERIAL} -eq 1 ] && NVHPC_HPCX_INIT=hpcx-init.sh

. "${HPCX_ROOT}/${NVHPC_HPCX_INIT}"
hpcx_load
UCX_CUDA_IPC_ENABLE_MNNVL=${UCX_CUDA_IPC_ENABLE_MNNVL:-no}
export UCX_CUDA_IPC_ENABLE_MNNVL
$MY_DIR/.bin/$EXE "$@"
