Feature: replace Cuda with Optix
This commit is contained in:
@@ -38,4 +38,9 @@ public class CUDeviceAttribute {
|
||||
* PCI domain ID of the device
|
||||
*/
|
||||
public static final int CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50;
|
||||
|
||||
/**
|
||||
* Compute capability major version. Return value needs to be > 5 for OptiX support
|
||||
*/
|
||||
public static final int CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.LongByReference;
|
||||
|
||||
public class Nvidia implements GPULister {
|
||||
public static String TYPE = "CUDA";
|
||||
public static String TYPE = "OPTIX";
|
||||
|
||||
@Override public List<GPUDevice> getGpus() {
|
||||
OS os = OS.getOS();
|
||||
@@ -71,6 +71,19 @@ public class Nvidia implements GPULister {
|
||||
continue;
|
||||
}
|
||||
|
||||
IntByReference computeCapabilityMajor = new IntByReference();
|
||||
result = cudalib.cuDeviceGetAttribute(computeCapabilityMajor, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, aDevice.getValue());
|
||||
if (result != CUresult.CUDA_SUCCESS) {
|
||||
System.out
|
||||
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR failed (ret: " + CUresult.stringFor(result) + ")");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (computeCapabilityMajor.getValue() < 5) { //Card is Maxwell or older, too old for optix
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
IntByReference pciDomainId = new IntByReference();
|
||||
IntByReference pciBusId = new IntByReference();
|
||||
IntByReference pciDeviceId = new IntByReference();
|
||||
@@ -115,7 +128,7 @@ public class Nvidia implements GPULister {
|
||||
}
|
||||
|
||||
String blenderId = String
|
||||
.format("CUDA_%s_%04x:%02x:%02x", new String(name).trim(), pciDomainId.getValue(), pciBusId.getValue(), pciDeviceId.getValue());
|
||||
.format("CUDA_%s_%04x:%02x:%02x_OptiX", new String(name).trim(), pciDomainId.getValue(), pciBusId.getValue(), pciDeviceId.getValue());
|
||||
GPUDevice gpu = new GPUDevice(TYPE, new String(name).trim(), ram.getValue(), blenderId);
|
||||
// for backward compatibility generate a CUDA_N id
|
||||
gpu.setOldId(TYPE + "_" + num);
|
||||
|
||||
Reference in New Issue
Block a user