#!/bin/sh

# Default
# Assuming several identical processors and not counting HT cores
CPUS_PER_NODE=$(( `cat /proc/cpuinfo | grep "cpu cores" | LC_ALL=C sort | uniq | awk '{ print $4 }'` * `cat /proc/cpuinfo | grep "physical id" | LC_ALL=C sort | uniq | wc -l` ))
which nvidia-smi >/dev/null 2>& 1
if [ $? -eq 0 ]; then
    CUDAS_PER_NODE=`nvidia-smi -L 2>/dev/null | wc -l`
else
    CUDAS_PER_NODE=0
fi

# Specializations
if [ `hostname` = "k100" ]; then
    CPUS_PER_NODE=12
    CUDAS_PER_NODE=3
fi
