Advertisement
Guest User

Untitled

a guest
Jun 6th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   subroutine test_real_3D_threads(input, output, array_ref)                                              
  2.     implicit none                                                                                        
  3.     double precision ::  input(N, N, N)                                                                  
  4.     double complex :: output(N, N, N)                                                                    
  5.     double complex :: array_ref(N, N, N)                                                                  
  6.     integer*8 :: plan                                                                                    
  7.     integer :: i                                                                                          
  8.     integer :: id, nb_threads                                                                            
  9.     integer, external :: omp_get_num_threads, omp_get_max_threads                                        
  10.                                                                                                          
  11. !$OMP PARALLEL SHARED(nb_threads)                                                                        
  12.     nb_threads = omp_get_num_threads()                                                                    
  13.     print *, nb_threads                                                                                  
  14. !$OMP END PARALLEL                                                                                        
  15.                                                                                                          
  16.     call dfftw_plan_with_nthreads(omp_get_max_threads())                                                  
  17.     !call dfftw_plan_with_nthreads(3)                                                                    
  18.     call dfftw_plan_dft_r2c_3d(plan, N,N,N, input, output, FFTW_ESTIMATE)                                
  19.     id = omp_get_thread_num()                                                                            
  20.     call init(input)                                                                                      
  21.     ! Don't forget to initialize                                                                          
  22.     output(:,:,:) = 0                                                                                    
  23.                                                                                                          
  24.     call dfftw_execute_dft_r2c(plan, input, output)                                                      
  25.                                                                                                          
  26.     call compare(output, array_ref)                                                                      
  27.     call dfftw_destroy_plan(plan)                                                                        
  28.                                                                                                          
  29.   end subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement