[v0.20] Print help message when no GPU is detected to help people understand whats going on
This commit is contained in:
@@ -106,14 +106,14 @@ endif()
|
|||||||
|
|
||||||
message(STATUS "----------------------")
|
message(STATUS "----------------------")
|
||||||
message(STATUS "gpufetch build report:")
|
message(STATUS "gpufetch build report:")
|
||||||
if(ENABLE_INTEL_BACKEND)
|
|
||||||
message(STATUS "Intel backend: ${BoldGreen}ON${ColorReset}")
|
|
||||||
else()
|
|
||||||
message(STATUS "Intel backend: ${BoldRed}OFF${ColorReset}")
|
|
||||||
endif()
|
|
||||||
if(ENABLE_CUDA_BACKEND)
|
if(ENABLE_CUDA_BACKEND)
|
||||||
message(STATUS "CUDA backend: ${BoldGreen}ON${ColorReset}")
|
message(STATUS "CUDA backend: ${BoldGreen}ON${ColorReset}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "CUDA backend: ${BoldRed}OFF${ColorReset}")
|
message(STATUS "CUDA backend: ${BoldRed}OFF${ColorReset}")
|
||||||
endif()
|
endif()
|
||||||
|
if(ENABLE_INTEL_BACKEND)
|
||||||
|
message(STATUS "Intel backend: ${BoldGreen}ON${ColorReset}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Intel backend: ${BoldRed}OFF${ColorReset}")
|
||||||
|
endif()
|
||||||
message(STATUS "----------------------")
|
message(STATUS "----------------------")
|
||||||
|
|||||||
@@ -1,32 +1,7 @@
|
|||||||
#ifndef __ASCII__
|
#ifndef __ASCII__
|
||||||
#define __ASCII__
|
#define __ASCII__
|
||||||
|
|
||||||
#define C_NONE ""
|
#include "colors.hpp"
|
||||||
#define C_FG_BLACK "\x1b[30;1m"
|
|
||||||
#define C_FG_RED "\x1b[31;1m"
|
|
||||||
#define C_FG_GREEN "\x1b[32;1m"
|
|
||||||
#define C_FG_YELLOW "\x1b[33;1m"
|
|
||||||
#define C_FG_BLUE "\x1b[34;1m"
|
|
||||||
#define C_FG_MAGENTA "\x1b[35;1m"
|
|
||||||
#define C_FG_CYAN "\x1b[36;1m"
|
|
||||||
#define C_FG_WHITE "\x1b[37;1m"
|
|
||||||
#define C_BG_BLACK "\x1b[40;1m"
|
|
||||||
#define C_BG_RED "\x1b[41;1m"
|
|
||||||
#define C_BG_GREEN "\x1b[42;1m"
|
|
||||||
#define C_BG_YELLOW "\x1b[43;1m"
|
|
||||||
#define C_BG_BLUE "\x1b[44;1m"
|
|
||||||
#define C_BG_MAGENTA "\x1b[45;1m"
|
|
||||||
#define C_BG_CYAN "\x1b[46;1m"
|
|
||||||
#define C_BG_WHITE "\x1b[47;1m"
|
|
||||||
#define C_FG_B_BLACK "\x1b[90;1m"
|
|
||||||
#define C_FG_B_RED "\x1b[91;1m"
|
|
||||||
#define C_FG_B_GREEN "\x1b[92;1m"
|
|
||||||
#define C_FG_B_YELLOW "\x1b[93;1m"
|
|
||||||
#define C_FG_B_BLUE "\x1b[94;1m"
|
|
||||||
#define C_FG_B_MAGENTA "\x1b[95;1m"
|
|
||||||
#define C_FG_B_CYAN "\x1b[96;1m"
|
|
||||||
#define C_FG_B_WHITE "\x1b[97;1m"
|
|
||||||
#define C_RESET "\x1b[m"
|
|
||||||
|
|
||||||
struct ascii_logo {
|
struct ascii_logo {
|
||||||
const char* art;
|
const char* art;
|
||||||
|
|||||||
31
src/common/colors.hpp
Normal file
31
src/common/colors.hpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef __COLORS__
|
||||||
|
#define __COLORS__
|
||||||
|
|
||||||
|
#define C_NONE ""
|
||||||
|
#define C_FG_BLACK "\x1b[30;1m"
|
||||||
|
#define C_FG_RED "\x1b[31;1m"
|
||||||
|
#define C_FG_GREEN "\x1b[32;1m"
|
||||||
|
#define C_FG_YELLOW "\x1b[33;1m"
|
||||||
|
#define C_FG_BLUE "\x1b[34;1m"
|
||||||
|
#define C_FG_MAGENTA "\x1b[35;1m"
|
||||||
|
#define C_FG_CYAN "\x1b[36;1m"
|
||||||
|
#define C_FG_WHITE "\x1b[37;1m"
|
||||||
|
#define C_BG_BLACK "\x1b[40;1m"
|
||||||
|
#define C_BG_RED "\x1b[41;1m"
|
||||||
|
#define C_BG_GREEN "\x1b[42;1m"
|
||||||
|
#define C_BG_YELLOW "\x1b[43;1m"
|
||||||
|
#define C_BG_BLUE "\x1b[44;1m"
|
||||||
|
#define C_BG_MAGENTA "\x1b[45;1m"
|
||||||
|
#define C_BG_CYAN "\x1b[46;1m"
|
||||||
|
#define C_BG_WHITE "\x1b[47;1m"
|
||||||
|
#define C_FG_B_BLACK "\x1b[90;1m"
|
||||||
|
#define C_FG_B_RED "\x1b[91;1m"
|
||||||
|
#define C_FG_B_GREEN "\x1b[92;1m"
|
||||||
|
#define C_FG_B_YELLOW "\x1b[93;1m"
|
||||||
|
#define C_FG_B_BLUE "\x1b[94;1m"
|
||||||
|
#define C_FG_B_MAGENTA "\x1b[95;1m"
|
||||||
|
#define C_FG_B_CYAN "\x1b[96;1m"
|
||||||
|
#define C_FG_B_WHITE "\x1b[97;1m"
|
||||||
|
#define C_RESET "\x1b[m"
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -71,6 +71,15 @@ int main(int argc, char* argv[]) {
|
|||||||
return print_gpus_list(list);
|
return print_gpus_list(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(get_num_gpus_available(list) == 0) {
|
||||||
|
printErr("No GPU was detected, or the detected GPU is not supported by gpufetch");
|
||||||
|
printf("Please, make sure that the appropiate backend is enabled:\n");
|
||||||
|
print_enabled_backends();
|
||||||
|
printf("Visit https://github.com/Dr-Noob/gpufetch#2-backends for more information\n");
|
||||||
|
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
set_log_level(true);
|
set_log_level(true);
|
||||||
|
|
||||||
printf("[WARNING]: gpufetch is in beta. The provided information may be incomplete or wrong.\n\
|
printf("[WARNING]: gpufetch is in beta. The provided information may be incomplete or wrong.\n\
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include "colors.hpp"
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
#include "../cuda/cuda.hpp"
|
#include "../cuda/cuda.hpp"
|
||||||
#include "../intel/intel.hpp"
|
#include "../intel/intel.hpp"
|
||||||
@@ -56,6 +57,27 @@ bool print_gpus_list(struct gpu_list* list) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_enabled_backends() {
|
||||||
|
printf("- CUDA backend: ");
|
||||||
|
#ifdef BACKEND_CUDA
|
||||||
|
printf("%sON%s\n", C_FG_GREEN, C_RESET);
|
||||||
|
#else
|
||||||
|
printf("%sOFF%s\n", C_FG_RED, C_RESET);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf("- Intel backend: ");
|
||||||
|
#ifdef BACKEND_INTEL
|
||||||
|
printf("%sON%s\n", C_FG_GREEN, C_RESET);
|
||||||
|
#else
|
||||||
|
printf("%sOFF%s\n", C_FG_RED, C_RESET);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_num_gpus_available(struct gpu_list* list) {
|
||||||
|
return list->num_gpus;
|
||||||
|
}
|
||||||
|
|
||||||
struct gpu_info* get_gpu_info(struct gpu_list* list, int idx) {
|
struct gpu_info* get_gpu_info(struct gpu_list* list, int idx) {
|
||||||
return list->gpus[idx];
|
return list->gpus[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ struct gpu_list;
|
|||||||
|
|
||||||
struct gpu_list* get_gpu_list();
|
struct gpu_list* get_gpu_list();
|
||||||
bool print_gpus_list(struct gpu_list* list);
|
bool print_gpus_list(struct gpu_list* list);
|
||||||
|
int get_num_gpus_available(struct gpu_list* list);
|
||||||
|
void print_enabled_backends();
|
||||||
struct gpu_info* get_gpu_info(struct gpu_list* list, int idx);
|
struct gpu_info* get_gpu_info(struct gpu_list* list, int idx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user