Adds very basic support for AMD (experimental). The only install
requirement is ROCm. Unlike NVIDIA, we don't need the CUDA equivalent
(HIP) to make gpufetch work, which reduces the installation
requirements quite significantly.
Major changes:
* CMakeLists:
- Make CUDA not compiled by default (since we now may want to target
AMD only)
- Set build flags on gpufetch cmake target instead of doing
"set(CMAKE_CXX_FLAGS". This fixes a warning coming from ROCm.
- Assumes that the ROCm CMake files are installed (should be fixed
later)
* hsa folder: AMD support is implemented via HSA (Heterogeneous System
Architecture) calls. Therefore, HSA is added as a new backend to
gpufetch. We only print basic stuff for now, so we may need more
things in the future to give full support for AMD GPUs.
NOTE: This commit will probably break AUR packages since we used to
build CUDA by default, which is no longer the case. The AUR package
should be updated and use -DENABLE_CUDA_BACKEND or -DENABLE_HSA_BACKEND
as appropriate.
42 lines
1017 B
Bash
Executable File
42 lines
1017 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# gpufetch build script
|
|
set -e
|
|
|
|
rm -rf build/ gpufetch
|
|
mkdir build/
|
|
cd build/
|
|
|
|
if [ "$1" == "debug" ]
|
|
then
|
|
BUILD_TYPE="Debug"
|
|
else
|
|
BUILD_TYPE="Release"
|
|
fi
|
|
|
|
# In case you have CUDA installed but it is not detected,
|
|
# - set CMAKE_CUDA_COMPILER to your nvcc binary:
|
|
# - set CMAKE_CUDA_COMPILER_TOOLKIT_ROOT to the CUDA root dir
|
|
# for example:
|
|
# cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_CUDA_COMPILER_TOOLKIT_ROOT=/usr/local/cuda/ ..
|
|
|
|
# In case you want to explicitely disable a backend, you can:
|
|
# Disable CUDA backend:
|
|
# cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_CUDA_BACKEND=OFF ..
|
|
# Disable HSA backend:
|
|
# cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_HSA_BACKEND=OFF ..
|
|
# Disable Intel backend:
|
|
# cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_INTEL_BACKEND=OFF ..
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
|
|
|
|
os=$(uname)
|
|
if [ "$os" == 'Linux' ]; then
|
|
make -j$(nproc)
|
|
elif [ "$os" == 'FreeBSD' ]; then
|
|
gmake -j4
|
|
fi
|
|
|
|
cd -
|
|
ln -s build/gpufetch .
|