[v0.02] Fix typos. Divide memory detection in two phases. Show real memory frequency, instead of the returned by CUDA
This commit is contained in:
@@ -59,7 +59,7 @@ void printBug(const char *fmt, ...) {
|
|||||||
vsnprintf(buffer,buffer_size, fmt, args);
|
vsnprintf(buffer,buffer_size, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
fprintf(stderr, RED "[ERROR]: " RESET "%s\n",buffer);
|
fprintf(stderr, RED "[ERROR]: " RESET "%s\n",buffer);
|
||||||
fprintf(stderr,"Please, create a new issue with this error message in https://github.com/Dr-Noob/gpufetch/issues\n");
|
fprintf(stderr,"Please, create a new issue with this error message on https://github.com/Dr-Noob/gpufetch/issues\n");
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ struct memory {
|
|||||||
MEMTYPE type;
|
MEMTYPE type;
|
||||||
int32_t bus_width;
|
int32_t bus_width;
|
||||||
int32_t freq;
|
int32_t freq;
|
||||||
|
int32_t clk_mul; // clock multiplier
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gpu_info {
|
struct gpu_info {
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ struct topology* get_topology_info(cudaDeviceProp prop) {
|
|||||||
return topo;
|
return topo;
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMTYPE guess_memory_type(struct memory* mem, struct gpu_info* gpu) {
|
int32_t guess_clock_multipilier(struct gpu_info* gpu, struct memory* mem) {
|
||||||
// Guess clock multiplier
|
// Guess clock multiplier
|
||||||
int32_t clk_mul = -1;
|
int32_t clk_mul = -1;
|
||||||
|
|
||||||
int32_t clk8 = abs((mem->freq/8) - gpu->freq);
|
int32_t clk8 = abs((mem->freq/8) - gpu->freq);
|
||||||
int32_t clk4 = abs((mem->freq/4) - gpu->freq);
|
int32_t clk4 = abs((mem->freq/4) - gpu->freq);
|
||||||
int32_t clk2 = abs((mem->freq/2) - gpu->freq);
|
int32_t clk2 = abs((mem->freq/2) - gpu->freq);
|
||||||
@@ -41,16 +42,20 @@ MEMTYPE guess_memory_type(struct memory* mem, struct gpu_info* gpu) {
|
|||||||
if(min > clk2) { clk_mul = 2; min = clk2; }
|
if(min > clk2) { clk_mul = 2; min = clk2; }
|
||||||
if(min > clk1) { clk_mul = 1; min = clk1; }
|
if(min > clk1) { clk_mul = 1; min = clk1; }
|
||||||
|
|
||||||
return guess_memtype_from_cmul_and_uarch(clk_mul, gpu->arch);
|
return clk_mul;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct memory* get_memory_info(struct gpu_info* gpu, cudaDeviceProp prop) {
|
struct memory* get_memory_info(struct gpu_info* gpu, cudaDeviceProp prop) {
|
||||||
struct memory* mem = (struct memory*) emalloc(sizeof(struct memory));
|
struct memory* mem = (struct memory*) emalloc(sizeof(struct memory));
|
||||||
|
|
||||||
mem->size_bytes = (unsigned long long) prop.totalGlobalMem;
|
mem->size_bytes = (unsigned long long) prop.totalGlobalMem;
|
||||||
mem->freq = prop.memoryClockRate * 1e-3f;
|
mem->freq = prop.memoryClockRate * 0.001f;
|
||||||
mem->bus_width = prop.memoryBusWidth;
|
mem->bus_width = prop.memoryBusWidth;
|
||||||
mem->type = guess_memory_type(mem, gpu);
|
mem->clk_mul = guess_clock_multipilier(gpu, mem);
|
||||||
|
mem->type = guess_memtype_from_cmul_and_uarch(mem->clk_mul, gpu->arch);
|
||||||
|
|
||||||
|
// Fix frequency returned from CUDA to show real frequency
|
||||||
|
mem->freq = mem->freq / mem->clk_mul;
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ struct uarch* get_uarch_from_cuda(struct gpu_info* gpu) {
|
|||||||
#define CHECK_MEMTYPE_START if (false) {}
|
#define CHECK_MEMTYPE_START if (false) {}
|
||||||
#define CHECK_MEMTYPE(arch, clkm, arch_, clkm_, memtype) \
|
#define CHECK_MEMTYPE(arch, clkm, arch_, clkm_, memtype) \
|
||||||
else if (arch->uarch == arch_ && (clkm_ == CM_ANY || clkm == clkm_)) return memtype;
|
else if (arch->uarch == arch_ && (clkm_ == CM_ANY || clkm == clkm_)) return memtype;
|
||||||
#define CHECK_MEMTYPE_END else { printBug("guess_memtype_from_cmul_and_uarch: Found invalid convination: clkm=%d, uarch=%d", clkm, arch->uarch); return MEMTYPE_UNKNOWN; }
|
#define CHECK_MEMTYPE_END else { printBug("guess_memtype_from_cmul_and_uarch: Found invalid combination: clkm=%d, uarch=%d", clkm, arch->uarch); return MEMTYPE_UNKNOWN; }
|
||||||
|
|
||||||
MEMTYPE guess_memtype_from_cmul_and_uarch(int clkm, struct uarch* arch) {
|
MEMTYPE guess_memtype_from_cmul_and_uarch(int clkm, struct uarch* arch) {
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user