Bugfix: GPU could be on the same bus (and having the same pci bus id)
This commit is contained in:
@@ -35,6 +35,11 @@ public class GPUDevice {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GPUDevice(String type, String model, long ram, String id, String oldId) {
|
||||||
|
this(type, model, ram, id);
|
||||||
|
this.oldId = oldId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package com.sheepit.client.hardware.gpu.nvidia;
|
package com.sheepit.client.hardware.gpu.nvidia;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.sheepit.client.hardware.gpu.nvidia.CUDeviceAttribute;
|
|
||||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||||
import com.sheepit.client.hardware.gpu.GPULister;
|
import com.sheepit.client.hardware.gpu.GPULister;
|
||||||
import com.sheepit.client.os.OS;
|
import com.sheepit.client.os.OS;
|
||||||
@@ -64,9 +61,8 @@ public class Nvidia implements GPULister {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GPUDevice> devices = new LinkedList<GPUDevice>();
|
List<GPUDevice> devices = new ArrayList<>(count.getValue());
|
||||||
|
|
||||||
HashMap<String, GPUDevice> devicesWithPciId = new HashMap<String, GPUDevice>(count.getValue());
|
|
||||||
for (int num = 0; num < count.getValue(); num++) {
|
for (int num = 0; num < count.getValue(); num++) {
|
||||||
IntByReference aDevice = new IntByReference();
|
IntByReference aDevice = new IntByReference();
|
||||||
|
|
||||||
@@ -122,17 +118,10 @@ public class Nvidia implements GPULister {
|
|||||||
pciDomainId.getValue(),
|
pciDomainId.getValue(),
|
||||||
pciBusId.getValue(),
|
pciBusId.getValue(),
|
||||||
pciDeviceId.getValue());
|
pciDeviceId.getValue());
|
||||||
devicesWithPciId.put(Integer.toString(pciBusId.getValue()), new GPUDevice(TYPE, new String(name).trim(), ram.getValue(), blenderId));
|
GPUDevice gpu = new GPUDevice(TYPE, new String(name).trim(), ram.getValue(), blenderId);
|
||||||
}
|
// for backward compatibility generate a CUDA_N id
|
||||||
|
gpu.setOldId(TYPE + "_" + num);
|
||||||
// for backward compatibility generate a CUDA_N id
|
devices.add(gpu);
|
||||||
// in theory a set to environment "CUDA_DEVICE_ORDER=PCI_BUS_ID" should be enough but it didn't work
|
|
||||||
int i = 0;
|
|
||||||
for (Map.Entry<String, GPUDevice> entry : devicesWithPciId.entrySet()){
|
|
||||||
GPUDevice aDevice = entry.getValue();
|
|
||||||
aDevice.setOldId(TYPE + "_" + Integer.toString(i));
|
|
||||||
devices.add(aDevice);
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
|
|||||||
Reference in New Issue
Block a user