- Timestamp:
- 01/20/18 18:46:10 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/src/unstructured/data_unstructured.F90
r663 r665 58 58 !---------------------------- PROFILING -------------------------- 59 59 60 SUBROUTINE init_trace() 60 SUBROUTINE init_trace() BINDC(init_trace) 61 !$OMP MASTER 61 62 time_spent(:)=0. 62 63 bytes(:)=0 63 64 nb_calls(:)=0 65 !$OMP END MASTER 64 66 END SUBROUTINE init_trace 65 67 … … 67 69 INTEGER :: id 68 70 DBL :: total_spent 71 !$OMP MASTER 69 72 total_spent=SUM(time_spent) 70 PRINT *, '========================= Performance metrics =========================' 71 PRINT *, 'Total time spent in instrumented code (seconds) :', total_spent 72 PRINT *, 'Name, #calls, %time, microsec/call, MB/sec' 73 DO id=1,nb_routines 74 IF(nb_calls(id)>0) PRINT *, id_name(id), nb_calls(id), INT(100.*time_spent(id)/total_spent), & 75 INT(1e6*time_spent(id)/nb_calls(id)), INT(1e-6*bytes(id)/time_spent(id)) 76 END DO 77 CALL init_trace() 73 IF(total_spent>.01) THEN 74 PRINT *, '========================= Performance metrics =========================' 75 PRINT *, 'Total time spent in instrumented code (seconds) :', total_spent 76 PRINT *, 'Name, #calls, %time, microsec/call, MB/sec' 77 DO id=1,nb_routines 78 IF(nb_calls(id)>0) PRINT *, id_name(id), nb_calls(id), INT(100.*time_spent(id)/total_spent), & 79 INT(1e6*time_spent(id)/nb_calls(id)), INT(1e-6*bytes(id)/time_spent(id)) 80 END DO 81 CALL init_trace() 82 END IF 83 !$OMP END MASTER 78 84 END SUBROUTINE print_trace 79 85 80 86 SUBROUTINE enter_trace(id, nbytes) 81 87 INTEGER :: id, nbytes 88 !$OMP MASTER 82 89 current_id = id 83 90 bytes(id) = bytes(id) + nbytes 84 91 nb_calls(id)=nb_calls(id)+1 85 92 start_time = OMP_GET_WTIME() 93 !$OMP END MASTER 86 94 END SUBROUTINE enter_trace 87 95 88 96 SUBROUTINE exit_trace() 89 97 DBL :: elapsed 98 !$OMP MASTER 90 99 elapsed = OMP_GET_WTIME()-start_time 91 100 IF(elapsed<0.) elapsed=0. 92 101 time_spent(current_id) = time_spent(current_id) + elapsed 102 !$OMP END MASTER 93 103 END SUBROUTINE exit_trace 94 104
Note: See TracChangeset
for help on using the changeset viewer.