NFFT Logo 3.2.3
nfft/simple_test_threads.c
1 /*
2  * Copyright (c) 2002, 2012 Jens Keiner, Stefan Kunis, Daniel Potts
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 51
16  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 /* $Id: simple_test.c 3198 2009-05-27 14:16:50Z keiner $ */
20 #include "config.h"
21 
22 #include <stdio.h>
23 #include <math.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #ifdef HAVE_COMPLEX_H
27 #include <complex.h>
28 #endif
29 #include <omp.h>
30 
31 #include "nfft3util.h"
32 #include "nfft3.h"
33 #include "infft.h"
34 //#include <time.h>
35 
36 int main(void)
37 {
38  nfft_plan p;
39  const int N = 1000000;
40  const int M = 1000000;
41  ticks t0, t1;
42  double t;
43 
44  printf("nthreads = %d\n", nfft_get_num_threads());
45 
46  /* init */
47  fftw_init_threads();
48  nfft_init_1d(&p,N,M);
49 
50  /* pseudo random nodes */
52 
53  /* precompute psi, that is, the entries of the matrix B */
54  t0 = getticks();
55  if(p.nfft_flags & PRE_ONE_PSI)
56  nfft_precompute_one_psi(&p);
57  t1 = getticks();
58  t = nfft_elapsed_seconds(t1,t0);
59  fprintf(stderr,"precompute elapsed time: %.3f seconds\n",t);
60 
61  /* pseudo random Fourier coefficients */
63 
64  /* transformation */
65  t0 = getticks();
66  nfft_trafo(&p);
67  t1 = getticks();
68  t = nfft_elapsed_seconds(t1,t0);
69  fprintf(stderr,"compute elapsed time: %.3f seconds\n",t);
70  fflush(stderr);
71 // nfft_vpr_complex(p.f,p.M_total,"ndft, vector f");
72 
73  /* cleanup */
74  nfft_finalize(&p);
75  fftw_cleanup_threads();
76 
77  return EXIT_SUCCESS;
78 }

Generated on Tue Apr 30 2013 by Doxygen 1.8.1