9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-16 09:35:19 +02:00
qp2/src/ezfio_files/ezfio.irp.f

63 lines
1.6 KiB
Fortran
Raw Normal View History

2020-05-15 14:53:55 +02:00
BEGIN_PROVIDER [ character*(1024), ezfio_filename ]
2019-01-25 11:39:31 +01:00
implicit none
BEGIN_DOC
! Name of EZFIO file. It is obtained from the QPACKAGE_INPUT environment
! variable if it is set, or as the 1st argument of the command line.
END_DOC
2023-07-04 22:17:31 +02:00
PROVIDE mpi_initialized output_wall_time_0
2019-01-25 11:39:31 +01:00
2023-07-04 01:43:44 +02:00
integer :: i
2019-01-25 11:39:31 +01:00
! Get the QPACKAGE_INPUT environment variable
call getenv('QPACKAGE_INPUT',ezfio_filename)
if (ezfio_filename == '') then
! Get from the command line
integer :: iargc
call getarg(0,ezfio_filename)
if (iargc() /= 1) then
print *, 'Missing EZFIO file name in the command line:'
print *, trim(ezfio_filename)//' <ezfio_file>'
stop 1
endif
call getarg(1,ezfio_filename)
endif
! Check that file exists
logical :: exists
inquire(file=trim(ezfio_filename)//'/ezfio/creation',exist=exists)
if (.not.exists) then
print *, 'Error: file '//trim(ezfio_filename)//' does not exist'
stop 1
endif
call ezfio_set_file(ezfio_filename)
2023-04-18 12:33:27 +02:00
IRP_IF MACOS
IRP_ELSE
2019-01-25 11:39:31 +01:00
! Adjust out-of-memory killer flag such that the current process will be
! killed first by the OOM killer, allowing compute nodes to survive
integer :: getpid
2020-05-15 14:53:55 +02:00
character*(1024) :: command, pidc
2019-01-25 11:39:31 +01:00
write(pidc,*) getpid()
write(command,*) 'echo 15 > /proc//'//trim(adjustl(pidc))//'/oom_adj'
call system(command)
2023-04-18 12:33:27 +02:00
IRP_ENDIF
2019-01-25 11:39:31 +01:00
2019-07-09 13:40:06 +02:00
PROVIDE file_lock
2019-01-25 11:39:31 +01:00
END_PROVIDER
2020-05-15 14:53:55 +02:00
BEGIN_PROVIDER [ character*(1024), ezfio_work_dir ]
2023-07-04 01:43:44 +02:00
use c_functions
2019-01-25 11:39:31 +01:00
implicit none
BEGIN_DOC
! EZFIO/work/
END_DOC
2023-07-04 01:43:44 +02:00
logical :: b
b = mkl_serv_intel_cpu_true() /= 1
call ezfio_set_work_empty(b)
2019-01-25 11:39:31 +01:00
ezfio_work_dir = trim(ezfio_filename)//'/work/'
END_PROVIDER