![]() |
Millepede-II
V04-00-00
|
00001 00003 00008 00009 MODULE mpmod 00010 USE mpdef 00011 IMPLICIT NONE 00012 SAVE 00013 ! steering parameters 00014 INTEGER :: ictest=0 !< test mode '-t' 00015 INTEGER :: metsol=0 !< solution method (1: inversion, 2: diagonalization, 3: \ref minres "MINRES") 00016 INTEGER :: matsto=2 !< (global) matrix storage mode (1: full, 2: sparse) 00017 INTEGER :: mprint=1 !< print flag (0: minimal, 1: normal, >1: more) 00018 INTEGER :: mdebug=0 !< debug flag (number of records to print) 00019 INTEGER :: mdebg2=10 !< number of measurements for record debug printout 00020 INTEGER :: mreqen=10 !< required number of entries (for variable global parameter) 00021 INTEGER :: mitera=1 !< number of iterations 00022 INTEGER :: nloopn=0 !< number of data reading, fitting loops 00023 INTEGER :: mbandw=0 !< band width of preconditioner matrix 00024 INTEGER :: lunkno=0 !< flag for unkown keywords 00025 INTEGER :: lhuber=0 !< Huber down-weighting flag 00026 REAL :: chicut=0.0 !< cut in terms of 3-sigma cut, first iteration 00027 REAL :: chirem=0.0 !< cut in terms of 3-sigma cut, other iterations, approaching 1. 00028 REAL :: chhuge=50.0 !< cut in terms of 3-sigma for unreasonable data, all iterations 00029 INTEGER :: nrecpr=0 !< record number with printout 00030 INTEGER :: nrecp2=0 !< record number with printout 00031 INTEGER :: nrec1 =0 !< record number with largest residual 00032 INTEGER :: nrec2 =0 !< record number with largest chi^2/Ndf 00033 REAL :: value1=0.0!< largest residual 00034 REAL :: value2=0.0!< largest chi^2/Ndf 00035 REAL :: dwcut=0.0 !< down-weight fraction cut 00036 INTEGER :: isubit=0 !< subito flag '-s' 00037 REAL :: wolfc1=0.0!< C_1 of strong Wolfe condition 00038 REAL :: wolfc2=0.0!< C_2 of strong Wolfe condition 00039 DOUBLE PRECISION :: mrestl=1.0D-06 !< tolerance criterion for MINRES 00040 INTEGER :: nofeas=0 !< flag for skipping making parameters feasible 00041 INTEGER :: nhistp=0 !< flag for histogram printout 00042 REAL :: delfun=0.0!< expected function change 00043 REAL :: actfun=0.0!< actual function change 00044 REAL :: angras=0.0!< angle between gradient and search direction 00045 INTEGER :: iterat=0 !< iterations in solution 00046 INTEGER :: nregul=0 !< regularization flag 00047 REAL :: regula=1.0!< regularization parameter, add regula * norm(global par.) to objective function 00048 REAL :: regpre=0.0!< default presigma 00049 INTEGER :: matrit=0 !< matrix calculation up to iteration MATRIT 00050 INTEGER :: icalcm=0 !< calculation mode (for \ref xloopn "XLOOPN") , >0: calculate matrix 00051 INTEGER :: numbit=1 !< number of bits for pair counters 00052 INTEGER :: nbndr =0 !< number of records with bordered band matrix for local fit 00053 INTEGER :: nbdrx =0 !< max border size for local fit 00054 INTEGER :: nbndx =0 !< max band width for local fit 00055 INTEGER :: nrecer=0 !< record with error (rank deficit or Not-a-Number) for printout 00056 INTEGER :: nrec3 =maxi4 !< (1.) record number with error 00057 INTEGER :: mreqpe=1 !< min number of pair entries 00058 INTEGER :: mhispe=0 !< upper bound for pair entry histogrammimg 00059 INTEGER :: msngpe=0 !< upper bound for pair entry single precision storage 00060 INTEGER :: mcmprs=0 !< compression flag for sparsity (column indices) 00061 INTEGER :: mthrd =1 !< number of (OpenMP) threads 00062 INTEGER :: mxrec =0 !< max number of records 00063 INTEGER :: matmon=0 !< record interval for monitoring of (sparse) matrix construction 00064 INTEGER :: lfitnp=maxi4 !< local fit: number of iteration to calculate pulls 00065 INTEGER :: lfitbb=1 !< local fit: check for bordered band matrix (if >0) 00066 INTEGER :: mnrsel=0 !< number of MINRES error labels in LBMNRS (calc err, corr with SOLGLO) 00067 INTEGER :: ncache=-1 !< buffer size for caching (default 100MB per thread) 00068 REAL, DIMENSION(3) :: fcache = (/ 0.8, 0., 0. /) !< read cache, average fill level; write cache; dynamic size 00069 INTEGER :: mthrdr=1 !< number of threads for reading binary files 00070 INTEGER :: mnrsit=0 !< total number of MINRES internal iterations 00071 INTEGER :: iforce=0 !< switch to SUBITO for (global) rank defects if zero 00072 INTEGER :: igcorr=0 !< flag for output of global correlations for inversion, =0: none 00073 INTEGER :: memdbg=0 !< debug flag for memory management 00074 REAL :: prange=0.0!< range (-PRANGE..PRANGE) for histograms of pulls, norm. residuals 00075 ! variables 00076 INTEGER :: lunlog !< unit for logfile 00077 INTEGER :: lvllog !< log level 00078 INTEGER :: ntgb !< total number of global parameters 00079 INTEGER :: nvgb !< number of variable global parameters 00080 INTEGER :: nagb !< number of fit parameters (global par. + Lagrange mult.) 00081 INTEGER :: ncgb !< number of constraints 00082 INTEGER :: nagbn !< max number of global paramters per record 00083 INTEGER :: nalcn !< max number of local paramters per record 00084 INTEGER :: naeqn !< max number of equations (measurements) per record 00085 INTEGER :: nrec !< (current) record number 00086 REAL :: dflim !< convergence limit 00087 INTEGER, DIMENSION(0:3) :: nrejec !< rejected events 00088 REAL, DIMENSION(0:8) :: times !< cpu time counters 00089 REAL :: stepl !< step length (line search) 00090 CHARACTER (LEN=74) :: textl !< name of current MP 'module' (step) 00091 LOGICAL :: newite !< flag for new iteration 00092 INTEGER :: ndfsum !< sum(ndf) 00093 INTEGER :: iitera !< MINRES iterations 00094 INTEGER :: istopa !< MINRES istop (convergence) 00095 INTEGER :: lsinfo !< linesearch: returned information 00096 REAL :: rstart !< cpu start time for solution iterations 00097 REAL :: deltim !< cpu time difference 00098 INTEGER :: npresg !< number of pre-sigmas 00099 INTEGER :: nrecal !< number of records 00100 INTEGER :: nmiss1 !< rank deficit for constraints 00101 INTEGER :: lcalcm !< last calclation mode 00102 INTEGER :: nspc !< number of precision for sparse global matrix (1=D, 2=D+F) 00103 INTEGER :: nencdb !< encoding info (number bits for column counter) 00104 INTEGER, DIMENSION(100) :: lbmnrs !< MINRES error labels 00105 DOUBLE PRECISION :: fvalue !< function value (chi2 sum) solution 00106 DOUBLE PRECISION :: flines !< function value line search 00107 DOUBLE PRECISION :: sumndf !< weighted sum(ndf) 00108 ! each loop 00109 INTEGER :: numReadbuffer !< number of buffers (records) in (read) block 00110 INTEGER :: numBlocks !< number of (read) blocks 00111 INTEGER :: sumRecords !< sum of records 00112 INTEGER :: skippedRecords !< number of skipped records (buffer too small) 00113 INTEGER :: minRecordsInBlock !< min. records in block 00114 INTEGER :: maxRecordsInBlock !< max. records in block 00115 ! accurate sumation 00116 INTEGER, PARAMETER::nexp20=1048576 ! 2**20 00117 DOUBLE PRECISION::accurateDsum=0.0D0 !< fractional part of sum 00118 INTEGER::accurateNsum=0 !< sum mod 2**20 00119 INTEGER::accurateNexp=0 !< sum / 2**20 00120 INTEGER :: lenGlobalVec !< length of global vector 'b' (A*x=b) 00121 ! dynamic arrays 00122 !====================================================== 00123 ! global parameters 00124 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: globalParameter !< global parameters (start values + sum(x_i)) 00125 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: globalParCopy !< copy of global parameters 00126 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: globalCorrections !< correction x_i (from A*x_i=b_i in iteration i) 00127 REAL, DIMENSION(:), ALLOCATABLE :: globalParStart !< start value for global parameters 00128 REAL, DIMENSION(:), ALLOCATABLE :: globalParPreSigma !< pre-sigma for global parameters 00129 REAL, DIMENSION(:), ALLOCATABLE :: globalParPreWeight !< weight from pre-sigma 00130 ! global matrix, vector 00131 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: globalMatD !< global matrix 'A' (double, full or sparse) 00132 REAL, DIMENSION(:), ALLOCATABLE :: globalMatF !< global matrix 'A' (float part for compressed sparse) 00133 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: globalVector !< global vector 'x' (in A*x=b) 00134 ! preconditioning 00135 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: matPreCond !< preconditioner (band) matrix 00136 INTEGER, DIMENSION(:), ALLOCATABLE :: indPreCond !< preconditioner pointer array 00137 ! auxiliary vectors 00138 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: workspaceD !< (general) workspace (D) 00139 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: workspaceLinesearch !< workspace line search 00140 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: workspaceDiagonalization !< workspace diag. 00141 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: workspaceEigenValues !< workspace eigen values 00142 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: workspaceEigenVectors !< workspace eigen vectors 00143 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: workspaceMinres !< workspace MINRES 00144 INTEGER, DIMENSION(:), ALLOCATABLE :: workspaceI !< (general) workspace (I) 00145 ! constraint matrix, residuals 00146 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: matConsProduct !< product matrix of constraints 00147 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: vecConsResiduals !< residuals of constraints 00148 ! global parameter mapping 00149 INTEGER, DIMENSION(:,:), ALLOCATABLE :: globalParLabelIndex !< global parameters label, total -> var. index 00150 INTEGER, DIMENSION(:), ALLOCATABLE :: globalParHashTable !< global parameters hash table 00151 INTEGER, DIMENSION(:), ALLOCATABLE :: globalParVarToTotal !< global parameters variable -> total index 00152 INTEGER, DIMENSION(-7:0) :: globalParHeader = 0 !< global parameters (mapping) header 00153 !! 00154 !! 0: length of labels/indices; \n 00155 !! -1: number of stored items; \n 00156 !! -2: =0 during build-up; \n 00157 !! -3: next number; \n 00158 !! -4: (largest) prime number (< length); \n 00159 !! -5: number of overflows; \n 00160 !! -6: nr of variable parameters; \n 00161 !! -7: call counter for build-up; 00162 00163 ! row information for sparse matrix 00164 INTEGER, DIMENSION(:), ALLOCATABLE :: sparseMatrixCompression !< compression info (per row) 00165 INTEGER, DIMENSION(:), ALLOCATABLE :: sparseMatrixColumns !< (compressed) list of columns for sparse matrix 00166 INTEGER(kind=large), DIMENSION(:,:), ALLOCATABLE :: sparseMatrixOffsets !< row offsets for column list, sparse matrix elements 00167 ! read buffer 00168 INTEGER, DIMENSION(:,:), ALLOCATABLE :: readBufferInfo !< buffer management (per thread) 00169 INTEGER, DIMENSION(:), ALLOCATABLE :: readBufferPointer !< pointer to used buffers 00170 INTEGER, DIMENSION(:), ALLOCATABLE :: readBufferDataI !< integer data 00171 REAL, DIMENSION(:), ALLOCATABLE :: readBufferDataF !< float data 00172 ! global parameter usage in record 00173 INTEGER, DIMENSION(:), ALLOCATABLE :: globalIndexUsage !< indices of global par in record 00174 INTEGER, DIMENSION(:), ALLOCATABLE :: backIndexUsage !< list of global par in record 00175 ! local fit 00176 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::blvec !< local fit vector 'b' (in A*x=b), replaced by 'x' 00177 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::clmat !< local fit matrix 'A' (in A*x=b) 00178 INTEGER, DIMENSION(:), ALLOCATABLE:: ibandh !< local fit 'band width histogram' (band size autodetection) 00179 ! scratch arrays for local fit 00180 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::vbnd !< local fit band part of 'A' 00181 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::vbdr !< local fit border part of 'A' 00182 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::aux !< local fit 'solutions for border rows' 00183 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::vbk !< local fit 'matrix for border solution' 00184 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::vzru !< local fit 'border solution' 00185 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE::scdiag !< local fit workspace (D) 00186 INTEGER, DIMENSION(:), ALLOCATABLE:: scflag !< local fit workspace (I) 00187 REAL, DIMENSION(:), ALLOCATABLE :: localCorrections !< local fit corrections (to residuals) 00188 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: localGlobalMatrix !< matrix correlating local and global par 00189 ! update of global matrix 00190 INTEGER, DIMENSION(:,:), ALLOCATABLE :: writeBufferInfo !< write buffer management (per thread) 00191 REAL, DIMENSION(:,:), ALLOCATABLE :: writeBufferData !< write buffer data (largest residual, Chi2/ndf, per thread) 00192 INTEGER, DIMENSION(:), ALLOCATABLE :: writeBufferIndices !< write buffer for indices 00193 DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: writeBufferUpdates !< write buffer for update matrices 00194 INTEGER, DIMENSION(-6:6) :: writeBufferHeader = 0 !< write buffer header (-6..-1: updates, 1..6: indices) 00195 !! 00196 !! +/-1: buffer size (words) per thread; \n 00197 !! +/-2: min number of free words; \n 00198 !! +/-3: number of buffer flushes; \n 00199 !! +/-4: number of buffer overruns; \n 00200 !! +/-5: average fill level; \n 00201 !! +/-6: peak fill level; 00203 INTEGER :: lenParameters=0 !< length of list of parameters from steering file 00204 TYPE(listItem), DIMENSION(:), ALLOCATABLE :: listParameters !< list of parameters from steering file 00205 INTEGER :: lenPresigmas=0 !< length of list of pre-sigmas from steering file 00206 TYPE(listItem), DIMENSION(:), ALLOCATABLE :: listPreSigmas !< list of pre-sgmas from steering file 00207 INTEGER :: lenConstraints=0 !< length of list of constraints from steering file 00208 TYPE(listItem), DIMENSION(:), ALLOCATABLE :: listConstraints !< list of constraints from steering file 00209 INTEGER :: lenMeasurements=0 !< length of list of measurements from steering file 00210 TYPE(listItem), DIMENSION(:), ALLOCATABLE :: listMeasurements !< list of measurements from steering file 00211 !====================================================== 00212 ! file information 00213 INTEGER, DIMENSION(:), ALLOCATABLE :: mfd !< file mode: cbinary =1, text =2, fbinary=3 00214 INTEGER, DIMENSION(:), ALLOCATABLE :: lfd !< length of file name 00215 INTEGER, DIMENSION(:), ALLOCATABLE :: nfd !< index (line) in (steering) file 00216 INTEGER, DIMENSION(:,:), ALLOCATABLE :: kfd !< (1,.)= number of records in file, (2,..)= file order 00217 INTEGER, DIMENSION(:), ALLOCATABLE :: ifd !< file: integrated record numbers (=offset) 00218 INTEGER, DIMENSION(:), ALLOCATABLE :: jfd !< file: number of accepted records 00219 INTEGER, DIMENSION(:), ALLOCATABLE :: dfd !< file: ndf sum 00220 INTEGER, DIMENSION(:), ALLOCATABLE :: xfd !< file: max. record size 00221 REAL, DIMENSION(:), ALLOCATABLE :: cfd !< file: chi2 sum 00222 REAL, DIMENSION(:), ALLOCATABLE :: ofd !< file: option 00223 REAL, DIMENSION(:), ALLOCATABLE :: wfd !< file: weight 00224 CHARACTER (LEN=1024) :: filnam !< name of steering file 00225 INTEGER :: nfnam !< length of sterring file name 00226 CHARACTER, DIMENSION(:), ALLOCATABLE :: tfd !< file names (concatenation) 00227 INTEGER :: ifile !< current file (index) 00228 INTEGER :: nfiles !< number of files 00229 INTEGER :: nfilb !< number of binary files 00230 INTEGER :: nfilf !< number of Fortran binary files 00231 INTEGER :: nfilc !< number of C binary files 00232 INTEGER :: nfilw !< number of weighted binary files 00233 INTEGER :: ndimbuf=10000 !< default read buffer size (I/F words, half record length) 00234 00235 END MODULE mpmod