[v0.02] Add warning message. Hide the waiting message when CUDA initialization is done. Fix compiler warnings

This commit is contained in:
Dr-Noob
2021-08-15 21:56:51 +02:00
parent 2687fa5016
commit 8386052b10
4 changed files with 23 additions and 12 deletions

View File

@@ -49,6 +49,13 @@ int main(int argc, char* argv[]) {
return EXIT_SUCCESS;
}
set_log_level(true);
printWarn("gpufetch is in beta. The provided information may be incomplete or wrong.\n\
If you want to help to improve gpufetch, please compare the output of the program\n\
with a reliable source which you know is right (e.g, techpowerup.com) and report\n\
any inconsistencies to https://github.com/Dr-Noob/gpufetch/issues");
struct gpu_info* gpu = get_gpu_info();
if(gpu == NULL)
return EXIT_FAILURE;

View File

@@ -6,7 +6,7 @@
#include "uarch.hpp"
#include "../common/global.hpp"
struct cache* get_cache_info(struct gpu_info* gpu, cudaDeviceProp prop) {
struct cache* get_cache_info(cudaDeviceProp prop) {
struct cache* cach = (struct cache*) emalloc(sizeof(struct cache));
cach->L2 = (struct cach*) emalloc(sizeof(struct cach));
@@ -17,7 +17,7 @@ struct cache* get_cache_info(struct gpu_info* gpu, cudaDeviceProp prop) {
return cach;
}
struct topology* get_topology_info(struct gpu_info* gpu, cudaDeviceProp prop) {
struct topology* get_topology_info(cudaDeviceProp prop) {
struct topology* topo = (struct topology*) emalloc(sizeof(struct topology));
topo->streaming_mp = prop.multiProcessorCount;
@@ -63,11 +63,13 @@ struct gpu_info* get_gpu_info() {
struct gpu_info* gpu = (struct gpu_info*) emalloc(sizeof(struct gpu_info));
gpu->pci = NULL;
printf("Waiting for CUDA driver to start...\n");
printf("Waiting for CUDA driver to start...");
fflush(stdout);
int dev = 0;
cudaSetDevice(dev);
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);
printf("\r");
gpu->freq = deviceProp.clockRate * 1e-3f;
gpu->vendor = GPU_VENDOR_NVIDIA;
@@ -80,9 +82,9 @@ struct gpu_info* get_gpu_info() {
}
gpu->arch = get_uarch_from_cuda(gpu);
gpu->cach = get_cache_info(gpu, deviceProp);
gpu->cach = get_cache_info(deviceProp);
gpu->mem = get_memory_info(gpu, deviceProp);
gpu->topo = get_topology_info(gpu, deviceProp);
gpu->topo = get_topology_info(deviceProp);
gpu->peak_performance = get_peak_performance(gpu);
return gpu;

View File

@@ -355,5 +355,7 @@ char* get_str_chip(struct uarch* arch) {
}
void free_uarch_struct(struct uarch* arch) {
free(arch->uarch_str);
free(arch->chip_str);
free(arch);
}