Created
September 30, 2021 09:49
-
-
Save ValentinColin/964f2801fe137b4805ec3e84e00e4484 to your computer and use it in GitHub Desktop.
A short script to detect the features of the current device (OS, CPU features, CPU flags)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OS=$(uname -s) | |
#CPU flag detection | |
echo "****Getting CPU flag capabilities and number of cores" | |
if [ "$OS" = "Linux" ]; then | |
cat /proc/cpuinfo | egrep "(flags|model name|vendor)" | sort | uniq -c | |
elif [ "$OS" = "Darwin" ]; then | |
sysctl -a | grep machdep.cpu.features | |
fi | |
#Compiler capabilities. -march=native is required! | |
echo "****Getting GCC capabilities (SSE|AVX)" | |
gcc -march=native -dM -E - < /dev/null | egrep "SSE|AVX" | sort | |
#OS kernel version | |
echo "****Getting OS Kernel Version" | |
uname -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment