diff --git a/dev/check-gpu/Makefile b/dev/check-gpu/Makefile new file mode 100644 index 000000000..2279ea298 --- /dev/null +++ b/dev/check-gpu/Makefile @@ -0,0 +1,22 @@ +CC := clang +CXX := clang++ +RM := rm -rf + +CFLAGS := -g -Wall -Wno-deprecated-declarations -fPIC -std=c++17 -fsycl + +OUTPUT = check-gpu + +OBJS := check-gpu.o + +all: $(OUTPUT) + +clean: + $(RM) $(OBJS) $(OUTPUT) + +$(OUTPUT): $(OBJS) + $(CXX) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(LIBS) + +%.o: %.cpp + $(CXX) $(CFLAGS) -c -o $@ $< + +.PHONY: all clean diff --git a/dev/check-gpu/build.sh b/dev/check-gpu/build.sh new file mode 100755 index 000000000..d9eae582f --- /dev/null +++ b/dev/check-gpu/build.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +make diff --git a/dev/check-gpu/check-gpu b/dev/check-gpu/check-gpu new file mode 100755 index 000000000..617c93b63 Binary files /dev/null and b/dev/check-gpu/check-gpu differ diff --git a/dev/check-gpu/check-gpu.cpp b/dev/check-gpu/check-gpu.cpp new file mode 100644 index 000000000..e10996276 --- /dev/null +++ b/dev/check-gpu/check-gpu.cpp @@ -0,0 +1,29 @@ +#include + +int check_gpu() { + bool gpu_found = false; + + auto platforms = sycl::platform::get_platforms(); + for (auto &platform : platforms) { + auto devices = platform.get_devices(sycl::info::device_type::gpu); + if (!devices.empty()) { + gpu_found = true; + std::cout << "Platform: " + << platform.get_info() + << std::endl; + for (auto &device : devices) { + std::cout << "-- GPU device: " + << device.get_info() << std::endl; + } + } + } + + if (!gpu_found) + std::cout << "No GPU found!" << std::endl; + + return gpu_found ? 0 : -1; +} + +int main (int argc, char * argv[]) { + return check_gpu(); +} \ No newline at end of file