@@ -1015,6 +1015,17 @@ subroutine parse_grid(cgrid,ndgl,nloen)
1015
1015
1016
1016
! ===================================================================================================
1017
1017
1018
+ subroutine str2int (str , int , stat )
1019
+
1020
+ character (len=* ), intent (in ) :: str
1021
+ integer , intent (out ) :: int
1022
+ integer , intent (out ) :: stat
1023
+ read (str, * , iostat= stat) int
1024
+
1025
+ end subroutine str2int
1026
+
1027
+ ! ===================================================================================================
1028
+
1018
1029
function get_int_value (cname , iarg ) result(value)
1019
1030
1020
1031
integer :: value
@@ -1051,6 +1062,80 @@ function get_str_value(cname, iarg) result(value)
1051
1062
1052
1063
! ===================================================================================================
1053
1064
1065
+ subroutine print_help (unit )
1066
+
1067
+ integer , optional :: unit
1068
+ integer :: nout = 6
1069
+ if (present (unit)) then
1070
+ nout = unit
1071
+ endif
1072
+
1073
+ write (nout, " (a)" ) " "
1074
+
1075
+ if (jprb == jprd) then
1076
+ write (nout, " (a)" ) " NAME ectrans-benchmark-" // VERSION // " -dp"
1077
+ else
1078
+ write (nout, " (a)" ) " NAME ectrans-benchmark-" // VERSION // " -sp"
1079
+ end if
1080
+ write (nout, " (a)" ) " "
1081
+
1082
+ write (nout, " (a)" ) " DESCRIPTION"
1083
+ write (nout, " (a)" ) " This program tests ecTrans by transforming fields back and forth&
1084
+ & between spectral "
1085
+ if (jprb == jprd) then
1086
+ write (nout, " (a)" ) " space and grid-point space (double-precision version)"
1087
+ else
1088
+ write (nout, " (a)" ) " space and grid-point space (single-precision version)"
1089
+ end if
1090
+ write (nout, " (a)" ) " "
1091
+
1092
+ write (nout, " (a)" ) " USAGE"
1093
+ if (jprb == jprd) then
1094
+ write (nout, " (a)" ) " ectrans-benchmark-" // VERSION // " -dp [options]"
1095
+ else
1096
+ write (nout, " (a)" ) " ectrans-benchmark-" // VERSION // " -sp [options]"
1097
+ end if
1098
+ write (nout, " (a)" ) " "
1099
+
1100
+ write (nout, " (a)" ) " OPTIONS"
1101
+ write (nout, " (a)" ) " -h, --help Print this message"
1102
+ write (nout, " (a)" ) " -v Run with verbose output"
1103
+ write (nout, " (a)" ) " -t, --truncation T Run with this triangular spectral truncation&
1104
+ & (default = 79)"
1105
+ write (nout, " (a)" ) " -g, --grid GRID Run with this grid. Possible values: O<N>, F<N>"
1106
+ write (nout, " (a)" ) " If not specified, O<N> is used with N=truncation+1&
1107
+ & (cubic relation)"
1108
+ write (nout, " (a)" ) " -n, --niter NITER Run for this many inverse/direct transform&
1109
+ & iterations (default = 10)"
1110
+ write (nout, " (a)" ) " --niter-warmup Number of warm up iterations,&
1111
+ & for which timing statistics should be ignored (default = 3)"
1112
+ write (nout, " (a)" ) " -f, --nfld NFLD Number of scalar fields (default = 1)"
1113
+ write (nout, " (a)" ) " -l, --nlev NLEV Number of vertical levels (default = 1)"
1114
+ write (nout, " (a)" ) " --vordiv Also transform vorticity-divergence to wind"
1115
+ write (nout, " (a)" ) " --scders Compute scalar derivatives (default off)"
1116
+ write (nout, " (a)" ) " --uvders Compute uv East-West derivatives (default off). Only&
1117
+ & when also --vordiv is given"
1118
+ write (nout, " (a)" ) " --flt Run with fast Legendre transforms (default off)"
1119
+ write (nout, " (a)" ) " --nproma NPROMA Run with NPROMA (default no blocking: NPROMA=ngptot)"
1120
+ write (nout, " (a)" ) " --norms Calculate and print spectral norms of transformed&
1121
+ & fields"
1122
+ write (nout, " (a)" ) " The computation of spectral norms will skew overall&
1123
+ & timings"
1124
+ write (nout, " (a)" ) " --meminfo Show diagnostic information from FIAT's ec_meminfo&
1125
+ & subroutine on memory usage, thread-binding etc."
1126
+ write (nout, " (a)" ) " --nprtrv Size of V set in spectral decomposition"
1127
+ write (nout, " (a)" ) " --nprtrw Size of W set in spectral decomposition"
1128
+ write (nout, " (a)" ) " -c, --check VALUE The multiplier of the machine epsilon used as a&
1129
+ & tolerance for correctness checking"
1130
+ write (nout, " (a)" ) " "
1131
+ write (nout, " (a)" ) " DEBUGGING"
1132
+ write (nout, " (a)" ) " --dump-values Output gridpoint fields in unformatted binary file"
1133
+ write (nout, " (a)" ) " "
1134
+
1135
+ end subroutine print_help
1136
+
1137
+ ! ===================================================================================================
1138
+
1054
1139
subroutine parsing_failed (message )
1055
1140
1056
1141
character (len=* ), intent (in ) :: message
@@ -1069,8 +1154,9 @@ subroutine parsing_failed(message)
1069
1154
subroutine get_command_line_arguments (nsmax , cgrid , iters , iters_warmup , nfld , nlev , lvordiv , lscders , luvders , &
1070
1155
& luseflt , nopt_mem_tr , nproma , verbosity , ldump_values , lprint_norms , &
1071
1156
& lmeminfo , nprtrv , nprtrw , ncheck )
1157
+
1072
1158
#ifdef _OPENACC
1073
- use openacc
1159
+ use openacc, only: acc_init, acc_get_device_type
1074
1160
#endif
1075
1161
1076
1162
integer , intent (inout ) :: nsmax ! Spectral truncation
@@ -1170,16 +1256,6 @@ function cubic_octahedral_gaussian_grid(nsmax) result(cgrid)
1170
1256
1171
1257
end function
1172
1258
1173
- ! ===================================================================================================
1174
-
1175
- subroutine str2int (str , int , stat )
1176
-
1177
- character (len=* ), intent (in ) :: str
1178
- integer , intent (out ) :: int
1179
- integer , intent (out ) :: stat
1180
- read (str, * , iostat= stat) int
1181
-
1182
- end subroutine str2int
1183
1259
1184
1260
! ===================================================================================================
1185
1261
@@ -1219,80 +1295,6 @@ end function get_median
1219
1295
1220
1296
! ===================================================================================================
1221
1297
1222
- subroutine print_help (unit )
1223
-
1224
- integer , optional :: unit
1225
- integer :: nout = 6
1226
- if (present (unit)) then
1227
- nout = unit
1228
- endif
1229
-
1230
- write (nout, " (a)" ) " "
1231
-
1232
- if (jprb == jprd) then
1233
- write (nout, " (a)" ) " NAME ectrans-benchmark-" // VERSION // " -dp"
1234
- else
1235
- write (nout, " (a)" ) " NAME ectrans-benchmark-" // VERSION // " -sp"
1236
- end if
1237
- write (nout, " (a)" ) " "
1238
-
1239
- write (nout, " (a)" ) " DESCRIPTION"
1240
- write (nout, " (a)" ) " This program tests ecTrans by transforming fields back and forth&
1241
- & between spectral "
1242
- if (jprb == jprd) then
1243
- write (nout, " (a)" ) " space and grid-point space (double-precision version)"
1244
- else
1245
- write (nout, " (a)" ) " space and grid-point space (single-precision version)"
1246
- end if
1247
- write (nout, " (a)" ) " "
1248
-
1249
- write (nout, " (a)" ) " USAGE"
1250
- if (jprb == jprd) then
1251
- write (nout, " (a)" ) " ectrans-benchmark-" // VERSION // " -dp [options]"
1252
- else
1253
- write (nout, " (a)" ) " ectrans-benchmark-" // VERSION // " -sp [options]"
1254
- end if
1255
- write (nout, " (a)" ) " "
1256
-
1257
- write (nout, " (a)" ) " OPTIONS"
1258
- write (nout, " (a)" ) " -h, --help Print this message"
1259
- write (nout, " (a)" ) " -v Run with verbose output"
1260
- write (nout, " (a)" ) " -t, --truncation T Run with this triangular spectral truncation&
1261
- & (default = 79)"
1262
- write (nout, " (a)" ) " -g, --grid GRID Run with this grid. Possible values: O<N>, F<N>"
1263
- write (nout, " (a)" ) " If not specified, O<N> is used with N=truncation+1&
1264
- & (cubic relation)"
1265
- write (nout, " (a)" ) " -n, --niter NITER Run for this many inverse/direct transform&
1266
- & iterations (default = 10)"
1267
- write (nout, " (a)" ) " --niter-warmup Number of warm up iterations,&
1268
- & for which timing statistics should be ignored (default = 3)"
1269
- write (nout, " (a)" ) " -f, --nfld NFLD Number of scalar fields (default = 1)"
1270
- write (nout, " (a)" ) " -l, --nlev NLEV Number of vertical levels (default = 1)"
1271
- write (nout, " (a)" ) " --vordiv Also transform vorticity-divergence to wind"
1272
- write (nout, " (a)" ) " --scders Compute scalar derivatives (default off)"
1273
- write (nout, " (a)" ) " --uvders Compute uv East-West derivatives (default off). Only&
1274
- & when also --vordiv is given"
1275
- write (nout, " (a)" ) " --flt Run with fast Legendre transforms (default off)"
1276
- write (nout, " (a)" ) " --nproma NPROMA Run with NPROMA (default no blocking: NPROMA=ngptot)"
1277
- write (nout, " (a)" ) " --norms Calculate and print spectral norms of transformed&
1278
- & fields"
1279
- write (nout, " (a)" ) " The computation of spectral norms will skew overall&
1280
- & timings"
1281
- write (nout, " (a)" ) " --meminfo Show diagnostic information from FIAT's ec_meminfo&
1282
- & subroutine on memory usage, thread-binding etc."
1283
- write (nout, " (a)" ) " --nprtrv Size of V set in spectral decomposition"
1284
- write (nout, " (a)" ) " --nprtrw Size of W set in spectral decomposition"
1285
- write (nout, " (a)" ) " -c, --check VALUE The multiplier of the machine epsilon used as a&
1286
- & tolerance for correctness checking"
1287
- write (nout, " (a)" ) " "
1288
- write (nout, " (a)" ) " DEBUGGING"
1289
- write (nout, " (a)" ) " --dump-values Output gridpoint fields in unformatted binary file"
1290
- write (nout, " (a)" ) " "
1291
-
1292
- end subroutine print_help
1293
-
1294
- ! ===================================================================================================
1295
-
1296
1298
subroutine initialize_spectral_arrays (nsmax , zsp , sp3d )
1297
1299
1298
1300
integer , intent (in ) :: nsmax ! Spectral truncation
0 commit comments