|
ScaLAPACK
2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
|
00001 SUBROUTINE SLBOOT() 00002 * 00003 * -- ScaLAPACK tools routine (version 1.7) -- 00004 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00005 * and University of California, Berkeley. 00006 * May 1, 1997 00007 * 00008 * Purpose 00009 * ======= 00010 * 00011 * SLBOOT (re)sets all timers to 0, and enables SLtimer. 00012 * 00013 * ===================================================================== 00014 * 00015 * .. Parameters .. 00016 INTEGER NTIMER 00017 PARAMETER ( NTIMER = 64 ) 00018 DOUBLE PRECISION STARTFLAG, ZERO 00019 PARAMETER ( STARTFLAG = -5.0D+0, ZERO = 0.0D+0 ) 00020 * .. 00021 * .. Local Scalars .. 00022 INTEGER I 00023 * .. 00024 * .. Common Blocks .. 00025 LOGICAL DISABLED 00026 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ), 00027 $ WALLSEC( NTIMER ), WALLSTART( NTIMER ) 00028 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED 00029 * .. 00030 * .. Executable Statements .. 00031 * 00032 DISABLED = .FALSE. 00033 DO 10 I = 1, NTIMER 00034 CPUSEC( I ) = ZERO 00035 WALLSEC( I ) = ZERO 00036 CPUSTART( I ) = STARTFLAG 00037 WALLSTART( I ) = STARTFLAG 00038 10 CONTINUE 00039 * 00040 RETURN 00041 * 00042 * End of SLBOOT 00043 * 00044 END 00045 * 00046 SUBROUTINE SLTIMER( I ) 00047 * 00048 * -- ScaLAPACK tools routine (version 1.7) -- 00049 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00050 * and University of California, Berkeley. 00051 * May 1, 1997 00052 * 00053 * .. Scalar Arguments .. 00054 INTEGER I 00055 * .. 00056 * 00057 * Purpose 00058 * ======= 00059 * 00060 * SLtimer provides a "stopwatch" functionality cpu/wall timer 00061 * (in seconds). Up to 64 separate timers can be functioning at once. 00062 * The first call starts the timer, and the second stops it. This 00063 * routine can be disenabled, so that calls to the timer are ignored. 00064 * This feature can be used to make sure certain sections of code do 00065 * not affect timings, even if they call routines which have SLtimer 00066 * calls in them. 00067 * 00068 * Arguments 00069 * ========= 00070 * 00071 * I (global input) INTEGER 00072 * The timer to stop/start. 00073 * 00074 * ===================================================================== 00075 * 00076 * .. Parameters .. 00077 INTEGER NTIMER 00078 PARAMETER ( NTIMER = 64 ) 00079 DOUBLE PRECISION STARTFLAG 00080 PARAMETER ( STARTFLAG = -5.0D+0 ) 00081 * .. 00082 * .. External Functions .. 00083 DOUBLE PRECISION DCPUTIME00, DWALLTIME00 00084 EXTERNAL DCPUTIME00, DWALLTIME00 00085 * .. 00086 * .. Common Blocks .. 00087 LOGICAL DISABLED 00088 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ), 00089 $ WALLSEC( NTIMER ), WALLSTART( NTIMER ) 00090 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED 00091 * .. 00092 * .. Executable Statements .. 00093 * 00094 * If timing disabled, return 00095 * 00096 IF( DISABLED ) 00097 $ RETURN 00098 * 00099 IF( WALLSTART( I ).EQ.STARTFLAG ) THEN 00100 * 00101 * If timer has not been started, start it 00102 * 00103 WALLSTART( I ) = DWALLTIME00() 00104 CPUSTART( I ) = DCPUTIME00() 00105 * 00106 ELSE 00107 * 00108 * Stop timer and add interval to count 00109 * 00110 CPUSEC( I ) = CPUSEC( I ) + DCPUTIME00() - CPUSTART( I ) 00111 WALLSEC( I ) = WALLSEC( I ) + DWALLTIME00() - WALLSTART( I ) 00112 WALLSTART( I ) = STARTFLAG 00113 * 00114 END IF 00115 * 00116 RETURN 00117 * 00118 * End of SLTIMER 00119 * 00120 END 00121 * 00122 SUBROUTINE SLENABLE() 00123 * 00124 * -- ScaLAPACK tools routine (version 1.7) -- 00125 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00126 * and University of California, Berkeley. 00127 * May 1, 1997 00128 * 00129 * Purpose 00130 * ======= 00131 * 00132 * SLENABLE sets it so calls to SLtimer are not ignored. 00133 * 00134 * ===================================================================== 00135 * 00136 * .. Parameters .. 00137 INTEGER NTIMER 00138 PARAMETER ( NTIMER = 64 ) 00139 * .. 00140 * .. Common Blocks .. 00141 LOGICAL DISABLED 00142 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ), 00143 $ WALLSEC( NTIMER ), WALLSTART( NTIMER ) 00144 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED 00145 * .. 00146 * .. Executable Statements .. 00147 * 00148 DISABLED = .FALSE. 00149 * 00150 RETURN 00151 * 00152 END 00153 * 00154 SUBROUTINE SLDISABLE() 00155 * 00156 * -- ScaLAPACK tools routine (version 1.7) -- 00157 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00158 * and University of California, Berkeley. 00159 * May 1, 1997 00160 * 00161 * Purpose 00162 * ======= 00163 * 00164 * SLDISABLE sets it so calls to SLTIMER are ignored. 00165 * 00166 * ===================================================================== 00167 * 00168 * .. Parameters .. 00169 INTEGER NTIMER 00170 PARAMETER ( NTIMER = 64 ) 00171 * .. 00172 * .. Common Blocks .. 00173 LOGICAL DISABLED 00174 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ), 00175 $ WALLSEC( NTIMER ), WALLSTART( NTIMER ) 00176 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED 00177 * .. 00178 * .. Executable Statements .. 00179 * 00180 DISABLED = .TRUE. 00181 * 00182 RETURN 00183 * 00184 * End of SLDISABLE 00185 * 00186 END 00187 * 00188 DOUBLE PRECISION FUNCTION SLINQUIRE( TIMETYPE, I ) 00189 * 00190 * -- ScaLAPACK tools routine (version 1.7) -- 00191 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00192 * and University of California, Berkeley. 00193 * May 1, 1997 00194 * 00195 * .. Scalar Arguments .. 00196 CHARACTER*1 TIMETYPE 00197 INTEGER I 00198 * .. 00199 * 00200 * Purpose 00201 * ======= 00202 * 00203 * SLINQUIRE returns wall or cpu time that has accumulated in timer I. 00204 * 00205 * Arguments 00206 * ========= 00207 * 00208 * TIMETYPE (global input) CHARACTER 00209 * Controls what time will be returned: 00210 * = 'W': wall clock time is returned, 00211 * = 'C': CPU time is returned (default). 00212 * 00213 * I (global input) INTEGER 00214 * The timer to return. 00215 * 00216 * ===================================================================== 00217 * 00218 * .. Parameters .. 00219 INTEGER NTIMER 00220 PARAMETER ( NTIMER = 64 ) 00221 DOUBLE PRECISION ERRFLAG 00222 PARAMETER ( ERRFLAG = -1.0D+0 ) 00223 * .. 00224 * .. Local Scalars .. 00225 DOUBLE PRECISION TIME 00226 * .. 00227 * .. External Functions .. 00228 LOGICAL LSAME 00229 DOUBLE PRECISION DCPUTIME00, DWALLTIME00 00230 EXTERNAL DCPUTIME00, DWALLTIME00, LSAME 00231 * .. 00232 * .. Common Blocks .. 00233 LOGICAL DISABLED 00234 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ), 00235 $ WALLSEC( NTIMER ), WALLSTART( NTIMER ) 00236 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED 00237 * .. 00238 * .. Executable Statements .. 00239 * 00240 IF( LSAME( TIMETYPE, 'W' ) ) THEN 00241 * 00242 * If walltime not available on this machine, return -1 flag 00243 * 00244 IF( DWALLTIME00().EQ.ERRFLAG ) THEN 00245 TIME = ERRFLAG 00246 ELSE 00247 TIME = WALLSEC( I ) 00248 END IF 00249 ELSE 00250 IF( DCPUTIME00().EQ.ERRFLAG ) THEN 00251 TIME = ERRFLAG 00252 ELSE 00253 TIME = CPUSEC( I ) 00254 END IF 00255 END IF 00256 * 00257 SLINQUIRE = TIME 00258 * 00259 RETURN 00260 * 00261 * End of SLINQUIRE 00262 * 00263 END 00264 * 00265 SUBROUTINE SLCOMBINE( ICTXT, SCOPE, OP, TIMETYPE, N, IBEG, 00266 $ TIMES ) 00267 * 00268 * -- ScaLAPACK tools routine (version 1.7) -- 00269 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00270 * and University of California, Berkeley. 00271 * May 1, 1997 00272 * 00273 * .. Scalar Arguments .. 00274 CHARACTER OP, SCOPE, TIMETYPE 00275 INTEGER IBEG, ICTXT, N 00276 * .. 00277 * .. Array Arguments .. 00278 DOUBLE PRECISION TIMES( N ) 00279 * .. 00280 * 00281 * Purpose 00282 * ======= 00283 * 00284 * SLCOMBINE takes the timing information stored on a scope of processes 00285 * and combines them into the user's TIMES array. 00286 * 00287 * Arguments 00288 * ========= 00289 * 00290 * ICTXT (local input) INTEGER 00291 * The BLACS context handle. 00292 * 00293 * SCOPE (global input) CHARACTER 00294 * Controls what processes in grid participate in combine. 00295 * Options are 'Rowwise', 'Columnwise', or 'All'. 00296 * 00297 * OP (global input) CHARACTER 00298 * Controls what combine should be done: 00299 * = '>': get maximal time on any process (default), 00300 * = '<': get minimal time on any process, 00301 * = '+': get sum of times across processes. 00302 * 00303 * TIMETYPE (global input) CHARACTER 00304 * Controls what time will be returned in TIMES: 00305 * = 'W': wall clock time, 00306 * = 'C': CPU time (default). 00307 * 00308 * N (global input) INTEGER 00309 * The number of timers to combine. 00310 * 00311 * IBEG (global input) INTEGER 00312 * The first timer to be combined. 00313 * 00314 * TIMES (global output) DOUBLE PRECISION array, dimension (N) 00315 * The requested timing information is returned in this array. 00316 * 00317 * ===================================================================== 00318 * 00319 * .. Parameters .. 00320 INTEGER NTIMER 00321 PARAMETER ( NTIMER = 64 ) 00322 DOUBLE PRECISION ERRFLAG 00323 PARAMETER ( ERRFLAG = -1.0D+0 ) 00324 * .. 00325 * .. Local Scalars .. 00326 LOGICAL TMPDIS 00327 INTEGER I 00328 * .. 00329 * .. External Subroutines .. 00330 EXTERNAL DGAMX2D, DGAMN2D, DGSUM2D 00331 * .. 00332 * .. External Functions .. 00333 LOGICAL LSAME 00334 DOUBLE PRECISION DCPUTIME00, DWALLTIME00 00335 EXTERNAL DCPUTIME00, DWALLTIME00, LSAME 00336 * .. 00337 * .. Common Blocks .. 00338 LOGICAL DISABLED 00339 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ), 00340 $ WALLSEC( NTIMER ), WALLSTART( NTIMER ) 00341 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED 00342 * .. 00343 * .. Executable Statements .. 00344 * 00345 * Disable timer for combine operation 00346 * 00347 TMPDIS = DISABLED 00348 DISABLED = .TRUE. 00349 * 00350 * Copy timer information into user's times array 00351 * 00352 IF( LSAME( TIMETYPE, 'W' ) ) THEN 00353 * 00354 * If walltime not available on this machine, fill in times 00355 * with -1 flag, and return 00356 * 00357 IF( DWALLTIME00().EQ.ERRFLAG ) THEN 00358 DO 10 I = 1, N 00359 TIMES( I ) = ERRFLAG 00360 10 CONTINUE 00361 RETURN 00362 ELSE 00363 DO 20 I = 1, N 00364 TIMES( I ) = WALLSEC( IBEG + I - 1 ) 00365 20 CONTINUE 00366 END IF 00367 ELSE 00368 IF( DCPUTIME00().EQ.ERRFLAG ) THEN 00369 DO 30 I = 1, N 00370 TIMES( I ) = ERRFLAG 00371 30 CONTINUE 00372 RETURN 00373 ELSE 00374 DO 40 I = 1, N 00375 TIMES( I ) = CPUSEC( IBEG + I - 1 ) 00376 40 CONTINUE 00377 END IF 00378 ENDIF 00379 * 00380 * Combine all nodes' information, restore disabled, and return 00381 * 00382 IF( OP.EQ.'>' ) THEN 00383 CALL DGAMX2D( ICTXT, SCOPE, ' ', N, 1, TIMES, N, -1, -1, 00384 $ -1, -1, 0 ) 00385 ELSE IF( OP.EQ.'<' ) THEN 00386 CALL DGAMN2D( ICTXT, SCOPE, ' ', N, 1, TIMES, N, -1, -1, 00387 $ -1, -1, 0 ) 00388 ELSE IF( OP.EQ.'+' ) THEN 00389 CALL DGSUM2D( ICTXT, SCOPE, ' ', N, 1, TIMES, N, -1, 0 ) 00390 ELSE 00391 CALL DGAMX2D( ICTXT, SCOPE, ' ', N, 1, TIMES, N, -1, -1, 00392 $ -1, -1, 0 ) 00393 END IF 00394 * 00395 DISABLED = TMPDIS 00396 * 00397 RETURN 00398 * 00399 * End of SLCOMBINE 00400 * 00401 END