GPU::generate generate an empty list instead of null
This commit is contained in:
@@ -31,6 +31,8 @@ public class GPU {
|
|||||||
public static List<GPUDevice> devices = null;
|
public static List<GPUDevice> devices = null;
|
||||||
|
|
||||||
public static boolean generate() {
|
public static boolean generate() {
|
||||||
|
devices = new LinkedList<GPUDevice>();
|
||||||
|
|
||||||
OS os = OS.getOS();
|
OS os = OS.getOS();
|
||||||
String path = os.getCUDALib();
|
String path = os.getCUDALib();
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
@@ -79,8 +81,6 @@ public class GPU {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
devices = new LinkedList<GPUDevice>();
|
|
||||||
|
|
||||||
for (int num = 0; num < count.getValue(); num++) {
|
for (int num = 0; num < count.getValue(); num++) {
|
||||||
byte name[] = new byte[256];
|
byte name[] = new byte[256];
|
||||||
|
|
||||||
@@ -107,9 +107,6 @@ public class GPU {
|
|||||||
if (devices == null) {
|
if (devices == null) {
|
||||||
generate();
|
generate();
|
||||||
}
|
}
|
||||||
if (devices == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> devs = new LinkedList<String>();
|
List<String> devs = new LinkedList<String>();
|
||||||
for (GPUDevice dev : devices) {
|
for (GPUDevice dev : devices) {
|
||||||
@@ -122,9 +119,6 @@ public class GPU {
|
|||||||
if (devices == null) {
|
if (devices == null) {
|
||||||
generate();
|
generate();
|
||||||
}
|
}
|
||||||
if (devices == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user