/** @brief Radix Sort Plan constructor * * @param[in] mgr pointer to the CUDPPManager * @param[in] config The configuration struct specifying options * @param[in] numElements The maximum number of elements to be sorted */ CUDPPRadixSortPlan::CUDPPRadixSortPlan(CUDPPManager *mgr, CUDPPConfiguration config, size_t numElements) : CUDPPPlan(mgr, config, numElements, 1, 0), m_bKeysOnly((m_config.options & CUDPP_OPTION_KEYS_ONLY) != 0), m_bBackward((m_config.options & CUDPP_OPTION_BACKWARD) != 0), m_scanPlan(0), m_tempKeys(0), m_tempValues(0), m_counters(0), m_countersSum(0), m_blockOffsets(0) { size_t numBlocks2 = ((numElements % (SORT_CTA_SIZE * 2)) == 0) ? (numElements / (SORT_CTA_SIZE * 2)) : (numElements / (SORT_CTA_SIZE * 2) + 1); CUDPPConfiguration scanConfig = { CUDPP_SCAN, CUDPP_ADD, CUDPP_UINT, CUDPP_OPTION_FORWARD | CUDPP_OPTION_EXCLUSIVE }; m_scanPlan = new CUDPPScanPlan(mgr, scanConfig, numBlocks2*16, 1, 0); allocRadixSortStorage(this); }
CUDPPRadixSortPlan::CUDPPRadixSortPlan(CUDPPConfiguration config, size_t numElements) : CUDPPPlan(config, numElements, 1, 0), m_scanPlan(0), m_tempKeys(0), m_tempValues(0), m_counters(0), m_countersSum(0), m_blockOffsets(0) { size_t numBlocks2 = ((numElements % (SORT_CTA_SIZE * 2)) == 0) ? (numElements / (SORT_CTA_SIZE * 2)) : (numElements / (SORT_CTA_SIZE * 2) + 1); CUDPPConfiguration scanConfig = { CUDPP_SCAN, CUDPP_ADD, CUDPP_UINT, CUDPP_OPTION_FORWARD | CUDPP_OPTION_EXCLUSIVE }; if(m_config.options == CUDPP_OPTION_KEYS_ONLY) m_bKeysOnly = true; else m_bKeysOnly = false; m_scanPlan = new CUDPPScanPlan(scanConfig, numBlocks2*16, 1, 0); allocRadixSortStorage(this); }