Exemple #1
0
    void run()
    {
        std::mt19937 generator(randomSeed());
        std::uniform_int_distribution<size_t> distribution(0, queries.size() - 1);

        for (size_t i = 0; i < concurrency; ++i)
            pool.schedule(std::bind(&Benchmark::thread, this, connections.get()));

        InterruptListener interrupt_listener;
        info_per_interval.watch.restart();
        delay_watch.restart();

        /// Push queries into queue
        for (size_t i = 0; !max_iterations || i < max_iterations; ++i)
        {
            size_t query_index = randomize ? distribution(generator) : i % queries.size();

            if (!tryPushQueryInteractively(queries[query_index], interrupt_listener))
                break;
        }

        shutdown = true;
        pool.wait();
        info_total.watch.stop();

        if (!json_path.empty())
            reportJSON(info_total, json_path);

        printNumberOfQueriesExecuted(info_total.queries);
        report(info_total);
    }
Exemple #2
0
 void printNumberOfQueriesExecuted(size_t num)
 {
     std::cerr << "\nQueries executed: " << num;
     if (queries.size() > 1)
         std::cerr << " (" << (num * 100.0 / queries.size()) << "%)";
     std::cerr << ".\n";
 }
Exemple #3
0
void pcl::gpu::Octree::approxNearestSearch(const Queries& queries, NeighborIndices& results) const
{
    assert(queries.size() > 0);    
    results.create(static_cast<int> (queries.size()), 1);
    
    const OctreeImpl::Queries& q = (const OctreeImpl::Queries&)queries;
    static_cast<OctreeImpl*>(impl)->approxNearestSearch(q, results);
}
Exemple #4
0
void pcl::gpu::Octree::radiusSearch(const Queries& queries, float radius, int max_results, NeighborIndices& results) const
{
    assert(queries.size() > 0);
    results.create(static_cast<int> (queries.size()), max_results);
    results.sizes.create(queries.size());
    
    const OctreeImpl::Queries& q = (const OctreeImpl::Queries&)queries;
    static_cast<OctreeImpl*>(impl)->radiusSearch(q, radius, results);
}
Exemple #5
0
void pcl::gpu::Octree::nearestKSearchBatch(const Queries& queries, int k, NeighborIndices& results) const
{    
    if (k != 1)
        throw pcl::PCLException("OctreeGPU::knnSearch is supported only for k == 1", __FILE__, "", __LINE__);
    
    assert(queries.size() > 0);
    results.create(static_cast<int> (queries.size()), k);	    

	const OctreeImpl::Queries& q = (const OctreeImpl::Queries&)queries;

    static_cast<OctreeImpl*>(impl)->nearestKSearchBatch(q, k, results);
}
Exemple #6
0
    void readQueries()
    {
        ReadBufferFromFileDescriptor in(STDIN_FILENO);

        while (!in.eof())
        {
            std::string query;
            readText(query, in);
            assertChar('\n', in);

            if (!query.empty())
                queries.emplace_back(query);
        }

        if (queries.empty())
            throw Exception("Empty list of queries.");

        std::cerr << "Loaded " << queries.size() << " queries.\n";
    }