9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-09 06:53:38 +01:00

GPU acceleration selection in configure

This commit is contained in:
Anthony Scemama 2024-06-26 13:44:45 +02:00
parent 7e45c517d9
commit a2f4bc218d

24
configure vendored
View File

@ -40,6 +40,7 @@ Usage:
$(basename $0) -c <file> $(basename $0) -c <file>
$(basename $0) -h $(basename $0) -h
$(basename $0) -i <package> $(basename $0) -i <package>
$(basename $0) -g [nvidia|none]
Options: Options:
-c <file> Define a COMPILATION configuration file, -c <file> Define a COMPILATION configuration file,
@ -48,6 +49,7 @@ Options:
-i <package> INSTALL <package>. Use at your OWN RISK: -i <package> INSTALL <package>. Use at your OWN RISK:
no support will be provided for the installation of no support will be provided for the installation of
dependencies. dependencies.
-g [nvidia|none] Choose GPU acceleration (experimental)
Example: Example:
./$(basename $0) -c config/gfortran.cfg ./$(basename $0) -c config/gfortran.cfg
@ -83,7 +85,7 @@ function execute () {
PACKAGES="" PACKAGES=""
while getopts "d:c:i:h" c ; do while getopts "d:c:i:g:h" c ; do
case "$c" in case "$c" in
c) c)
case "$OPTARG" in case "$OPTARG" in
@ -100,6 +102,9 @@ while getopts "d:c:i:h" c ; do
"") help ; break;; "") help ; break;;
*) PACKAGES="${PACKAGE} $OPTARG" *) PACKAGES="${PACKAGE} $OPTARG"
esac;; esac;;
g)
GPU=$OPTARG;
break;;
h) h)
help help
exit 0;; exit 0;;
@ -109,6 +114,23 @@ while getopts "d:c:i:h" c ; do
esac esac
done done
# Handle GPU acceleration
rm -f ${QP_ROOT}/src/gpu
case "$GPU" in
amd) # Nvidia
echo "Activating AMD GPU acceleration"
ln -s ${QP_ROOT}/src/gpu_amd ${QP_ROOT}/src/gpu
;;
nvidia) # Nvidia
echo "Activating Nvidia GPU acceleration"
ln -s ${QP_ROOT}/src/gpu_nvidia ${QP_ROOT}/src/gpu
;;
*) # No Acceleration
echo "Disabling GPU acceleration"
ln -s ${QP_ROOT}/src/gpu_x86 ${QP_ROOT}/src/gpu
;;
esac
# Trim leading and trailing spaces # Trim leading and trailing spaces
PACKAGES=$(echo $PACKAGES | xargs) PACKAGES=$(echo $PACKAGES | xargs)