1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-09 14:28:12 +00:00

Map GPU devices to virtual devices in their true physical order based on BusNumber.

This commit is contained in:
Con Kolivas 2012-01-28 01:56:12 +11:00
parent 5869382d40
commit 5a0b4f62d0
3 changed files with 32 additions and 12 deletions

31
adl.c
View File

@ -364,29 +364,38 @@ void init_adl(int nDevs)
ga->lasttemp = __gpu_temp(ga); ga->lasttemp = __gpu_temp(ga);
} }
/* Search for twin GPUs on a single card. They will be separated by one
* bus id and one will have fanspeed while the other won't. */
for (gpu = 0; gpu < devices; gpu++) { for (gpu = 0; gpu < devices; gpu++) {
struct gpu_adl *ga = &gpus[gpu].adl; struct gpu_adl *ga = &gpus[gpu].adl;
struct cgpu_info *cgpu = &gpus[gpu];
int j; int j;
if (ga->has_fanspeed) cgpu->virtual_gpu = 0;
continue;
for (j = 0; j < devices; j++) { for (j = 0; j < devices; j++) {
struct gpu_adl *other_ga; struct gpu_adl *other_ga;
if (j == gpu) if (j == gpu)
continue; continue;
other_ga = &gpus[j].adl; other_ga = &gpus[j].adl;
if (fanspeed_twin(ga, other_ga)) {
applog(LOG_INFO, "Dual GPUs detected: %d and %d", /* Find the real GPU order based on their order
ga->gpu, other_ga->gpu); * according to their iBusNumber value */
ga->twin = other_ga; if (other_ga->iBusNumber < ga->iBusNumber)
other_ga->twin = ga; cgpu->virtual_gpu++;
break;
/* Search for twin GPUs on a single card. They will be
* separated by one bus id and one will have fanspeed
* while the other won't. */
if (!ga->has_fanspeed) {
if (fanspeed_twin(ga, other_ga)) {
applog(LOG_INFO, "Dual GPUs detected: %d and %d",
ga->gpu, other_ga->gpu);
ga->twin = other_ga;
other_ga->twin = ga;
}
} }
} }
applog(LOG_INFO, "GPU %d mapped to virtual GPU %d", gpu, cgpu->virtual_gpu);
} }
} }

12
adl.h
View File

@ -20,8 +20,18 @@ void change_gpusettings(int gpu);
void gpu_autotune(int gpu, bool *enable); void gpu_autotune(int gpu, bool *enable);
void clear_adl(int nDevs); void clear_adl(int nDevs);
#else /* HAVE_ADL */ #else /* HAVE_ADL */
#include "miner.h"
#define adl_active (0) #define adl_active (0)
static inline void init_adl(int nDevs) {} static inline void init_adl(int nDevs)
{
int i;
for (i = 0; i < nDevs; i++) {
struct cgpu_info *cgpu = &gpus[i];
cgpu->virtual_gpu = i;
}
}
static inline void change_gpusettings(int gpu) { } static inline void change_gpusettings(int gpu) { }
static inline void clear_adl(int nDevs) {} static inline void clear_adl(int nDevs) {}
#endif #endif

View File

@ -277,6 +277,7 @@ struct cgpu_info {
int threads; int threads;
struct thr_info *thread; struct thr_info *thread;
int virtual_gpu;
bool dynamic; bool dynamic;
int intensity; int intensity;
#ifdef HAVE_ADL #ifdef HAVE_ADL