Module openj9.gpu
Package com.ibm.gpu

Class Maths

java.lang.Object
com.ibm.gpu.Maths

public final class Maths extends Object
This class is used to perform sorting operations of primitive arrays of type int, long, float, double on any connected CUDA GPU. A successful sort operation results in the array being sorted in ascending order.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    sortArray(double[] array)
    Sort the given array of doubles into ascending order, using the default CUDA device.
    static void
    sortArray(double[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of doubles into ascending order, using the default CUDA device.
    static void
    sortArray(float[] array)
    Sort the given array of floats into ascending order, using the default CUDA device.
    static void
    sortArray(float[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of floats into ascending order, using the default CUDA device.
    static void
    sortArray(int[] array)
    Sort the given array of integers into ascending order, using the default CUDA device.
    static void
    sortArray(int[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of integers into ascending order, using the default CUDA device.
    static void
    sortArray(int deviceId, double[] array)
    Sort the given array of doubles into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, double[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of doubles into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, float[] array)
    Sort the given array of floats into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, float[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of floats into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, int[] array)
    Sort the given array of integers into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, int[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of integers into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, long[] array)
    Sort the given array of longs into ascending order, using the specified CUDA device.
    static void
    sortArray(int deviceId, long[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of longs into ascending order, using the specified CUDA device.
    static void
    sortArray(long[] array)
    Sort the given array of longs into ascending order, using the default CUDA device.
    static void
    sortArray(long[] array, int fromIndex, int toIndex)
    Sort the specified range of the array of longs into ascending order, using the default CUDA device.

    Methods declared in class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sortArray

      public static void sortArray(double[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of doubles into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(double[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of doubles into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(float[] array) throws GPUSortException, GPUConfigurationException
      Sort the given array of floats into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(float[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of floats into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, double[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of doubles into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, double[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of doubles into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, float[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of floats into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, float[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of floats into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, int[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of integers into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, int[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of integers into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, long[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of longs into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int deviceId, long[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of longs into ascending order, using the specified CUDA device.
      Parameters:
      deviceId - the CUDA device to be used
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of integers into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(int[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of integers into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(long[] array) throws GPUConfigurationException, GPUSortException
      Sort the given array of longs into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs
    • sortArray

      public static void sortArray(long[] array, int fromIndex, int toIndex) throws GPUConfigurationException, GPUSortException
      Sort the specified range of the array of longs into ascending order, using the default CUDA device.
      Parameters:
      array - the array that will be sorted
      fromIndex - the range starting index (inclusive)
      toIndex - the range ending index (exclusive)
      Throws:
      GPUConfigurationException - if an issue has occurred with the CUDA environment
      GPUSortException - if any of the following happens:
      • the device is not available
      • insufficient device memory is available
      • an error occurs transferring the data to or from the device
      • a device execution error occurs