diff --git a/checkin_notes b/checkin_notes index bd02d7c793..5acd95a42e 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6941,3 +6941,17 @@ Charlie 20 Aug 2008 lib/ filesys.C + +David 20 Aug 2008 + - client: if the host has two CUDA GPUs, + they were being recorded as two COPROC structures of type CUDA. + Unfortunately, the logic doesn't handle this correctly; + it expects there to be a single structure with count==2. + Change things to do this. + + Unfortunately this means that if the two GPUs are different, + that difference will get lost. + This is a design flaw, and would take some work to fix. + + lib/ + coproc.C diff --git a/lib/coproc.C b/lib/coproc.C index a2f65c8904..95f74b8378 100644 --- a/lib/coproc.C +++ b/lib/coproc.C @@ -150,19 +150,29 @@ const char* COPROC_CUDA::get(COPROCS& coprocs) { return "Library doesn't have cudaGetDeviceProperties()"; } #endif - bool found = false; + + // NOTE: our design is flawed: + // there's no provision for having two coprocs of type CUDA. + // So on systems with two GPUs (possibly of different hardware type) + // we have to count them as two of the same + // (*__cudaGetDeviceCount)(&count); + int real_count = 0; + COPROC_CUDA cc, cc2; for (int i=0; iprop, i); - if (cc->prop.major >= 1) { - found = true; - cc->count = 1; - strcpy(cc->type, "CUDA"); - coprocs.coprocs.push_back(cc); + (*__cudaGetDeviceProperties)(&cc.prop, i); + if (cc.prop.major >= 1) { // major == 0 means emulation + cc2 = cc; + real_count++; } } - if (!found) { + if (real_count) { + COPROC_CUDA* ccp = new COPROC_CUDA; + *ccp = cc2; + ccp->count = real_count; + strcpy(ccp->type, "CUDA"); + coprocs.coprocs.push_back(ccp); + } else { return "No CUDA devices found"; } return "CUDA devices found";