/[escript]/trunk/cusplibrary/performance/graph/hilbert_curve.cu
ViewVC logotype

Contents of /trunk/cusplibrary/performance/graph/hilbert_curve.cu

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5148 - (show annotations)
Mon Sep 15 01:25:23 2014 UTC (6 years, 5 months ago) by caltinay
File size: 1037 byte(s)
Merging ripley diagonal storage + CUDA support into trunk.
Options file version has been incremented due to new options
'cuda' and 'nvccflags'.

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

  ViewVC Help
Powered by ViewVC 1.1.26