#!/bin/sh

echo "Copy library files to MIC cards..."
NCard=4

if [ $# -eq 0 ] ; then
	echo "Usage: $0 Number_of_MIC_cards"
elif [ $# -eq 1 ] ; then
	NCard=$1
else
	echo "Usage: $0 Number_of_MIC_cards"
	exit 0
fi

for (( i = 0; i < $NCard; i++ ))
do
	MIC_PATH="root@mic$i:/lib64"
	/usr/bin/scp -i /mnt/scratch/id_rsa $MKLROOT/lib/mic/libmkl_intel_thread.so  $MIC_PATH
	/usr/bin/scp -i /mnt/scratch/id_rsa $MKLROOT/lib/mic/libmkl_intel_lp64.so    $MIC_PATH
	/usr/bin/scp -i /mnt/scratch/id_rsa $MKLROOT/lib/mic/libmkl_core.so          $MIC_PATH
	/usr/bin/scp -i /mnt/scratch/id_rsa $MKLROOT/../compiler/lib/mic/libiomp5.so $MIC_PATH
done
