| NFFT 3.5.0

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

nfft/simple_test_threads.c
1 /*
2 * Copyright (c) 2002, 2017 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 #include <stdio.h>
19 #include <math.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include <omp.h>
23
24 #include <sys/time.h>
25
26 #define NFFT_PRECISION_DOUBLE
27
28 #include "nfft3mp.h"
29
30 int main(void)
31 {
32 NFFT(plan) p;
33 const int N = 1000000;
34 const int M = 1000000;
35 NFFT_R t0, t1;
36
37 printf("nthreads = " NFFT__D__ "\n", NFFT(get_num_threads)());
38
39 /* init */
40 FFTW(init_threads)();
41 NFFT(init_1d)(&p,N,M);
42
43 /* pseudo random nodes */
44 NFFT(vrand_shifted_unit_double)(p.x,p.M_total);
45
46 /* precompute psi, that is, the entries of the matrix B */
47 t0 = NFFT(clock_gettime_seconds)();
48 if(p.flags & PRE_ONE_PSI)
49 NFFT(precompute_one_psi)(&p);
50 t1 = NFFT(clock_gettime_seconds)();
51 fprintf(stderr,"precompute elapsed time: %.3" NFFT__FIS__ " seconds\n",t1-t0);
52
53 /* pseudo random Fourier coefficients */
54 NFFT(vrand_unit_complex)(p.f_hat,p.N_total);
55
56 /* transformation */
57 t0 = NFFT(clock_gettime_seconds)();
58 NFFT(trafo)(&p);
59 t1 = NFFT(clock_gettime_seconds)();
60 fprintf(stderr,"compute elapsed time: %.3" NFFT__FIS__ " seconds\n",t1-t0);
61 fflush(stderr);
62
63 /* cleanup */
64 NFFT(finalize)(&p);
65 FFTW(cleanup_threads)();
66
67 return EXIT_SUCCESS;
68 }
PRE_ONE_PSI
#define PRE_ONE_PSI
Definition: nfft3.h:206