예제 #1
0
파일: server.cpp 프로젝트: fritzo/pomagma
void Server::trim(const std::vector<TrimTask>& tasks) {
    compact(m_structure);
    const size_t item_count = m_structure.carrier().item_count();

    std::vector<TrimTask> sorted_tasks = tasks;
    std::sort(sorted_tasks.begin(), sorted_tasks.end(),
              [](const TrimTask& lhs,
                 const TrimTask& rhs) { return lhs.size > rhs.size; });
    const size_t task_count = sorted_tasks.size();
#pragma omp parallel for schedule(dynamic, 1)
    for (size_t iter = 0; iter < task_count; ++iter) {
        const TrimTask& task = sorted_tasks[iter];
        if (task.size >= item_count) {
            if (task.size > item_count) {
                POMAGMA_WARN("trimming only " << item_count << " of "
                                              << task.size << " obs");
            }
            m_structure.dump(task.filename);

        } else {
            Structure region;
            region.init_carrier(task.size);
            extend(region.signature(), m_structure.signature());
            pomagma::trim(m_structure, region, m_theory_file, m_language_file,
                          task.temperature);
            if (POMAGMA_DEBUG_LEVEL > 1) {
                region.validate();
            }
            region.dump(task.filename);
        }
    }
}
예제 #2
0
파일: theory.hpp 프로젝트: imclab/pomagma
void dump_structure (const std::string & filename) { structure.dump(filename); }