// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include "CUDAWrapper.h" // Build-independent: the CUDA build gets get_gpu_names() from CUDAWrapper.cu, the CPU-only build from // the stub below, and this collapses whichever list came back. Four identical cards read better as // "4x " than as the same name four times, and a mixed machine keeps one group per model. std::string get_gpu_description() { const auto names = get_gpu_names(); std::string out; for (size_t i = 0; i < names.size();) { size_t n = 1; while (i + n < names.size() && names[i + n] == names[i]) n++; if (!out.empty()) out += ", "; if (n > 1) out += std::to_string(n) + "x "; out += names[i]; i += n; } return out; } #ifndef JFJOCH_USE_CUDA int32_t get_gpu_count() { return 0; } std::vector get_gpu_names() { return {}; } void set_gpu(int32_t dev_id) {} void pin_gpu() {} #endif