115 CHARACTER(LEN=63) :: name
116 INTEGER(INTG) :: number_of_invocations
117 REAL(SP) :: total_inclusive_cpu_time
118 REAL(SP) :: total_inclusive_system_time
119 REAL(SP) :: total_exclusive_cpu_time
120 REAL(SP) :: total_exclusive_system_time
131 CHARACTER(LEN=63) :: name
132 REAL(SP) :: inclusive_cpu_time
133 REAL(SP) :: inclusive_system_time
134 REAL(SP) :: exclusive_cpu_time
135 REAL(SP) :: exclusive_system_time
185 SUBROUTINE cputimer(RETURN_TIME, TIME_TYPE, ERR, CERROR) BIND(C,NAME="CPUTimer")
187 REAL(C_DOUBLE),
INTENT(OUT) :: RETURN_TIME
188 INTEGER(C_INT),
INTENT(IN) :: TIME_TYPE
189 INTEGER(C_INT),
INTENT(OUT) :: ERR
190 CHARACTER(C_CHAR),
INTENT(OUT) :: CERROR(*)
191 END SUBROUTINE cputimer
362 SUBROUTINE enters(NAME,ERR,ERROR,*)
365 CHARACTER(LEN=*),
INTENT(IN) :: NAME
366 INTEGER(INTG),
INTENT(OUT) :: ERR
370 REAL(DP) :: ENTERS_CPU_TIME,ENTERS_SYSTEM_TIME
377 ALLOCATE(new_routine_ptr,stat=err)
378 IF(err/=0)
CALL flagerror(
"Could not allocate new routine stack item.",err,error,*999)
379 new_routine_ptr%DIAGNOSTICS=.false.
380 new_routine_ptr%TIMING=.false.
381 new_routine_ptr%NAME=name(1:
len_trim(name))
383 new_routine_ptr%PREVIOUS_ROUTINE=>
routine_stack%STACK_POINTER
386 NULLIFY(new_routine_ptr%PREVIOUS_ROUTINE)
390 NULLIFY(routine_ptr%ROUTINE_LIST_ITEM)
393 routine_ptr%DIAGNOSTICS=.true.
397 DO WHILE(
ASSOCIATED(list_routine_ptr).AND..NOT.finished)
398 IF(list_routine_ptr%NAME(1:
len_trim(list_routine_ptr%NAME))== &
399 & routine_ptr%NAME(1:
len_trim(routine_ptr%NAME)))
THEN 400 routine_ptr%DIAGNOSTICS=.true.
401 routine_ptr%ROUTINE_LIST_ITEM=>list_routine_ptr
404 list_routine_ptr=>list_routine_ptr%NEXT_ROUTINE
408 IF(
ASSOCIATED(routine_ptr%PREVIOUS_ROUTINE))
THEN 409 IF(routine_ptr%PREVIOUS_ROUTINE%DIAGNOSTICS) routine_ptr%DIAGNOSTICS=.true.
413 IF(routine_ptr%DIAGNOSTICS)
THEN 426 IF(routine_ptr%DIAGNOSTICS)
THEN 429 ELSE IF(
ASSOCIATED(routine_ptr%PREVIOUS_ROUTINE))
THEN 432 IF(routine_ptr%PREVIOUS_ROUTINE%DIAGNOSTICS)
THEN 440 CALL cputimer(enters_cpu_time,1,err,cerror)
441 CALL cputimer(enters_system_time,2,err,cerror)
442 routine_ptr%INCLUSIVE_CPU_TIME=
REAL(enters_cpu_time,
sp)
443 routine_ptr%INCLUSIVE_SYSTEM_TIME=
REAL(enters_system_time,
sp)
444 routine_ptr%EXCLUSIVE_CPU_TIME=0.0_sp
445 routine_ptr%EXCLUSIVE_SYSTEM_TIME=0.0_sp
447 routine_ptr%TIMING=.true.
451 DO WHILE(
ASSOCIATED(list_routine_ptr).AND..NOT.finished)
452 IF(list_routine_ptr%NAME(1:
len_trim(list_routine_ptr%NAME))== &
453 & routine_ptr%NAME(1:
len_trim(routine_ptr%NAME)))
THEN 454 routine_ptr%TIMING=.true.
455 routine_ptr%ROUTINE_LIST_ITEM=>list_routine_ptr
458 list_routine_ptr=>list_routine_ptr%NEXT_ROUTINE
462 IF(
ASSOCIATED(routine_ptr%PREVIOUS_ROUTINE))
THEN 463 IF(routine_ptr%PREVIOUS_ROUTINE%TIMING) routine_ptr%TIMING=.true.
480 SUBROUTINE errors(NAME,ERR,ERROR)
483 CHARACTER(LEN=*),
INTENT(IN) :: NAME
484 INTEGER(INTG),
INTENT(OUT) :: ERR
492 error=local_error//name(1:
len_trim(name))
503 SUBROUTINE exits(NAME)
506 CHARACTER(LEN=*),
INTENT(IN) :: NAME
510 REAL(DP) :: EXITS_CPU_TIME,EXITS_SYSTEM_TIME
517 IF(
ASSOCIATED(routine_ptr))
THEN 518 previous_routine_ptr=>routine_ptr%PREVIOUS_ROUTINE
520 IF(routine_ptr%DIAGNOSTICS)
THEN 524 IF(
ASSOCIATED(previous_routine_ptr))
THEN 525 IF(previous_routine_ptr%DIAGNOSTICS)
THEN 542 CALL cputimer(exits_cpu_time,1,err,cerror)
543 CALL cputimer(exits_system_time,2,err,cerror)
544 routine_ptr%INCLUSIVE_CPU_TIME=abs(
REAL(exits_cpu_time,
sp)-ROUTINE_PTR%INCLUSIVE_CPU_TIME)
545 routine_ptr%INCLUSIVE_SYSTEM_TIME=abs(
REAL(exits_system_time,
sp)-ROUTINE_PTR%INCLUSIVE_SYSTEM_TIME)
546 IF(
ASSOCIATED(previous_routine_ptr))
THEN 547 previous_routine_ptr%EXCLUSIVE_CPU_TIME=previous_routine_ptr%EXCLUSIVE_CPU_TIME+routine_ptr%INCLUSIVE_CPU_TIME
548 previous_routine_ptr%EXCLUSIVE_SYSTEM_TIME=previous_routine_ptr%EXCLUSIVE_SYSTEM_TIME+routine_ptr%INCLUSIVE_SYSTEM_TIME
550 IF(
ASSOCIATED(routine_ptr%ROUTINE_LIST_ITEM))
THEN 551 routine_ptr%ROUTINE_LIST_ITEM%NUMBER_OF_INVOCATIONS=routine_ptr%ROUTINE_LIST_ITEM%NUMBER_OF_INVOCATIONS+1
552 routine_ptr%ROUTINE_LIST_ITEM%TOTAL_INCLUSIVE_CPU_TIME=routine_ptr%ROUTINE_LIST_ITEM%TOTAL_INCLUSIVE_CPU_TIME+ &
553 & routine_ptr%INCLUSIVE_CPU_TIME
554 routine_ptr%ROUTINE_LIST_ITEM%TOTAL_INCLUSIVE_SYSTEM_TIME=routine_ptr%ROUTINE_LIST_ITEM%TOTAL_INCLUSIVE_SYSTEM_TIME+ &
555 & routine_ptr%INCLUSIVE_SYSTEM_TIME
556 IF(
ASSOCIATED(previous_routine_ptr))
THEN 557 IF(
ASSOCIATED(previous_routine_ptr%ROUTINE_LIST_ITEM))
THEN 558 previous_routine_ptr%ROUTINE_LIST_ITEM%TOTAL_EXCLUSIVE_CPU_TIME=previous_routine_ptr%ROUTINE_LIST_ITEM% &
559 & total_exclusive_cpu_time+previous_routine_ptr%EXCLUSIVE_CPU_TIME
560 previous_routine_ptr%ROUTINE_LIST_ITEM%TOTAL_EXCLUSIVE_SYSTEM_TIME=previous_routine_ptr%ROUTINE_LIST_ITEM% &
561 & total_exclusive_system_time+previous_routine_ptr%EXCLUSIVE_SYSTEM_TIME
565 IF(routine_ptr%TIMING)
THEN 569 IF(
ASSOCIATED(routine_ptr%ROUTINE_LIST_ITEM))
THEN 570 WRITE(
op_string,
'("*** Number of invocations: ",I10)') routine_ptr%ROUTINE_LIST_ITEM%NUMBER_OF_INVOCATIONS
572 WRITE(
op_string,
'("*** Routine times: Call Inclusive Call Exclusive Total Inclusive Average Inclusive")')
574 WRITE(
op_string,
'("*** CPU (s): ",E14.6," ",E14.6," ",E15.6," ",E17.6)') &
575 & routine_ptr%INCLUSIVE_CPU_TIME,routine_ptr%INCLUSIVE_CPU_TIME-routine_ptr%EXCLUSIVE_CPU_TIME, &
576 & routine_ptr%ROUTINE_LIST_ITEM%TOTAL_INCLUSIVE_CPU_TIME,routine_ptr%ROUTINE_LIST_ITEM% &
577 & total_inclusive_cpu_time/
REAL(routine_ptr%routine_list_item%number_of_invocations,
sp)
579 WRITE(
op_string,
'("*** System (s): ",E14.6," ",E14.6," ",E15.6," ",E17.6)') &
580 & routine_ptr%INCLUSIVE_SYSTEM_TIME,routine_ptr%INCLUSIVE_SYSTEM_TIME-routine_ptr%EXCLUSIVE_SYSTEM_TIME, &
581 & routine_ptr%ROUTINE_LIST_ITEM%TOTAL_INCLUSIVE_SYSTEM_TIME,routine_ptr%ROUTINE_LIST_ITEM% &
582 & total_inclusive_system_time/
REAL(routine_ptr%routine_list_item%number_of_invocations,
sp)
585 WRITE(
op_string,
'("*** Routine times: Call Inclusive Call Exclusive")')
587 WRITE(
op_string,
'("*** CPU (s): ",E14.6," ",E14.6)') &
588 & routine_ptr%INCLUSIVE_CPU_TIME,routine_ptr%INCLUSIVE_CPU_TIME-routine_ptr%EXCLUSIVE_CPU_TIME
590 WRITE(
op_string,
'("*** System (s): ",E14.6," ",E14.6)') &
591 & routine_ptr%INCLUSIVE_SYSTEM_TIME,routine_ptr%INCLUSIVE_SYSTEM_TIME-routine_ptr%EXCLUSIVE_SYSTEM_TIME
598 IF(
ASSOCIATED(previous_routine_ptr))
THEN 605 DEALLOCATE(routine_ptr)
625 INTEGER(INTG),
INTENT(IN) :: MY_NODE_NUMBER
626 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_NODES
627 INTEGER(INTG),
INTENT(OUT) :: ERR
631 enters(
"COMPUTATIONAL_NODE_NUMBERS_SET",err,error,*999)
633 IF(number_of_nodes>0)
THEN 634 IF(my_node_number>=0.AND.my_node_number<=number_of_nodes-1)
THEN 638 CALL flagerror(
"Invalid node number.",err,error,*999)
641 CALL flagerror(
"Invalid number of nodes.",err,error,*999)
644 exits(
"COMPUTATIONAL_NODE_NUMBERS_SET")
646 999 errorsexits(
"COMPUTATIONAL_NODE_NUMBERS_SET",err,error)
659 INTEGER(INTG),
INTENT(IN) :: ERR
662 INTEGER(INTG) :: POSITION
665 error_message=
extract(error,1,position-1)
678 CHARACTER(LEN=*),
INTENT(OUT) :: ERROR_MESSAGE
679 INTEGER(INTG),
INTENT(IN) :: ERR
682 INTEGER(INTG) :: POSITION
685 error_message=
extract(error,1,position-1)
698 CHARACTER(LEN=*),
INTENT(IN) :: STRING
699 INTEGER(INTG),
INTENT(OUT) :: ERR
702 INTEGER(INTG) :: STRING_LENGTH
706 error=string(1:string_length)
720 INTEGER(INTG),
INTENT(OUT) :: ERR
738 CHARACTER(LEN=*),
INTENT(IN) :: STRING
739 INTEGER(INTG),
INTENT(OUT) :: ERR
746 WRITE(
op_string,
'(">>WARNING: ",A)') string
751 999
errors(
"FLAG_WARNING_C",err,error)
765 INTEGER(INTG),
INTENT(OUT) :: ERR
777 999
errors(
"FLAG_WARNING_VS",err,error)
790 INTEGER(INTG),
INTENT(OUT) :: ERR
811 INTEGER(INTG),
INTENT(OUT) :: ERR
814 INTEGER(INTG) :: i,j,RANDOM_SEEDS_SIZE,TIME(8)
845 CALL random_seed(size=random_seeds_size)
847 IF(err/=0)
CALL flagerror(
"Could not allocate random seeds.",err,error,*999)
849 CALL date_and_time(values=time)
870 CALL flagerror(
"Operating system not implemented.",err,error,*999)
890 INTEGER(INTG),
INTENT(OUT) :: ERR
895 enters(
"DIAGNOSTICS_SET_OFF",err,error,*999)
906 DO WHILE(
ASSOCIATED(routine))
907 next_routine=>routine%NEXT_ROUTINE
909 routine=>next_routine
927 CALL flagerror(
"Diagnositics is not on.",err,error,*999)
930 exits(
"DIAGNOSTICS_SET_OFF")
932 999 errorsexits(
"DIAGNOSTICS_SET_OFF",err,error)
941 SUBROUTINE diagnostics_set_on(DIAG_TYPE,LEVEL_LIST,DIAG_FILENAME,ROUTINE_LIST,ERR,ERROR,*)
944 INTEGER(INTG),
INTENT(IN) :: DIAG_TYPE
945 INTEGER(INTG),
INTENT(IN) :: LEVEL_LIST(:)
946 CHARACTER(LEN=*),
INTENT(IN) :: DIAG_FILENAME
947 CHARACTER(LEN=*),
INTENT(IN) :: ROUTINE_LIST(:)
948 INTEGER(INTG),
INTENT(OUT) :: ERR
951 INTEGER(INTG) :: i,LEVEL
952 CHARACTER(LEN=MAXSTRLEN) :: FILENAME
957 enters(
"DIAGNOSTICS_SET_ON",err,error,*999)
964 filename=diag_filename(1:
len_trim(diag_filename))//
".diag" 967 IF(err/=0)
CALL flagerror(
"Could not open diagnostics file.",err,error,*999)
970 SELECT CASE(diag_type)
978 DO WHILE(
ASSOCIATED(routine))
979 next_routine=>routine%NEXT_ROUTINE
981 routine=>next_routine
985 ALLOCATE(routine,stat=err)
986 IF(err/=0)
CALL flagerror(
"Could not allocate routine list item.",err,error,*999)
987 routine%NAME=routine_list(1)
988 previous_routine=>routine
989 NULLIFY(routine%NEXT_ROUTINE)
991 DO i=2,
SIZE(routine_list,1)
992 ALLOCATE(routine,stat=err)
993 IF(err/=0)
CALL flagerror(
"Could not allocate routine list item.",err,error,*999)
994 routine%NAME=routine_list(i)
995 NULLIFY(routine%NEXT_ROUTINE)
996 previous_routine%NEXT_ROUTINE=>routine
997 previous_routine=>routine
1000 CALL flagerror(
"Invalid diagnostic type.",err,error,*999)
1002 DO i=1,
SIZE(level_list,1)
1016 CALL flagerror(
"Invalid diagnostic level.",err,error,*999)
1022 exits(
"DIAGNOSTICS_SET_ON")
1029 DO WHILE(
ASSOCIATED(routine))
1030 next_routine=>routine%NEXT_ROUTINE
1032 routine=>next_routine
1044 errorsexits(
"DIAGNOSTICS_SET_ON",err,error)
1056 INTEGER(INTG),
INTENT(OUT) :: ERR
1060 enters(
"OUTPUT_SET_OFF",err,error,*999)
1066 CALL flagerror(
"Write output is not on.",err,error,*999)
1069 exits(
"OUTPUT_SET_OFF")
1071 999 errorsexits(
"OUTPUT_SET_OFF",err,error)
1083 CHARACTER(LEN=*),
INTENT(IN) :: ECHO_FILENAME
1084 INTEGER(INTG),
INTENT(OUT) :: ERR
1087 CHARACTER(LEN=MAXSTRLEN) :: FILENAME
1089 enters(
"OUTPUT_SET_ON",err,error,*999)
1092 CALL flagerror(
"Write output is already on.",err,error,*999)
1097 filename=echo_filename(1:
len_trim(echo_filename))//
".out" 1100 IF(err/=0)
CALL flagerror(
"Could not open write output file.",err,error,*999)
1104 exits(
"OUTPUT_SET_ON")
1106 999 errorsexits(
"OUTPUT_SET_ON",err,error)
1118 INTEGER(INTG),
INTENT(OUT) :: RANDOM_SEEDS(:)
1119 INTEGER(INTG),
INTENT(INOUT) :: ERR
1122 CHARACTER(LEN=MAXSTRLEN) :: LOCAL_ERROR
1124 enters(
"RANDOM_SEEDS_GET",err,error,*999)
1129 WRITE(local_error,
'("The size of the supplied random seeds array of ",I2," is too small. The size must be >= ",I2,".")') &
1131 CALL flagerror(local_error,err,error,*999)
1134 exits(
"RANDOM_SEED_GET")
1136 999 errorsexits(
"RANDOM_SEEDS_GET",err,error)
1148 INTEGER(INTG),
INTENT(OUT) :: RANDOM_SEEDS_SIZE
1149 INTEGER(INTG),
INTENT(INOUT) :: ERR
1153 enters(
"RANDOM_SEEDS_SIZE_GET",err,error,*999)
1157 exits(
"RANDOM_SEED_SIZE_GET")
1159 999 errorsexits(
"RANDOM_SEEDS_SIZE_GET",err,error)
1171 INTEGER(INTG),
INTENT(IN) :: RANDOM_SEEDS(:)
1172 INTEGER(INTG),
INTENT(INOUT) :: ERR
1176 enters(
"RANDOM_SEEDS_SET",err,error,*999)
1184 exits(
"RANDOM_SEEDS_SET")
1186 999 errorsexits(
"RANDOM_SEEDS_SET",err,error)
1198 INTEGER(INTG),
INTENT(OUT) :: ERR
1203 enters(
"TIMING_SET_OFF",err,error,*999)
1214 DO WHILE(
ASSOCIATED(routine))
1215 next_routine=>routine%NEXT_ROUTINE
1217 routine=>next_routine
1226 CALL flagerror(
"Timing is not on.",err,error,*999)
1229 exits(
"TIMING_SET_OFF")
1231 999 errorsexits(
"TIMING_SET_OFF",err,error)
1240 SUBROUTINE timing_set_on(TIMING_TYPE,TIMING_SUMMARY_FLAG,TIMING_FILENAME,ROUTINE_LIST,ERR,ERROR,*)
1243 INTEGER(INTG),
INTENT(IN) :: TIMING_TYPE
1244 LOGICAL,
INTENT(IN) :: TIMING_SUMMARY_FLAG
1245 CHARACTER(LEN=*),
INTENT(IN) :: TIMING_FILENAME
1246 CHARACTER(LEN=*),
INTENT(IN) :: ROUTINE_LIST(:)
1247 INTEGER(INTG),
INTENT(OUT) :: ERR
1251 CHARACTER(LEN=MAXSTRLEN) :: FILENAME
1254 enters(
"TIMING_SET_ON",err,error,*999)
1257 IF(
len_trim(timing_filename)>=1)
THEN 1262 filename=timing_filename(1:
len_trim(timing_filename))//
".timing" 1265 IF(err/=0)
CALL flagerror(
"Could not open timing file.",err,error,*999)
1268 SELECT CASE(timing_type)
1276 DO WHILE(
ASSOCIATED(routine))
1277 next_routine=>routine%NEXT_ROUTINE
1279 routine=>next_routine
1283 ALLOCATE(routine,stat=err)
1284 IF(err/=0)
CALL flagerror(
"Could not allocate routine list item.",err,error,*999)
1285 routine%NAME=routine_list(1)
1286 previous_routine=>routine
1287 NULLIFY(routine%NEXT_ROUTINE)
1289 routine%NUMBER_OF_INVOCATIONS=0
1290 routine%TOTAL_INCLUSIVE_CPU_TIME=0.0_sp
1291 routine%TOTAL_INCLUSIVE_SYSTEM_TIME=0.0_sp
1292 routine%TOTAL_EXCLUSIVE_CPU_TIME=0.0_sp
1293 routine%TOTAL_EXCLUSIVE_SYSTEM_TIME=0.0_sp
1294 DO i=2,
SIZE(routine_list,1)
1295 ALLOCATE(routine,stat=err)
1296 IF(err/=0)
CALL flagerror(
"Could not allocate routine list item.",err,error,*999)
1297 routine%NAME=routine_list(i)
1298 NULLIFY(routine%NEXT_ROUTINE)
1299 previous_routine%NEXT_ROUTINE=>routine
1300 previous_routine=>routine
1301 routine%NUMBER_OF_INVOCATIONS=0
1302 routine%TOTAL_INCLUSIVE_CPU_TIME=0.0_sp
1303 routine%TOTAL_INCLUSIVE_CPU_TIME=0.0_sp
1304 routine%TOTAL_EXCLUSIVE_CPU_TIME=0.0_sp
1305 routine%TOTAL_EXCLUSIVE_CPU_TIME=0.0_sp
1308 CALL flagerror(
"Invalid timing type.",err,error,*999)
1314 exits(
"TIMING_SET_ON")
1321 DO WHILE(
ASSOCIATED(routine))
1322 next_routine=>routine%NEXT_ROUTINE
1324 routine=>next_routine
1331 errorsexits(
"TIMING_SET_ON",err,error)
1343 INTEGER(INTG),
INTENT(OUT) :: ERR
1348 NULLIFY(routine_ptr)
1350 enters(
"TIMING_SUMMARY_OUTPUT",err,error,*999)
1353 WRITE(
op_string,
'("*** Timing Summary: ")')
1356 DO WHILE(
ASSOCIATED(routine_ptr))
1357 WRITE(
op_string,
'("*** Routine : ",A)')
trim(routine_ptr%NAME)
1359 WRITE(
op_string,
'("*** Number of invocations: ",I10)') routine_ptr%NUMBER_OF_INVOCATIONS
1361 WRITE(
op_string,
'("*** Routine times: Total Exclusive Total Inclusive Average Exclusive Average Inclusive")')
1363 IF(routine_ptr%NUMBER_OF_INVOCATIONS==0)
THEN 1364 WRITE(
op_string,
'("*** CPU (s): ",E14.6," ",E14.6," ",E14.6," ",E14.6)') &
1365 & routine_ptr%TOTAL_EXCLUSIVE_CPU_TIME,routine_ptr%TOTAL_INCLUSIVE_CPU_TIME, &
1366 &
REAL(ROUTINE_PTR%NUMBER_OF_INVOCATIONS,SP),
REAL(routine_ptr%number_of_invocations,
sp)
1368 WRITE(
op_string,
'("*** System (s): ",E14.6," ",E14.6," ",E14.6," ",E14.6)') &
1369 & routine_ptr%TOTAL_EXCLUSIVE_SYSTEM_TIME,routine_ptr%TOTAL_INCLUSIVE_SYSTEM_TIME, &
1370 &
REAL(ROUTINE_PTR%NUMBER_OF_INVOCATIONS,SP),
REAL(routine_ptr%number_of_invocations,
sp)
1373 WRITE(
op_string,
'("*** CPU (s): ",E14.6," ",E14.6," ",E14.6," ",E14.6)') &
1374 & routine_ptr%TOTAL_EXCLUSIVE_CPU_TIME,routine_ptr%TOTAL_INCLUSIVE_CPU_TIME, &
1375 & routine_ptr%TOTAL_EXCLUSIVE_CPU_TIME/
REAL(ROUTINE_PTR%NUMBER_OF_INVOCATIONS,SP), &
1376 & ROUTINE_PTR%TOTAL_INCLUSIVE_CPU_TIME/REAL(ROUTINE_PTR%NUMBER_OF_INVOCATIONS,SP)
1378 WRITE(
op_string,
'("*** System (s): ",E14.6," ",E14.6," ",E14.6," ",E14.6)') &
1379 & routine_ptr%TOTAL_EXCLUSIVE_SYSTEM_TIME,routine_ptr%TOTAL_INCLUSIVE_SYSTEM_TIME, &
1380 & routine_ptr%TOTAL_EXCLUSIVE_SYSTEM_TIME/
REAL(ROUTINE_PTR%NUMBER_OF_INVOCATIONS,SP), &
1381 & ROUTINE_PTR%TOTAL_INCLUSIVE_SYSTEM_TIME/REAL(ROUTINE_PTR%NUMBER_OF_INVOCATIONS,SP)
1384 routine_ptr=>routine_ptr%NEXT_ROUTINE
1387 CALL flagerror(
"Timing is not on.",err,error,*999)
1390 exits(
"TIMING_SUMMARY_OUTPUT")
1392 999 errorsexits(
"TIMING_SUMMARY_OUTPUT",err,error)
1404 INTEGER(INTG),
INTENT(INOUT) :: err
1407 INTEGER(INTG) :: endPosition,errorStringLength,indent,lastSpacePosition,localErr,position,startStringLength
1408 CHARACTER(LEN=MAXSTRLEN) :: indentString=
">>" 1409 CHARACTER(LEN=MAXSTRLEN) :: startString
1414 WRITE(startstring,
'(A,A,I0,A,X,I0,A)') indentstring(1:indent),
"ERROR (",
my_computational_node_number,
"):", &
1416 startstringlength=
len_trim(startstring)
1418 WRITE(startstring,
'(A,A,X,I0,A)') indentstring(1:indent),
"ERROR: ",err,
":" 1419 startstringlength=
len_trim(startstring)
1422 errorstringlength=position-1
1423 localerror=
extract(error,1,errorstringlength)
1425 endPosition=MAX_OUTPUT_WIDTH-startStringLength-1
1426 lastspaceposition=
index(
extract(localerror,1,endposition),
" ",back=.true.)
1427 IF(lastspaceposition/=0) endposition=lastspaceposition-1
1428 WRITE(
op_string,
'(A,X,A)') startstring(1:startstringlength),
char(
extract(localerror,1,endposition))
1431 errorstringlength=
len_trim(localerror)
1434 WRITE(
op_string,
'(A,X,A)') startstring(1:startstringlength),
char(localerror)
1437 localerror=
remove(error,1,position)
1441 DO WHILE(position/=0)
1445 localerror=
remove(error,1,position)
1471 INTEGER(INTG),
INTENT(IN) :: ID
1472 INTEGER(INTG),
INTENT(OUT) :: ERR
1473 TYPE(varying_string),
INTENT(OUT) :: ERROR
1475 INTEGER(INTG) :: END_LINE(
max_output_lines),i,j,LENGTH,NUMBER_BLANKS,NUMBER_RECORDS
1478 SELECT CASE(machine_os)
1485 CASE(irix_os,linux_os,aix_os)
1492 number_blanks=number_blanks+1
1497 number_records=i-number_blanks
1505 CALL flagerror(
"Operating system not implemented.",err,error,*999)
1508 DO i=1,number_records
1509 END_LINE(i)=LEN_TRIM(OP_STRING(i))
1513 DO i=1,number_records
1525 DO i=1,number_records
1538 DO i=1,number_records
1540 WRITE(*,
'(A)')
op_string(i)(1:end_line(i))
1550 DO i=1,number_records
1551 WRITE(id,
'(A)')
op_string(i)(1:end_line(i))
1558 DO i=1,number_records
1573 SELECT CASE(machine_os)
1575 DO i=1,number_records
1578 CASE(irix_os,linux_os,aix_os)
1579 DO i=1,number_records
1585 DO i=1,number_records
1589 CALL flagerror(
"Operating system not implemented.",err,error,*999)
1593 999 errorsexits(
"WRITE_STR",err,error)
subroutine, public output_set_on(ECHO_FILENAME, ERR, ERROR,)
Sets writes file echo output on.
subroutine extract_error_message_c(ERROR_MESSAGE, ERR, ERROR,)
Extracts the error message from a CMISS error string and returns it as a character array...
logical, save, public diagnostics4
.TRUE. if level 4 diagnostic output is active in the current routine
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
subroutine, public random_seeds_get(RANDOM_SEEDS, ERR, ERROR,)
Returns the random seeds for CMISS.
integer(intg), parameter, public stop_read_comfile_unit
Last file unit for read command files.
integer(intg), parameter, public all_timing_type
Type for setting timing output in all routines.
logical, save diagnostics_level5
.TRUE. if the user has requested level 5 diagnostic output to be active
logical, save diagnostics_level4
.TRUE. if the user has requested level 4 diagnostic output to be active
integer(intg), dimension(:), allocatable, public cmiss_random_seeds
The current error handling seeds for OpenCMISS.
logical, save diag_from_subroutine
.TRUE. if diagnostic output is required from a particular routine
integer(intg), parameter linux_os
Linux operating system type.
integer(intg), parameter, public help_output_type
Help output type.
integer(intg), parameter, public learn_file_unit
File unit for learn files.
subroutine, public output_set_off(ERR, ERROR,)
Sets writes file echo output off.
integer(intg), parameter, public io5_file_unit
File unit for general IO 5 files.
type(routine_stack_type), save routine_stack
The routime invocation stack.
subroutine, public diagnostics_set_on(DIAG_TYPE, LEVEL_LIST, DIAG_FILENAME, ROUTINE_LIST, ERR, ERROR,)
Sets diagnositics on.
logical, save diag_file_open
.TRUE. if the diagnostic output file is open
Contains information for an item in the routine invocation stack.
subroutine, public write_str(ID, ERR, ERROR,)
Writes the output string to a specified output stream.
Flags a warning to the user.
integer(intg), parameter machine_os
Contains information for an item in the routine list for diagnostics or timing.
logical, save diagnostics_level2
.TRUE. if the user has requested level 2 diagnostic output to be active
Flags a warning to the user.
integer(intg), parameter warning_output_type
Warning output type.
subroutine, public timing_summary_output(ERR, ERROR,)
Outputs the timing summary.
Flags a warning to the user.
logical, save, public diagnostics2
.TRUE. if level 2 diagnostic output is active in the current routine
subroutine extract_error_message_vs(ERROR_MESSAGE, ERR, ERROR,)
Extracts the error message from a CMISS error string and returns it as a varying string.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
integer(intg), parameter max_output_width
Maximum width of output line.
logical, save timing_from_subroutine
.TRUE. if timing output is required from a particular routine
This module contains all program wide constants.
Flags a warning to the user.
subroutine flag_warning_vs(STRING, ERR, ERROR,)
Writes a warning message specified by a varying string to the user.
real(sp) loose_tolerance_sp
The loose tolerance for single precision convergence calculations. Loose tolerance is to be used in t...
integer(intg), parameter, public in_timing_type
Type for setting timing output in one routine.
logical, save diagnostics_level3
.TRUE. if the user has requested level 3 diagnostic output to be active
integer(intg), parameter, public from_timing_type
Type for setting timing output from one routine downwards.
subroutine flag_error_c(STRING, ERR, ERROR,)
Sets the error string specified by a character string and flags an error.
type(routine_list_type), save diag_routine_list
The list of routines for which diagnostic output is required.
integer(intg), parameter maxstrlen
Maximum string length fro character strings.
logical, save, public diagnostics3
.TRUE. if level 3 diagnostic output is active in the current routine
integer(intg), parameter, public io2_file_unit
File unit for general IO 2 files.
logical, save diag_all_subroutines
.TRUE. if diagnostic output is required in all routines
integer(intg), parameter, public from_diag_type
Type for setting diagnostic output from one routine downwards.
subroutine, public exits(NAME)
Records the exit out of the named procedure.
integer(intg), parameter windows_os
Windows operating system type.
integer(intg), parameter max_output_lines
Maximum number of lines that can be output.
integer(intg), parameter irix_os
IRIX operating system type.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
integer(intg), parameter, public general_output_type
General output type.
logical, save diag_or_timing
.TRUE. if diagnostics or time is .TRUE.
subroutine, public computational_node_numbers_set(MY_NODE_NUMBER, NUMBER_OF_NODES, ERR, ERROR,)
Set the computational node numbers. Note: this is done as a subroutine as COMPUTATIONAL_ENVIRONMENT d...
subroutine, public base_routines_finalise(ERR, ERROR,)
Finalises the base_routines module and deallocates all memory.
subroutine flag_warning_c(STRING, ERR, ERROR,)
Writes a warning message specified by a character string to the user.
subroutine, public diagnostics_set_off(ERR, ERROR,)
Sets diagnositics off.
Contains information for the routine invocation stack.
type(routine_list_type), save timing_routine_list
The list of routines for which timing output is required.
integer, parameter sp
Single precision real kind.
integer(intg), parameter, public io3_file_unit
File unit for general IO 3 files.
logical, save timing_all_subroutines
.TRUE. if timing output is required in all routines
integer(intg), parameter echo_file_unit
File unit for echo files.
logical, save timing
.TRUE. if timing output is required in any routines.
integer(intg), save my_computational_node_number
The computational rank for this node.
subroutine, public timing_set_off(ERR, ERROR,)
Sets timing off.
subroutine, public writeerror(err, error,)
Writes the error string.
subroutine, public base_routines_initialise(ERR, ERROR,)
Initialises the variables required for the base_routines module.
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
character(len=1), parameter error_separator_constant
logical, save diagnostics
.TRUE. if diagnostic output is required in any routines.
logical, save timing_file_open
.TRUE. if the timing output file is open
logical, save, public diagnostics5
.TRUE. if level 5 diagnostic output is active in the current routine
integer(intg), parameter, public in_diag_type
Type for setting diagnostic output in one routine.
integer(intg), parameter, public io4_file_unit
File unit for general IO 4 files.
subroutine flag_error_vs(STRING, ERR, ERROR,)
Sets the error string specified by a varying string and flags an error.
subroutine, public random_seeds_size_get(RANDOM_SEEDS_SIZE, ERR, ERROR,)
Returns the size of the random seeds array for CMISS.
logical, save diagnostics_level1
.TRUE. if the user has requested level 1 diagnostic output to be active
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
real(dp) loose_tolerance
The loose tolerance for double precision convergence calculations. Loose tolerance is to be used in t...
integer(intg), parameter, public temporary_file_unit
File unit for temporary files.
integer(intg), parameter, public all_diag_type
Type for setting diagnostic output in all routines.
integer(intg), parameter vms_os
VMS operating system type.
integer(intg), parameter, public io1_file_unit
File unit for general IO 1 files.
integer(intg), parameter, public open_comfile_unit
File unit for open command files.
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
integer(intg), parameter, public timing_output_type
Timing output type.
integer(intg), parameter, public start_read_comfile_unit
First file unit for read command files.
integer(intg), parameter aix_os
AIX operating system type.
integer(intg), parameter timing_file_unit
File unit for timing files.
Contains information for the routine list for diagnostics or timing.
logical, save timing_summary
.TRUE. if timing output will be summary form via a TIMING_SUMMARY_OUTPUT call otherwise timing will b...
Flags an error condition.
subroutine, public timing_set_on(TIMING_TYPE, TIMING_SUMMARY_FLAG, TIMING_FILENAME, ROUTINE_LIST, ERR, ERROR,)
Sets timing on.
character(len=maxstrlen), dimension(max_output_lines), save, public op_string
The array of lines to output.
This module contains all machine dependent constants for AIX systems.
Flags an error condition.
subroutine, public random_seeds_set(RANDOM_SEEDS, ERR, ERROR,)
Sets the random seeds for cmiss.
integer(intg), save number_of_computational_nodes
The number of computational nodes.
integer(intg), parameter diagnostics_file_unit
File unit for diagnostic files.
integer(intg), parameter, public error_output_type
Error output type.
This module contains all kind definitions.
logical, save echo_output
.TRUE. if all output is to be echoed to the echo file