def METHOD_NAME(cell_idx, sorted_idx):
    """
    Sort the cell index of the particles and
    modify the sorted index array accordingly.
    Parameters
    ----------
    cell_idx : 1darray of integers
        The cell index of the particle
    sorted_idx : 1darray of integers
        Represents the original index of the
        particle before the sorting.
    """
    Ntot = cell_idx.shape[0]
    if Ntot > 0:
        if type(cell_idx) == np.ndarray or  type(sorted_idx) == np.ndarray:
            raise ValueError("Unexpected CPU array")
        d_cell_idx = cell_idx
        d_sorted_idx = sorted_idx
        # `thrust.argsort` will simultaneously:
        # - find the indices `sorted_idx` that sort the initial array cell_idx
        # - sort `cell_idx` in place
        thrust.argsort( dtype=d_cell_idx.dtype,
                        idx_start=d_sorted_idx.data.ptr,
                        data_start=d_cell_idx.data.ptr,
                        keys_start=0,
                        shape=d_cell_idx.shape )
        # As part of `thrust.argsort`, `cupy` will allocate temporarily
        # arrays in its memory pool. For performance reasons, this
        # memory is not automatically released, after `argsort`
        # Here we force `cupy` to release the memory.