1

I'm running a simple code on the same AMD Radeon R7 450 graphics card but on different PCs. On an older PC, the Kernel overall local size can be greater than 2000, and on a newer PC it cannot be greater than 256. How can I increase the Kernel overall local size?

        Device needDevice = null;        
        KernelPreferences preferences = KernelManager.instance().getDefaultPreferences();
        for (Device device : preferences.getPreferredDevices(null))
        {
            if (device.getType().equals(TYPE.GPU) && device.getShortDescription().contains("AMD"))
            {
                needDevice = device;
            }
        }                      

        
        int size = 100000; 
        int cnt = 512; // !!! THIS PARAMETER
        double[][] a = new double[size][cnt];
        double[][] b = new double[size][cnt];
        
        int num = 1;
        for (int j = 0; j < cnt; j++)
        {
            for (int i = 0; i < size; i++)
            {
                a[i][j] = num;
                num++;
            }
        }
      
        
        Kernel kernel = new Kernel()
        {
            @Override 
            public void run() 
            {
                int gid = getGlobalId();
                
                for (int i = 0; i < size; i++)
                {                  
                    b[i][gid] = (a[i][gid] - 2.0)/4.0;
                }
            }            
        };

        Range range = needDevice.createRange(cnt);
        kernel.execute(range);

        kernel.dispose();

I also tried it on an NVIDIA GeForce RTX 3060 Ti graphics card. On an old PC, Kernel overall local size is 256, and the same code on AMD Radeon R7 450 may have Kernel overall local size over 2000

forreg16
  • 21
  • 2

0 Answers0