IO_error should report to STDERR (otherwise not visible for MPI proc >0)

This commit is contained in:
Martin Diehl 2017-02-12 22:59:14 +01:00
parent 1de49bbc7b
commit 95f7ef8015
2 changed files with 16 additions and 12 deletions

View File

@ -1669,33 +1669,33 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg)
end select end select
!$OMP CRITICAL (write2out) !$OMP CRITICAL (write2out)
write(6,'(/,a)') ' +--------------------------------------------------------+' write(0,'(/,a)') ' +--------------------------------------------------------+'
write(6,'(a)') ' + error +' write(0,'(a)') ' + error +'
write(6,'(a,i3,a)') ' + ',error_ID,' +' write(0,'(a,i3,a)') ' + ',error_ID,' +'
write(6,'(a)') ' + +' write(0,'(a)') ' + +'
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(msg))),',',& write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(msg))),',',&
max(1,60-len(trim(msg))-5),'x,a)' max(1,60-len(trim(msg))-5),'x,a)'
write(6,formatString) '+ ', trim(msg),'+' write(0,formatString) '+ ', trim(msg),'+'
if (present(ext_msg)) then if (present(ext_msg)) then
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(ext_msg))),',',& write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(ext_msg))),',',&
max(1,60-len(trim(ext_msg))-5),'x,a)' max(1,60-len(trim(ext_msg))-5),'x,a)'
write(6,formatString) '+ ', trim(ext_msg),'+' write(0,formatString) '+ ', trim(ext_msg),'+'
endif endif
if (present(el)) then if (present(el)) then
if (present(ip)) then if (present(ip)) then
if (present(g)) then if (present(g)) then
write(6,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' + at element',el,'IP',ip,'grain',g,'+' write(0,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' + at element',el,'IP',ip,'grain',g,'+'
else else
write(6,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' + at element',el,'IP',ip,'+' write(0,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' + at element',el,'IP',ip,'+'
endif endif
else else
write(6,'(a13,1x,i9,35x,a1)') ' + at element',el,'+' write(0,'(a13,1x,i9,35x,a1)') ' + at element',el,'+'
endif endif
elseif (present(ip)) then ! now having the meaning of "instance" elseif (present(ip)) then ! now having the meaning of "instance"
write(6,'(a15,1x,i9,33x,a1)') ' + for instance',ip,'+' write(0,'(a15,1x,i9,33x,a1)') ' + for instance',ip,'+'
endif endif
write(6,'(a)') ' +--------------------------------------------------------+' write(0,'(a)') ' +--------------------------------------------------------+'
flush(6) flush(0)
call quit(9000_pInt+error_ID) call quit(9000_pInt+error_ID)
!$OMP END CRITICAL (write2out) !$OMP END CRITICAL (write2out)

View File

@ -95,6 +95,10 @@ subroutine DAMASK_interface_init()
write(output_unit,'(a)') ' STDOUT != 6' write(output_unit,'(a)') ' STDOUT != 6'
call quit(1_pInt) call quit(1_pInt)
endif endif
if (error_unit /= 0) then
write(output_unit,'(a)') ' STERR != 0'
call quit(1_pInt)
endif
else mainProcess else mainProcess
close(6) ! disable output for non-master processes (open 6 to rank specific file for debug) close(6) ! disable output for non-master processes (open 6 to rank specific file for debug)
open(6,file='/dev/null',status='replace') ! close(6) alone will leave some temp files in cwd open(6,file='/dev/null',status='replace') ! close(6) alone will leave some temp files in cwd