hoomd/mpcd/SorterGPU.cc
/*!
 * \param timestep Current timestep
 *
 * Performs stream compaction on the GPU of the computed cell list into the order
 * particles appear. This will put the particles into a cell-list order, which
 * should be more friendly for other MPCD cell-based operations.
 */
\param timestep Current timestep
Performs stream compaction on the GPU of the computed cell list into the order
particles appear. This will put the particles into a cell-list order, which
should be more friendly for other MPCD cell-based operations.
\ param timestep Current timestep Performs stream compaction on the GPU of the computed cell list into the order particles appear . This will put the particles into a cell - list order which should be more friendly for other MPCD cell - based operations .
void mpcd::SorterGPU::computeOrder(uint64_t timestep)
    {
    if (m_prof)
        {
        m_prof->pop(m_exec_conf);
        }
    m_cl->compute(timestep);
    if (m_prof)
        {
        m_prof->push(m_exec_conf, "MPCD sort");
        }
        {
        ArrayHandle<unsigned int> d_cell_list(m_cl->getCellList(),
                                              access_location::device,
                                              access_mode::readwrite);
        ArrayHandle<unsigned int> d_cell_np(m_cl->getCellSizeArray(),
                                            access_location::device,
                                            access_mode::read);
        m_sentinel_tuner->begin();
        mpcd::gpu::sort_set_sentinel(d_cell_list.data,
                                     d_cell_np.data,
                                     m_cl->getCellListIndexer(),
                                     0xffffffff,
                                     m_sentinel_tuner->getParam());
        if (m_exec_conf->isCUDAErrorCheckingEnabled())
            CHECK_CUDA_ERROR();
        m_sentinel_tuner->end();
        }
        {
        ArrayHandle<unsigned int> d_cell_list(m_cl->getCellList(),
                                              access_location::device,
                                              access_mode::read);
        ArrayHandle<unsigned int> d_order(m_order, access_location::device, access_mode::overwrite);
        const unsigned int num_select
            = mpcd::gpu::sort_cell_compact(d_order.data,
                                           d_cell_list.data,
                                           m_cl->getCellListIndexer().getNumElements(),
                                           m_mpcd_pdata->getN());
        if (m_exec_conf->isCUDAErrorCheckingEnabled())
            CHECK_CUDA_ERROR();
        if (num_select != m_mpcd_pdata->getN())
            {
            m_exec_conf->msg->error()
                << "Error compacting cell list for sorting, lost particles." << std::endl;
            }
        }
        {
        ArrayHandle<unsigned int> d_order(m_order, access_location::device, access_mode::read);
        ArrayHandle<unsigned int> d_rorder(m_rorder,
                                           access_location::device,
                                           access_mode::overwrite);
        m_reverse_tuner->begin();
        mpcd::gpu::sort_gen_reverse(d_rorder.data,
                                    d_order.data,
                                    m_mpcd_pdata->getN(),
                                    m_reverse_tuner->getParam());
        if (m_exec_conf->isCUDAErrorCheckingEnabled())
            CHECK_CUDA_ERROR();
        m_reverse_tuner->end();
        }
    }
void mpcd :: SorterGPU :: computeOrder ( uint64_t timestep ) { if ( m_prof ) { m_prof -> pop ( m_exec_conf ) ; } m_cl -> compute ( timestep ) ; if ( m_prof ) { m_prof -> push ( m_exec_conf , " " ) ; } { ArrayHandle < unsigned int > d_cell_list ( m_cl -> getCellList ( ) , access_location :: device , access_mode :: readwrite ) ; ArrayHandle < unsigned int > d_cell_np ( m_cl -> getCellSizeArray ( ) , access_location :: device , access_mode :: read ) ; m_sentinel_tuner -> begin ( ) ; mpcd :: gpu :: sort_set_sentinel ( d_cell_list . data , d_cell_np . data , m_cl -> getCellListIndexer ( ) , 0xffffffff , m_sentinel_tuner -> getParam ( ) ) ; if ( m_exec_conf -> isCUDAErrorCheckingEnabled ( ) ) CHECK_CUDA_ERROR ( ) ; m_sentinel_tuner -> end ( ) ; } { ArrayHandle < unsigned int > d_cell_list ( m_cl -> getCellList ( ) , access_location :: device , access_mode :: read ) ; ArrayHandle < unsigned int > d_order ( m_order , access_location :: device , access_mode :: overwrite ) ; const unsigned int num_select = mpcd :: gpu :: sort_cell_compact ( d_order . data , d_cell_list . data , m_cl -> getCellListIndexer ( ) . getNumElements ( ) , m_mpcd_pdata -> getN ( ) ) ; if ( m_exec_conf -> isCUDAErrorCheckingEnabled ( ) ) CHECK_CUDA_ERROR ( ) ; if ( num_select != m_mpcd_pdata -> getN ( ) ) { m_exec_conf -> msg -> error ( ) << " " << std :: endl ; } } { ArrayHandle < unsigned int > d_order ( m_order , access_location :: device , access_mode :: read ) ; ArrayHandle < unsigned int > d_rorder ( m_rorder , access_location :: device , access_mode :: overwrite ) ; m_reverse_tuner -> begin ( ) ; mpcd :: gpu :: sort_gen_reverse ( d_rorder . data , d_order . data , m_mpcd_pdata -> getN ( ) , m_reverse_tuner -> getParam ( ) ) ; if ( m_exec_conf -> isCUDAErrorCheckingEnabled ( ) ) CHECK_CUDA_ERROR ( ) ; m_reverse_tuner -> end ( ) ; } }
\param timestep Current timestep
 Performs stream compaction on the GPU of the computed cell list into the order
 particles appear.
\ param timestep Current timestep Performs stream compaction on the GPU of the computed cell list into the order particles appear .
// compute the cell list at current timestep, guarantees owned particles are on rank // fill the empty cell list entries with a sentinel larger than number of MPCD particles // use thrust to select out the indexes of MPCD particles // fill out the reverse ordering map