10
0
mirror of https://gitlab.com/scemama/EZFIO.git synced 2024-12-22 12:23:34 +01:00

Add hostname in temporary filename (problem on clusters)

This commit is contained in:
Anthony Scemama 2017-07-11 22:54:26 +02:00
parent a46375cf7c
commit 9970cb0dbf
2 changed files with 13 additions and 6 deletions

View File

@ -28,7 +28,7 @@ include make.config
.PHONY: default clean veryclean archive .PHONY: default clean veryclean archive
default: make.config default: make.config
cd src && $(MAKE) cd src && BUILD_SYSTEM=make $(MAKE)
clean: clean:
- bash -c "[[ -f lib/libezfio.a ]] && rm $$PWD/lib/*" - bash -c "[[ -f lib/libezfio.a ]] && rm $$PWD/lib/*"

View File

@ -23,14 +23,21 @@
! scemama@irsamc.ups-tlse.fr ! scemama@irsamc.ups-tlse.fr
BEGIN_PROVIDER [ integer, PID ] BEGIN_PROVIDER [ integer, PID ]
&BEGIN_PROVIDER [ character*(8), PID_str ] &BEGIN_PROVIDER [ character*(256), PID_str ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Current process ID ! Current process ID
END_DOC END_DOC
integer :: getpid integer :: getpid
character*(240) :: hostname
PID = getpid() PID = getpid()
write(PID_str,'(I8.8)') PID write(PID_str,'(I8.8)') PID
call HOSTNM(hostname)
write(PID_str,'(A,''.'',I8.8,X)') trim(hostname), PID
PID_str = trim(PID_str)
print *, PID_str
call sleep(1)
END_PROVIDER END_PROVIDER
logical function ezfio_exists(path) logical function ezfio_exists(path)
@ -75,7 +82,7 @@ subroutine libezfio_openz(filename,mode,err)
character*(*) :: filename, mode character*(*) :: filename, mode
character*(1024) :: fifo character*(1024) :: fifo
integer :: err integer :: err
fifo = trim(filename)//'.'//PID_str fifo = trim(filename)//'.'//trim(PID_str)
err=1 err=1
if (mode(1:1) == 'r') then if (mode(1:1) == 'r') then
@ -97,7 +104,7 @@ subroutine libezfio_closez(filename,mode)
END_DOC END_DOC
character*(*) :: filename, mode character*(*) :: filename, mode
character*(1024) :: fifo character*(1024) :: fifo
fifo = trim(filename)//'.'//PID_str fifo = trim(filename)//'.'//trim(PID_str)
if (mode(1:1) == 'w') then if (mode(1:1) == 'w') then
close(unit=libezfio_iunit) close(unit=libezfio_iunit)
call system('gzip -c < '//trim(fifo)//' > '//trim(filename)) call system('gzip -c < '//trim(fifo)//' > '//trim(filename))
@ -141,7 +148,7 @@ subroutine ezfio_write_%(type_short)s(dir,fil,dat)
if (libezfio_read_only) then if (libezfio_read_only) then
call ezfio_error(irp_here,'Read-only file.') call ezfio_error(irp_here,'Read-only file.')
endif endif
l_filename(1)=trim(dir)//'/.'//fil//'.'//PID_str l_filename(1)=trim(dir)//'/.'//fil//'.'//trim(PID_str)
l_filename(2)=trim(dir)//'/'//fil l_filename(2)=trim(dir)//'/'//fil
open(unit=libezfio_iunit,file=l_filename(1),form='FORMATTED',action='WRITE') open(unit=libezfio_iunit,file=l_filename(1),form='FORMATTED',action='WRITE')
write(libezfio_iunit,%(fmt)s) dat write(libezfio_iunit,%(fmt)s) dat
@ -216,7 +223,7 @@ subroutine ezfio_write_array_%(type_short)s(dir,fil,rank,dims,dim_max,dat)
if (libezfio_read_only) then if (libezfio_read_only) then
call ezfio_error(irp_here,'Read-only file.') call ezfio_error(irp_here,'Read-only file.')
endif endif
l_filename(1)=trim(dir)//'/.'//fil//PID_str//'.gz' l_filename(1)=trim(dir)//'/.'//fil//trim(PID_str)//'.gz'
l_filename(2)=trim(dir)//'/'//fil//'.gz' l_filename(2)=trim(dir)//'/'//fil//'.gz'
err = 0 err = 0