Commit af1417c2 authored by Marc Vef's avatar Marc Vef
Browse files

Adding -c argument to pass specific config file to gkfs script

parent 600b09ea
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ usage: gkfs [-h/--help] [-r/--rootdir <path>] [-m/--mountdir <path>] [-a/--args
                                    Nodelist is extracted from Slurm via the SLURM_JOB_ID env variable.
            --cpuspertask <#cores>  Set the number of cores the daemons can use. Must use '--srun'.
            --numactl               Use numactl for the daemon. Modify gkfs.conf for further numactl configurations.
            -c, --config            Path to configuration file. By defaults looks for a 'gkfs.conf' in this directory.
            -v, --verbose           Increase verbosity
```

+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ usage: gkfs [-h/--help] [-r/--rootdir <path>] [-m/--mountdir <path>] [-a/--args
                                    Nodelist is extracted from Slurm via the SLURM_JOB_ID env variable.
            --cpuspertask <#cores>  Set the number of cores the daemons can use. Must use '--srun'.
            --numactl               Use numactl for the daemon. Modify gkfs.conf for further numactl configurations.
            -c, --config            Path to configuration file. By defaults looks for a 'gkfs.conf' in this directory.
            -v, --verbose           Increase verbosity
```

+28 −7
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ start_daemon() {
        echo "### mountdir: ${MOUNTDIR}"
        echo "### rootdir: ${ROOTDIR}"
        echo "### node_num: ${NODE_NUM}"
        echo "### args: ${ARGS}"
        echo "### additional daemon args: ${ARGS}"
        echo "### cpus_per_task: ${CPUS_PER_TASK}"
    fi
    if [[ ${VERBOSE} == true ]]; then
@@ -208,8 +208,8 @@ help_msg() {

    optional arguments:
            -h, --help              Shows this help message and exits
            -r, --rootdir <path>    Providing the rootdir path for GekkoFS daemons.
            -m, --mountdir <path>   Providing the mountdir path for GekkoFS daemons.
            -r, --rootdir <path>    The rootdir path for GekkoFS daemons.
            -m, --mountdir <path>   The mountdir path for GekkoFS daemons.
            -a, --args <daemon_arguments>
                                    Add various additional daemon arguments, e.g., \"-l ib0 -P ofi+psm2\".
            -f, --foreground        Starts the script in the foreground. Daemons are stopped by pressing 'q'.
@@ -218,17 +218,34 @@ help_msg() {
                                    Nodelist is extracted from Slurm via the SLURM_JOB_ID env variable.
            --cpuspertask <#cores>  Set the number of cores the daemons can use. Must use '--srun'.
            --numactl               Use numactl for the daemon. Modify gkfs.conf for further numactl configurations.
            -c, --config            Path to configuration file. By defaults looks for a 'gkfs.conf' in this directory.
            -v, --verbose           Increase verbosity
            "
}

CONFIGPATH=""
argv=("$@")
# get config path first from argument list
for i in "${argv[@]}"; do
    if [[ "${argv[i]}" == "-c" || "${argv[i]}" == "--config" ]]; then
        CONFIGPATH=$(readlink -mn "${argv[i+1]}")
        break
    fi
done
# global variables
export FI_PSM2_DISCONNECT=1
export PSM2_MULTI_EP=1
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"

# get default path if config wasn't given
if [[ -z ${CONFIGPATH} ]]; then
    CONFIGPATH="${SCRIPTDIR}/gkfs.conf"
fi
if [[ ! -f ${CONFIGPATH} ]]; then
    >&2 echo ">> No config file found at '${CONFIGPATH}'."
    exit 1
fi
# get variables from CONFIGPATH
source "$CONFIGPATH"

# more global variables which may be overwritten by user input
VERBOSE=false
NODE_NUM=1
@@ -240,7 +257,6 @@ ARGS=${DAEMON_ARGS}
USE_SRUN=${USE_SRUN}
RUN_FOREGROUND=false
USE_NUMACTL=${DAEMON_NUMACTL}

# parse input
POSITIONAL=()
while [[ $# -gt 0 ]]; do
@@ -284,6 +300,11 @@ while [[ $# -gt 0 ]]; do
        shift # past argument
        shift # past value
        ;;
    -c | --config)
            # skip. was handled above
            shift # past argument
            shift # past value
            ;;
    -h | --help)
        help_msg
        exit