NFFT Logo 3.2.2
nfft/simple_test_threads.c
00001 /*
00002  * Copyright (c) 2002, 2012 Jens Keiner, Stefan Kunis, Daniel Potts
00003  *
00004  * This program is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU General Public License along with
00015  * this program; if not, write to the Free Software Foundation, Inc., 51
00016  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 /* $Id: simple_test.c 3198 2009-05-27 14:16:50Z keiner $ */
00020 #include "config.h"
00021 
00022 #include <stdio.h>
00023 #include <math.h>
00024 #include <string.h>
00025 #include <stdlib.h>
00026 #ifdef HAVE_COMPLEX_H
00027 #include <complex.h>
00028 #endif
00029 #include <omp.h>
00030 
00031 #include "nfft3util.h"
00032 #include "nfft3.h"
00033 #include "infft.h"
00034 //#include <time.h>
00035 
00036 int main(void)
00037 {
00038   nfft_plan p;
00039   const int N = 1000000;
00040   const int M = 1000000;
00041   ticks t0, t1;
00042   double t;
00043 
00044   printf("nthreads = %d\n", nfft_get_num_threads());
00045 
00046   /* init */
00047   fftw_init_threads();
00048   nfft_init_1d(&p,N,M);
00049 
00050   /* pseudo random nodes */
00051   nfft_vrand_shifted_unit_double(p.x,p.M_total);
00052 
00053   /* precompute psi, that is, the entries of the matrix B */
00054   t0 = getticks();
00055   if(p.nfft_flags & PRE_ONE_PSI)
00056       nfft_precompute_one_psi(&p);
00057   t1 = getticks();
00058   t = nfft_elapsed_seconds(t1,t0);
00059   fprintf(stderr,"precompute elapsed time: %.3f seconds\n",t);
00060 
00061   /* pseudo random Fourier coefficients */
00062   nfft_vrand_unit_complex(p.f_hat,p.N_total);
00063 
00064   /* transformation */
00065   t0 = getticks();
00066   nfft_trafo(&p);
00067   t1 = getticks();
00068   t = nfft_elapsed_seconds(t1,t0);
00069   fprintf(stderr,"compute    elapsed time: %.3f seconds\n",t);
00070   fflush(stderr);
00071 //  nfft_vpr_complex(p.f,p.M_total,"ndft, vector f");
00072 
00073   /* cleanup */
00074   nfft_finalize(&p);
00075   fftw_cleanup_threads();
00076 
00077   return EXIT_SUCCESS;
00078 }

Generated on Fri Oct 12 2012 by Doxygen 1.8.0-20120409