mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 06:05:29 -04:00
all for using an OUTPUT_FILE_NAME when farming
svn-origin-rev: 9726
This commit is contained in:
parent
d608969656
commit
92e42c992f
6 changed files with 60 additions and 24 deletions
|
|
@ -790,29 +790,34 @@ CONTAINS
|
|||
! generate a fresh call to cp2k_run
|
||||
IF (new_rank == 0) THEN
|
||||
|
||||
! generate the output file
|
||||
WRITE(output_file,'(A12,I5.5)') "FARMING_OUT_",i
|
||||
CALL parser_create(my_parser,file_name=TRIM(farming_env%Job(i)%input),error=error)
|
||||
label="&GLOBAL"
|
||||
CALL parser_search_string(my_parser,label,ignore_case=.TRUE.,found=found,error=error)
|
||||
IF (found) THEN
|
||||
CALL create_global_section(g_section,error=error)
|
||||
CALL section_vals_create(g_data,g_section,error=error)
|
||||
CALL cp_unit_set_create(default_units, "OUTPUT",error=error)
|
||||
CALL section_vals_parse(g_data,my_parser,default_units,&
|
||||
error=error)
|
||||
CALL cp_unit_set_release(default_units,error=error)
|
||||
CALL section_vals_val_get(g_data,"PROJECT",&
|
||||
c_val=str, error=error)
|
||||
IF (str.NE."") output_file=TRIM(str)//".out"
|
||||
CALL section_vals_val_get(g_data,"OUTPUT_FILE_NAME",&
|
||||
c_val=str,error=error)
|
||||
IF (str.NE."") output_file=str
|
||||
CALL section_vals_release(g_data,error=error)
|
||||
CALL section_release(g_section,error=error)
|
||||
END IF
|
||||
CALL parser_release(my_parser,error=error)
|
||||
CALL open_file(file_name=TRIM(output_file),&
|
||||
IF (farming_env%Job(i)%output=="") THEN
|
||||
! generate the output file
|
||||
WRITE(output_file,'(A12,I5.5)') "FARMING_OUT_",i
|
||||
CALL parser_create(my_parser,file_name=TRIM(farming_env%Job(i)%input),error=error)
|
||||
label="&GLOBAL"
|
||||
CALL parser_search_string(my_parser,label,ignore_case=.TRUE.,found=found,error=error)
|
||||
IF (found) THEN
|
||||
CALL create_global_section(g_section,error=error)
|
||||
CALL section_vals_create(g_data,g_section,error=error)
|
||||
CALL cp_unit_set_create(default_units, "OUTPUT",error=error)
|
||||
CALL section_vals_parse(g_data,my_parser,default_units,&
|
||||
error=error)
|
||||
CALL cp_unit_set_release(default_units,error=error)
|
||||
CALL section_vals_val_get(g_data,"PROJECT",&
|
||||
c_val=str, error=error)
|
||||
IF (str.NE."") output_file=TRIM(str)//".out"
|
||||
CALL section_vals_val_get(g_data,"OUTPUT_FILE_NAME",&
|
||||
c_val=str,error=error)
|
||||
IF (str.NE."") output_file=str
|
||||
CALL section_vals_release(g_data,error=error)
|
||||
CALL section_release(g_section,error=error)
|
||||
END IF
|
||||
CALL parser_release(my_parser,error=error)
|
||||
ELSE
|
||||
output_file=farming_env%Job(i)%output
|
||||
ENDIF
|
||||
|
||||
CALL open_file(file_name=TRIM(output_file),&
|
||||
file_action="WRITE",&
|
||||
file_status="UNKNOWN",&
|
||||
file_position="APPEND",&
|
||||
|
|
|
|||
|
|
@ -182,6 +182,8 @@ CONTAINS
|
|||
keyword_name="DIRECTORY",c_val=farming_env%Job(i)%cwd,error=error)
|
||||
CALL section_vals_val_get(jobs_section,i_rep_section=i,&
|
||||
keyword_name="INPUT_FILE_NAME",c_val=farming_env%Job(i)%input,error=error)
|
||||
CALL section_vals_val_get(jobs_section,i_rep_section=i,&
|
||||
keyword_name="OUTPUT_FILE_NAME",c_val=farming_env%Job(i)%output,error=error)
|
||||
|
||||
! if job id is not specified the job id is the index
|
||||
CALL section_vals_val_get(jobs_section,i_rep_section=i,&
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ MODULE farming_types
|
|||
TYPE job_type
|
||||
CHARACTER(LEN=default_path_length) :: cwd ! the directory to go to
|
||||
CHARACTER(LEN=default_path_length) :: input ! the input file to use
|
||||
CHARACTER(LEN=default_path_length) :: output ! the output file to use
|
||||
INTEGER :: ID ! the ID of this job
|
||||
INTEGER, POINTER, DIMENSION(:) :: dependencies ! the dependencies of this job
|
||||
INTEGER :: status ! pending,running,finished
|
||||
|
|
@ -85,6 +86,7 @@ ELEMENTAL SUBROUTINE init_job_type(job)
|
|||
|
||||
job%cwd=""
|
||||
job%input=""
|
||||
job%output=""
|
||||
job%ID=-1
|
||||
job%status=job_pending
|
||||
NULLIFY(job%dependencies)
|
||||
|
|
|
|||
|
|
@ -1547,11 +1547,18 @@ CONTAINS
|
|||
|
||||
CALL keyword_create(keyword,name="INPUT_FILE_NAME",&
|
||||
description="the filename of the input file",&
|
||||
usage="input_file my_input.inp",&
|
||||
usage="INPUT_FILE_NAME my_input.inp",&
|
||||
required=.TRUE.,default_lc_val="input.inp",supported_feature=.TRUE.,error=error)
|
||||
CALL section_add_keyword(sub_section,keyword,error=error)
|
||||
CALL keyword_release(keyword,error=error)
|
||||
|
||||
CALL keyword_create(keyword,name="OUTPUT_FILE_NAME",&
|
||||
description="the filename of the output file, if not specified will use the project name in the &GLOBAL section.",&
|
||||
usage="OUTPUT_FILE_NAME my_input.inp",&
|
||||
required=.FALSE.,default_lc_val="",supported_feature=.TRUE.,error=error)
|
||||
CALL section_add_keyword(sub_section,keyword,error=error)
|
||||
CALL keyword_release(keyword,error=error)
|
||||
|
||||
CALL keyword_create(keyword,name="JOB_ID",&
|
||||
description="An ID used to indentify a job in DEPENDENCIES. "//&
|
||||
"JOB_IDs do not need to be unique, dependencies will be on all jobs with a given ID. "//&
|
||||
|
|
|
|||
|
|
@ -11,3 +11,4 @@ farming-5.inp 0
|
|||
farming-6.inp 0
|
||||
farming-7.inp 0
|
||||
farming-8.inp 0
|
||||
farming-9.inp 0
|
||||
|
|
|
|||
19
tests/FARMING/regtest-1/farming-9.inp
Normal file
19
tests/FARMING/regtest-1/farming-9.inp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
&GLOBAL
|
||||
PROGRAM FARMING
|
||||
RUN_TYPE NONE
|
||||
&END GLOBAL
|
||||
|
||||
&FARMING
|
||||
NGROUPS 2
|
||||
&JOB
|
||||
DIRECTORY dir-1
|
||||
INPUT_FILE_NAME water.inp
|
||||
OUTPUT_FILE_NAME foo.out
|
||||
&END JOB
|
||||
&JOB
|
||||
DIRECTORY dir-2
|
||||
INPUT_FILE_NAME water.inp
|
||||
OUTPUT_FILE_NAME bar.out
|
||||
&END JOB
|
||||
&END FARMING
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue