Skip to content

Commit

Permalink
Merge pull request #14 from hpc4cmb/knl_debug
Browse files Browse the repository at this point in the history
Knl debug
  • Loading branch information
keskitalo authored Sep 24, 2019
2 parents 94db6bd + 26b6500 commit 833a274
Show file tree
Hide file tree
Showing 13 changed files with 535 additions and 409 deletions.
12 changes: 7 additions & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ map_routines.lo : map_routines.f90 commonparam.lo matrix.lo mpi_wrappers.lo \
submap_transfer.lo : submap_transfer.f90 commonparam.lo mpi_wrappers.lo

parameter_control.lo : parameter_control.f90 commonparam.lo \
noise_routines.lo pointing.lo mpi_wrappers.lo maps_and_baselines.lo
noise_routines.lo pointing.lo mpi_wrappers.lo maps_and_baselines.lo \
memory_and_time.lo

pointing.lo : pointing.f90 commonparam.lo mpi_wrappers.lo memory_and_time.lo

Expand All @@ -84,14 +85,16 @@ maps_and_baselines.lo : maps_and_baselines.f90 commonparam.lo mpi_wrappers.lo \
tod_storage.lo : tod_storage.f90 commonparam.lo mpi_wrappers.lo memory_and_time.lo

noise_routines.lo : noise_routines.f90 commonparam.lo fourier_fftw_2003.lo \
mpi_wrappers.lo timing.lo tod_storage.lo
mpi_wrappers.lo timing.lo tod_storage.lo memory_and_time.lo

memory_and_time.lo : memory_and_time.f90 commonparam.lo mpi_wrappers.lo

output.lo : output.f90 commonparam.lo submap_transfer.lo \
mpi_wrappers.lo timing.lo maps_and_baselines.lo tod_storage.lo fitsmod2.lo
mpi_wrappers.lo timing.lo maps_and_baselines.lo tod_storage.lo \
fitsmod2.lo

maptod_transfer.lo : maptod_transfer.f90 commonparam.lo mpi_wrappers.lo
maptod_transfer.lo : maptod_transfer.f90 commonparam.lo mpi_wrappers.lo \
memory_and_time.lo

smadam_routines.lo : smadam_routines.f90 commonparam.lo mpi_wrappers.lo \
maptod_transfer.lo noise_routines.lo map_routines.lo \
Expand All @@ -115,7 +118,6 @@ smadam.lo : smadam.F90 commonparam.lo inputparam.lo \
covmat.lo covmat_util.lo



libmadam_la_LIBADD = $(AM_LIBS)

#libmadam_la_LDFLAGS = -Wl,--no-undefined
Expand Down
232 changes: 166 additions & 66 deletions src/commonparam.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,38 @@ MODULE commonparam
real(dp), allocatable :: plateaus(:)
END TYPE detector_data

real(dp) :: fsample = 1 ! Sampling frequency
character(len=30) :: unit_tod = 'unknown'
real(dp) :: fsample ! Sampling frequency
character(len=30) :: unit_tod

! OpenMP
integer :: nthreads_max=1, nthreads=1, id_thread=0
integer :: nthreads_max, nthreads, id_thread
integer, external :: omp_get_num_procs, omp_get_max_threads, &
omp_get_thread_num, omp_get_num_threads

logical :: flag_by_horn=.false., force_pol=.false.
logical :: concatenate_messages = .true., allreduce = .false.
logical :: reassign_submaps = .true.
logical :: noise_weights_from_psd = .false. ! integrate noise weights internally
logical :: flag_by_horn, force_pol
logical :: concatenate_messages, allreduce, reassign_submaps
logical :: noise_weights_from_psd ! integrate noise weights internally
! Assume well-behaved noise spectrum without low pass filtering
logical :: radiometers = .true.
integer(i8b) :: psd_downsample=10
integer (i8b) :: psdlen=1e6
logical :: radiometers
integer(i8b) :: psd_downsample, psdlen
! Enable sub ring map making
integer(i2b) :: nsubchunk=0
integer(i2b) :: isubchunk=0
real(dp) :: fnoise_max=1000 ! When measuring noise variance, use this limit
integer(i2b) :: nsubchunk, isubchunk
real(dp) :: fnoise_max
character(len=SLEN) :: file_profile = ''
character(len=SLEN) :: file_intermediate_profile = ''
logical :: checknan=.false. ! Can cost time
real(dp) :: diagfilter=0
logical :: sync_output=.true., skip_existing=.false.
logical :: write_cut=.false.
logical :: tod_is_clean = .false.
logical :: binary_output=.false., concatenate_binary=.false.
logical :: checknan
real(dp) :: diagfilter
logical :: sync_output, skip_existing
logical :: write_cut
logical :: tod_is_clean
logical :: binary_output, concatenate_binary
! Used for concatenate_binary when storing multiple MC maps
integer :: record_number=1
integer :: record_number
! Number of independent groups of processes writing binary maps
integer(i4b) :: nwrite_binary = 10
integer(i4b) :: nwrite_binary
integer(i4b), parameter :: basis_poly=1, basis_fourier=2, basis_cheby=3, &
basis_legendre=4
integer(i4b) :: basis_func=basis_legendre, basis_order=0
integer(i4b) :: basis_func, basis_order
type :: basis_function_type
integer(i8b) :: nsamp
logical :: copy
Expand Down Expand Up @@ -100,70 +97,68 @@ MODULE commonparam
integer(i4b) :: nsurvey
logical(byte), allocatable :: surveyflags(:)

logical :: bin_subsets = .false.
logical :: mcmode = .false., cached = .false.
logical :: bin_subsets
logical :: mcmode, cached

real(dp) :: good_baseline_fraction=0 ! default accepts all baselines
real(dp) :: good_baseline_fraction
! monte Carlo mode
integer(idp) :: mc_increment=1e7, mc_loops=1, mc_id=0, rng_base=0
logical :: incomplete_matrices = .false.
integer(idp) :: mc_increment, mc_loops, mc_id, rng_base
logical :: incomplete_matrices

integer :: ID = 0
integer :: ntasks = 1
integer :: ID
integer :: ntasks

character(len=*), parameter :: version = '3.7'
character(len=*), parameter :: idf = '(i4,": ",a,1x,i0,2x,i0)'

! Input parameters
integer :: info=2
integer :: info

integer :: nside_map=512, nside_cross=-1, nside_submap=16
integer :: nside_map, nside_cross, nside_submap

real(dp) :: time_unit=-5.d0
real(dp) :: mission_time=0.0
integer :: nofiles=-1
real(dp) :: time_unit
real(dp) :: mission_time
integer :: nofiles

integer :: pixmode_map=2, pixmode_cross=2
real(dp) :: pixlim_map=1e-6, pixlim_cross=1e-3
logical :: allow_decoupling = .false.
integer :: pixmode_map, pixmode_cross
real(dp) :: pixlim_map, pixlim_cross
logical :: allow_decoupling

real(dp) :: dnshort=-1
integer :: nlong=-1, nshort=-1
logical :: kfirst=.true., kfilter=.false.
real(dp) :: dnshort
integer :: nlong, nshort
logical :: kfirst, kfilter
logical :: unaligned_fft

real(dp) :: cglimit=1.d-12
integer :: iter_min=3, iter_max=1000
integer :: precond_width_min=10, precond_width_max=100
logical :: use_fprecond=.false., use_cgprecond=.false.
real(dp) :: cglimit
integer :: iter_min, iter_max
integer :: precond_width_min, precond_width_max
logical :: use_fprecond, use_cgprecond

integer :: mode_detweight=0
integer :: mode_detweight

logical :: rm_monopole=.false., temperature_only=.false.
logical :: rm_monopole, temperature_only

! Input files
character(len=SLEN) :: file_param='', &
file_inmask='', file_spectrum='', file_gap=''
character(len=SLEN) :: file_param, file_inmask, file_spectrum, file_gap

! Output files
character(len=SLEN) :: file_root='madam'
character(len=SLEN) :: file_map='', file_hit='', file_base=''
character(len=SLEN) :: file_matrix='', file_mask='', file_binmap=''
character(len=SLEN) :: file_wcov='', file_leakmatrix=''
character(len=SLEN) :: file_gap_out='', file_mc='', path_output=''
character(len=SLEN) :: file_root, file_map, file_hit, file_base, &
file_matrix, file_mask, file_binmap, file_wcov, file_leakmatrix, &
file_gap_out, file_mc, path_output

logical :: write_tod=.false.
logical :: write_tod

! LFI specific keywords
character(len=80) :: instrument = ''
character(len=80) :: instrument

! NCVM specific parameters
logical :: kwrite_covmat=.false.
character(len=SLEN) :: file_covmat = ''
logical :: kwrite_covmat
character(len=SLEN) :: file_covmat

type(detector_data), allocatable, target :: detectors(:)

! Derived directly from input parameters
integer :: nmap=0, ncc=0, nside_max, nodetectors=-1
integer :: nmap, ncc, nside_max, nodetectors

! Pixels
integer :: nopix_map, nopix_cross
Expand All @@ -185,7 +180,7 @@ MODULE commonparam
real(i8b), allocatable :: baselines_short_time(:)

! Number of pointing periods and their duration as a number of samples
integer(i4b) :: ninterval = -1, ninterval_tot = -1
integer(i4b) :: ninterval, ninterval_tot
integer(i8b), allocatable :: intervals(:)
integer(i4b), allocatable :: interval_id(:)

Expand All @@ -195,14 +190,119 @@ MODULE commonparam
integer(i4b), allocatable :: id_submap(:)
integer(i4b) :: id_next, id_prev

logical :: do_map=.true., do_binmap=.false., do_hits=.false.
logical :: do_mask=.false., do_matrix=.false., do_wcov=.false.
logical :: do_base=.false., do_leakmatrix=.false.
logical :: do_wnmap=.false.
logical :: use_inmask

integer :: noiter = 0
logical :: do_map, do_binmap, do_hits, do_mask, do_matrix, do_wcov, do_base, &
do_leakmatrix, do_wnmap, use_inmask
integer :: noiter

!--------------------------------------------------------------------------

contains

subroutine set_parameter_defaults()
! Set or restore commonparam values to defaults
fsample = 1
unit_tod = "unknown"
nthreads_max = 1
nthreads = 1
id_thread = 1
flag_by_horn = .false.
force_pol = .false.
concatenate_messages = .true.
allreduce = .false.
reassign_submaps = .true.
noise_weights_from_psd = .false.
radiometers = .true.
psd_downsample = 10
psdlen = 1e6
nsubchunk = 0
isubchunk = 0
fnoise_max = 1000 ! When measuring noise variance, use this limit
checknan = .false. ! Can cost time
diagfilter = 0
sync_output = .true.
skip_existing = .false.
write_cut = .false.
tod_is_clean = .false.
binary_output = .false.
concatenate_binary = .false.
record_number = 1
nwrite_binary = 10
basis_func = basis_legendre
basis_order = 0
bin_subsets = .false.
mcmode = .false.
cached = .false.
good_baseline_fraction = 0 ! default accepts all baselines
mc_increment = 1e7
mc_loops = 1
mc_id = 0
rng_base = 0
incomplete_matrices = .false.
ID = 0
ntasks = 1
info = 2
nside_map = 512
nside_cross = -1
nside_submap = 16
time_unit = -5
mission_time = 0
nofiles = -1
pixmode_map = 2
pixmode_cross = 2
pixlim_map = 1e-6
pixlim_cross = 1e-3
allow_decoupling = .false.
dnshort = -1
nlong = -1
nshort = -1
kfirst = .true.
kfilter = .false.
unaligned_fft = .false.
cglimit = 1e-12
iter_min = 3
iter_max = 1000
precond_width_min = 10
precond_width_max = 100
use_fprecond = .false.
use_cgprecond = .false.
mode_detweight = 0
rm_monopole = .false.
temperature_only = .false.
file_param = ""
file_inmask = ""
file_spectrum = ""
file_gap = ""
file_root = "madam"
file_map = ""
file_hit = ""
file_base = ""
file_matrix = ""
file_mask = ""
file_binmap = ""
file_wcov = ""
file_leakmatrix = ""
file_gap_out = ""
file_mc = ""
path_output = ""
write_tod = .false.
instrument = ""
kwrite_covmat = .false.
file_covmat = ""
nmap = 0
ncc = 0
nodetectors = -1
ninterval = -1
ninterval_tot = -1
do_map = .true.
do_binmap = .false.
do_hits = .false.
do_mask = .false.
do_matrix = .false.
do_wcov = .false.
do_base = .false.
do_leakmatrix = .false.
do_wnmap = .false.
noiter = 0
end subroutine set_parameter_defaults

END MODULE commonparam
Loading

0 comments on commit 833a274

Please sign in to comment.