TEST_MODE mode = TEST_MODE.QUICK;
MEMORY memMode = MEMORY.PAGEABLE;
ACCESS accMode = ACCESS.DIRECT;
CLPlatform[] platforms = CLPlatform.listCLPlatforms();
CLPlatform platform = platforms[0];
// prefere NV
for (CLPlatform p : platforms) {
if(p.getICDSuffix().equals("NV")) {
platform = p;
break;
}
}
CLDevice device = platform.getMaxFlopsDevice();
int deviceIndex = -1;
for (String arg : args) {
if(arg.startsWith("--access=")) {
accMode = ACCESS.valueOf(arg.substring(9).toUpperCase());
}else if(arg.startsWith("--memory=")) {
memMode = MEMORY.valueOf(arg.substring(9).toUpperCase());
}else if(arg.startsWith("--device=")) {
deviceIndex = Integer.parseInt(arg.substring(9).toUpperCase());
}else if(arg.startsWith("--mode=")) {
mode = TEST_MODE.valueOf(arg.substring(7).toUpperCase());
}else if(arg.startsWith("--platform=")) {
platform = platforms[Integer.parseInt(arg.substring(11))];
}else{
System.out.println("unknown arg: "+arg);
System.exit(1);
}
}
if(deviceIndex != -1) {
device = platform.listCLDevices()[deviceIndex];
}
CLContext context = CLContext.create(device);
System.out.println();