From 9be63c5fe1fbd7ace5c46272269744a725757b86 Mon Sep 17 00:00:00 2001
From: Gary Frost <frost.gary@gmail.com>
Date: Sat, 9 Jun 2012 13:28:02 +0000
Subject: [PATCH]

---
 com.amd.aparapi/src/java/com/amd/aparapi/Config.java       | 6 ++++--
 com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/Config.java b/com.amd.aparapi/src/java/com/amd/aparapi/Config.java
index e21829d6..e11ed0a7 100644
--- a/com.amd.aparapi/src/java/com/amd/aparapi/Config.java
+++ b/com.amd.aparapi/src/java/com/amd/aparapi/Config.java
@@ -180,13 +180,15 @@ class Config{
       void showAndTell(String message, Instruction _start, Instruction _instruction);
    }
 
+   static final boolean enableInstructionDecodeViewer = Boolean.getBoolean(propPkgName + ".enableInstructionDecodeViewer");
    static String instructionListenerClassName = System.getProperty(propPkgName + ".instructionListenerClass");
 
    static public InstructionListener instructionListener = null;
 
    static {
-      System.out.println("junk!");
-
+      if (enableInstructionDecodeViewer && (instructionListenerClassName==null || instructionListenerClassName.equals(""))  ){
+         instructionListenerClassName = InstructionViewer.class.getName();
+      }
       if (instructionListenerClassName != null && !instructionListenerClassName.equals("")) {
          try {
             Class<?> instructionListenerClass = Class.forName(instructionListenerClassName);
diff --git a/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java b/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java
index fec5eee8..49142f71 100644
--- a/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java
+++ b/com.amd.aparapi/src/java/com/amd/aparapi/KernelRunner.java
@@ -1362,8 +1362,9 @@ class KernelRunner{
                int jniFlags = 0;
                if (openCLDevice == null) {
                   if (kernel.getExecutionMode().equals(EXECUTION_MODE.GPU)) {
-                     // We just treat as before by getting first GPU device
-                     openCLDevice = (OpenCLDevice) OpenCLDevice.firstGPU();
+                     // We used to treat as before by getting first GPU device
+                     // now we get the best GPU
+                     openCLDevice = (OpenCLDevice) OpenCLDevice.best();
                      jniFlags |= JNI_FLAG_USE_GPU; // this flag might be redundant now. 
                   } else {
                      // We fetch the first CPU device 
-- 
GitLab