CUDALink`
CUDALink`

CUDASort

CUDASort[vec]

sorts the input vector.

CUDASort[mem]

sorts CUDAMemory in place.

CUDASort[vec,op]

sorts input with respect to the ordering function op.

更多信息和选项更多信息
  • The CUDALink application must be loaded using Needs["CUDALink`"].
  • CUDASort works on general vector types such as "Float", "Double", .
  • CUDASort does not work on symbolic input.
  • CUDASort is equivalent to Sort.
  • The value for op can be either Less or Greater.
  • 范例

    打开所有单元关闭所有单元

    基本范例  (4)

    First, load the CUDALink application:

    In[1]:=
    Click for copyable input

    This sorts an input list:

    In[2]:=
    Click for copyable input
    Out[2]=

    This sorts using the Greater ordering function:

    In[1]:=
    Click for copyable input
    Out[1]=

    If input is CUDAMemory, then memory is returned as output:

    In[1]:=
    Click for copyable input
    Out[1]=

    This sorts the input CUDAMemory:

    In[2]:=
    Click for copyable input
    Out[2]=

    Note that the input and output memories are the samethat is, CUDASort sorts memory in place. Memory is retrieved using CUDAMemoryGet:

    In[3]:=
    Click for copyable input
    Out[3]=

    CUDASort works on vector types by sorting the data lexicographically. This generates random integer tuples:

    In[1]:=
    Click for copyable input
    Out[1]=

    This loads the memory as "Integer2":

    In[2]:=
    Click for copyable input
    Out[2]=

    This sorts the memory in place:

    In[3]:=
    Click for copyable input
    Out[3]=

    This gets the memory into the Wolfram Language:

    In[4]:=
    Click for copyable input
    Out[4]=

    The result agrees with the Wolfram Language:

    In[5]:=
    Click for copyable input
    Out[5]=

    Possible Issues  (1)

    参见

    Sort  CUDAMap  CUDAFold  CUDAFoldList

    教程