| 11 | | |
| 12 | | PROGRAM VboxCrusher |
| 13 | | real*8, allocatable:: arr(:,:) |
| 14 | | character :: fileName*32='fileN' |
| 15 | | real time1, time2 |
| 16 | | |
| 17 | | allocate (arr(1250,100000),stat=ierr) |
| 18 | | if(ierr.gt.0) then |
| 19 | | Print*,'Can not allocate 10GB array' |
| 20 | | goto 1000 |
| 21 | | endif |
| 22 | | |
| 23 | | 100 Print*,'Number of 1 GB files to create (1-99). Hit Enter. Use 0 to Stop:' |
| 24 | | Read(*,*) nFiles |
| 25 | | if(nfiles.le.0) goto 1000 |
| 26 | | |
| 27 | | if(nfiles.GT.99) then |
| 28 | | Print*,'Number of files has to be between 1 and 99' |
| 29 | | goto 100 |
| 30 | | endif |
| 31 | | |
| 32 | | Print*,'This may take some time on slow media. NVMe drives reach speeds ~3-6 GB/s ' |
| 33 | | do i=1,nfiles |
| 34 | | write(fileName(6:7),'(i2.2)',err=900) i |
| 35 | | Open (11, file=fileName, form='unformatted', err=900) |
| 36 | | print*,' Creating fileN=', i |
| 37 | | CALL CPU_TIME(TIME1) |
| 38 | | write(11, err=910) Arr |
| 39 | | CALL CPU_TIME(TIME2) |
| 40 | | close(11) |
| 41 | | print*,' Created fileN=', i,' Speed GB/s :', 10./(time2-time1 + 1.e-10) |
| 42 | | enddo |
| 43 | | print*,' Success' |
| 44 | | goto 1000 |
| 45 | | |
| 46 | | !.............................................. |
| 47 | | !...Info if the run fails |
| 48 | | 900 if(i.eq.1) print*,'Can not open file by some reason (file already opened by some other program)' |
| 49 | | if(i.gt.1) print*,'Can not open next file by some reason (disk full?)' |
| 50 | | goto 1000 |
| 51 | | 910 print*,'Can not write into file (disk full?)' |
| 52 | | close(11,err=1000) |
| 53 | | !.............................................. |
| 54 | | |
| 55 | | 1000 continue |
| 56 | | END Program |