#!/usr/bin/env bash
# Shellscript-hack to ensure mpi-distributed openacc processes
# get / initialize the right card (only)
#
# Kudos to Rémi Lacroix from the OpenACC_Hackathon slack 

if [ "x" == "x${CUDA_VISIBLE_DEVICES}" ];
then
    export CUDA_VISIBLE_DEVICES=${OMPI_COMM_WORLD_LOCAL_RANK}
fi

"$@"

