Changeset 759 for palm/trunk/SOURCE/parin.f90
- Timestamp:
- Sep 15, 2011 1:58:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/parin.f90
r684 r759 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! +maximum_parallel_io_streams in envpar, 7 ! splitting of parallel I/O in blocks of PEs 7 8 ! 8 9 ! Former revisions: … … 117 118 IMPLICIT NONE 118 119 119 INTEGER :: i dum120 INTEGER :: i, idum 120 121 121 122 … … 183 184 dt_run_control,end_time, force_print_header, mask_scale_x, & 184 185 mask_scale_y, mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop, & 185 mask_y_loop, mask_z_loop, netcdf_data_format, & 186 normalizing_region, npex, npey, nz_do3d, & 187 precipitation_amount_interval, profile_columns, profile_rows, & 188 restart_time, section_xy, section_xz, section_yz, & 189 skip_time_data_output, skip_time_data_output_av, skip_time_dopr, & 190 skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz, & 191 skip_time_do3d, skip_time_domask, synchronous_exchange, & 192 termination_time_needed, use_prior_plot1d_parameters, z_max_do1d, & 193 z_max_do1d_normalized, z_max_do2d 194 195 196 NAMELIST /envpar/ host, local_dvrserver_running, maximum_cpu_time_allowed, & 197 revision, return_addres, return_username, run_identifier, & 198 tasks_per_node, write_binary 199 200 ! 201 !-- Open the NAMELIST-file which is send with this job 202 CALL check_open( 11 ) 203 204 ! 205 !-- Read the control parameters for initialization. 206 !-- The namelist "inipar" must be provided in the NAMELIST-file. If this is 207 !-- not the case and the file contains - instead of "inipar" - any other 208 !-- namelist, a read error is created on t3e and control is transferred 209 !-- to the statement with label 10. Therefore, on t3e machines one can not 210 !-- distinguish between errors produced by a wrong "inipar" namelist or 211 !-- because this namelist is totally missing. 212 READ ( 11, inipar, ERR=10, END=11 ) 213 GOTO 12 214 10 message_string = 'errors in \$inipar &or no \$inipar-namelist ' // & 215 'found (CRAY-machines only)' 216 CALL message( 'parin', 'PA0271', 1, 2, 0, 6, 0 ) 217 218 11 message_string = 'no \$inipar-namelist found' 219 CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 ) 220 221 ! 222 !-- If required, read control parameters from restart file (produced by 223 !-- a prior run). All PEs are reading from file created by PE0 (see check_open) 224 12 IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN 225 226 CALL read_var_list 227 ! 228 !-- The restart file will be reopened when reading the subdomain data 229 CALL close_file( 13 ) 230 231 ! 232 !-- Increment the run count 233 runnr = runnr + 1 234 235 ENDIF 236 237 ! 238 !-- Definition of names of areas used for computing statistics. They must 239 !-- be defined at this place, because they are allowed to be redefined by 240 !-- the user in user_parin. 241 region = 'total domain' 242 243 ! 244 !-- Read runtime parameters given by the user for this run (namelist "d3par"). 245 !-- The namelist "d3par" can be omitted. In that case, default values are 246 !-- used for the parameters. 247 READ ( 11, d3par, END=20 ) 248 249 ! 250 !-- Read control parameters for optionally used model software packages 251 20 CALL package_parin 252 253 ! 254 !-- Read user-defined variables 255 CALL user_parin 256 257 ! 258 !-- Check in case of initial run, if the grid point numbers are well defined 259 !-- and allocate some arrays which are already needed in init_pegrid or 260 !-- check_parameters. During restart jobs, these arrays will be allocated 261 !-- in read_var_list. All other arrays are allocated in init_3d_model. 262 IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 263 264 IF ( nx <= 0 ) THEN 265 WRITE( message_string, * ) 'no value or wrong value given for nx: ',& 266 'nx=', nx 267 CALL message( 'parin', 'PA0273', 1, 2, 0, 6, 0 ) 268 ENDIF 269 IF ( ny <= 0 ) THEN 270 WRITE( message_string, * ) 'no value or wrong value given for ny: ',& 271 'ny=', ny 272 CALL message( 'parin', 'PA0274', 1, 2, 0, 6, 0 ) 273 ENDIF 274 IF ( nz <= 0 ) THEN 275 WRITE( message_string, * ) 'no value or wrong value given for nz: ',& 276 'nz=', nz 277 CALL message( 'parin', 'PA0275', 1, 2, 0, 6, 0 ) 278 ENDIF 279 ! 280 !-- ATTENTION: in case of changes to the following statement please also 281 !-- check the allocate statement in routine read_var_list 282 ALLOCATE( lad(0:nz+1),pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1), & 283 ug(0:nz+1), u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1), & 284 hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions), & 285 hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) ) 286 287 hom = 0.0 288 289 ENDIF 290 291 ! 292 !-- NAMELIST-file is not needed anymore 293 CALL close_file( 11 ) 294 295 ! 296 !-- Read values of environment variables (this NAMELIST file is generated by 297 !-- mrun) 186 mask_y_loop, mask_z_loop, netcdf_data_format, normalizing_region, & 187 npex, npey, nz_do3d, precipitation_amount_interval, & 188 profile_columns, profile_rows, restart_time, section_xy, & 189 section_xz, section_yz, skip_time_data_output, & 190 skip_time_data_output_av, skip_time_dopr, skip_time_do2d_xy, & 191 skip_time_do2d_xz, skip_time_do2d_yz, skip_time_do3d, & 192 skip_time_domask, synchronous_exchange, termination_time_needed, & 193 use_prior_plot1d_parameters, z_max_do1d, z_max_do1d_normalized, & 194 z_max_do2d 195 196 197 NAMELIST /envpar/ host, local_dvrserver_running, maximum_cpu_time_allowed,& 198 maximum_parallel_io_streams, revision, return_addres, & 199 return_username, run_identifier, tasks_per_node, & 200 write_binary 201 202 ! 203 !-- First read values of environment variables (this NAMELIST file is 204 !-- generated by mrun) 298 205 OPEN ( 90, FILE='ENVPAR', STATUS='OLD', FORM='FORMATTED', ERR=30 ) 299 206 READ ( 90, envpar, ERR=31, END=32 ) 300 207 CLOSE ( 90 ) 208 209 ! 210 !-- Calculate the number of groups into which parallel I/O is split. 211 !-- The default for files which are opened by all PEs (or where each 212 !-- PE opens his own independent file) is, that all PEs are doing input/output 213 !-- in parallel at the same time. This might cause performance or even more 214 !-- severe problems depending on the configuration of the underlying file 215 !-- system. 216 !-- First, set the default: 217 IF ( maximum_parallel_io_streams == -1 .OR. & 218 maximum_parallel_io_streams > numprocs ) THEN 219 maximum_parallel_io_streams = numprocs 220 ENDIF 221 ! 222 !-- Now calculate the number of io_blocks and the io_group to which the 223 !-- respective PE belongs. I/O of the groups is done in serial, but in parallel 224 !-- for all PEs belonging to the same group. 225 !-- These settings are repeated in init_pegrid for the communicator comm2d, 226 !-- which is not available here 227 io_blocks = numprocs / maximum_parallel_io_streams 228 io_group = MOD( myid+1, io_blocks ) 229 230 ! 231 !-- Data is read in parallel by groups of PEs 232 DO i = 0, io_blocks-1 233 IF ( i == io_group ) THEN 234 235 ! 236 !-- Open the NAMELIST-file which is send with this job 237 CALL check_open( 11 ) 238 239 ! 240 !-- Read the control parameters for initialization. 241 !-- The namelist "inipar" must be provided in the NAMELIST-file. If this 242 !-- is not the case and the file contains - instead of "inipar" - any 243 !-- other namelist, a read error is created on t3e and control is 244 !-- transferred to the statement with label 10. Therefore, on t3e 245 !-- machines one can not distinguish between errors produced by a wrong 246 !-- "inipar" namelist or because this namelist is totally missing. 247 READ ( 11, inipar, ERR=10, END=11 ) 248 GOTO 12 249 10 message_string = 'errors in \$inipar &or no \$inipar-namelist ' // & 250 'found (CRAY-machines only)' 251 CALL message( 'parin', 'PA0271', 1, 2, 0, 6, 0 ) 252 253 11 message_string = 'no \$inipar-namelist found' 254 CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 ) 255 256 ! 257 !-- If required, read control parameters from restart file (produced by 258 !-- a prior run). All PEs are reading from file created by PE0 (see 259 !-- check_open) 260 12 IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN 261 262 CALL read_var_list 263 ! 264 !-- The restart file will be reopened when reading the subdomain data 265 CALL close_file( 13 ) 266 267 ! 268 !-- Increment the run count 269 runnr = runnr + 1 270 271 ENDIF 272 273 ! 274 !-- Definition of names of areas used for computing statistics. They must 275 !-- be defined at this place, because they are allowed to be redefined by 276 !-- the user in user_parin. 277 region = 'total domain' 278 279 ! 280 !-- Read runtime parameters given by the user for this run (namelist 281 !-- "d3par"). The namelist "d3par" can be omitted. In that case, default 282 !-- values are used for the parameters. 283 READ ( 11, d3par, END=20 ) 284 285 ! 286 !-- Read control parameters for optionally used model software packages 287 20 CALL package_parin 288 289 ! 290 !-- Read user-defined variables 291 CALL user_parin 292 293 ! 294 !-- Check in case of initial run, if the grid point numbers are well 295 !-- defined and allocate some arrays which are already needed in 296 !-- init_pegrid or check_parameters. During restart jobs, these arrays 297 !-- will be allocated in read_var_list. All other arrays are allocated 298 !-- in init_3d_model. 299 IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 300 301 IF ( nx <= 0 ) THEN 302 WRITE( message_string, * ) 'no value or wrong value given', & 303 ' for nx: nx=', nx 304 CALL message( 'parin', 'PA0273', 1, 2, 0, 6, 0 ) 305 ENDIF 306 IF ( ny <= 0 ) THEN 307 WRITE( message_string, * ) 'no value or wrong value given', & 308 ' for ny: ny=', ny 309 CALL message( 'parin', 'PA0274', 1, 2, 0, 6, 0 ) 310 ENDIF 311 IF ( nz <= 0 ) THEN 312 WRITE( message_string, * ) 'no value or wrong value given', & 313 ' for nz: nz=', nz 314 CALL message( 'parin', 'PA0275', 1, 2, 0, 6, 0 ) 315 ENDIF 316 ! 317 !-- ATTENTION: in case of changes to the following statement please 318 !-- also check the allocate statement in routine read_var_list 319 ALLOCATE( lad(0:nz+1),pt_init(0:nz+1), q_init(0:nz+1), & 320 sa_init(0:nz+1), ug(0:nz+1), u_init(0:nz+1), & 321 v_init(0:nz+1), vg(0:nz+1), & 322 hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions), & 323 hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) ) 324 325 hom = 0.0 326 327 ENDIF 328 329 ! 330 !-- NAMELIST-file is not needed anymore 331 CALL close_file( 11 ) 332 333 ENDIF 334 #if defined( __parallel ) 335 CALL MPI_BARRIER( MPI_COMM_WORLD, ierr ) 336 #endif 337 ENDDO 338 301 339 RETURN 302 340
Note: See TracChangeset
for help on using the changeset viewer.