1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <cusp/detail/random.h>
#include <cusp/gallery/poisson.h>
#include <cusp/graph/hilbert_curve.h>
#include <thrust/functional.h>
#include "../timer.h"
int main(int argc, char*argv[])
{
srand(time(NULL));
typedef int IndexType;
typedef double ValueType;
typedef cusp::device_memory MemorySpace;
size_t num_points = 1<<20; // 1M points
for( int k = 0; k < 4; k++ ) {
for( int i = 2; i < 4; i++ )
{
cusp::array2d<ValueType,MemorySpace,cusp::column_major> coords(num_points, i);
cusp::copy(cusp::detail::random_reals<ValueType>(i*num_points, rand()), coords.values);
cusp::array1d<IndexType,MemorySpace> parts(num_points);
timer t;
cusp::graph::hilbert_curve(coords, i, parts);
std::cout << "Number of points : " << num_points << std::endl;
std::cout << " hsfc(" << i << "D) : " << t.milliseconds_elapsed() << " (ms)\n" << std::endl;
}
num_points <<= 1;
}
return EXIT_SUCCESS;
}
|