[ExM Users] File race condition?

Ozik, Jonathan jozik at anl.gov
Wed Apr 15 20:03:52 CDT 2015


Hello all,

I’m wondering if I’m seeing an unintended file I/O race condition or if I’m simply doing something wrong but I’m getting errors when trying to execute this script using trunk:

swift-t -n 4 very_simple.swift -f=upf_small_3.txt
(where upf_small_3.txt is a file with 3 lines)

##### very_simple.swift #####
import io;
import sys;
import files;

main
{
    string upf_file_name = argv("f"); // e.g., -f="upf.txt"
    string upf_lines[]  = file_lines(input(upf_file_name));
    foreach s,i in upf_lines
    {
      string instance_dir = strcat(strcat("instance_",fromint(i)),"/");
      
      file out <strcat(instance_dir,"out.txt")>;
      file err <strcat(instance_dir,"err.txt")>;
      file tmp <strcat(instance_dir,"upf.txt")> = write(s);
    }
}
##### very_simple.swift #####

The errors are:
couldn't open "instance_1/upf.txt": no such file or directory
    while executing
"::open [ local_file_path $local_file ] w+ "
    (procedure "turbine::file_write_local" line 3)
    invoked from within
"turbine::file_write_local v:tmp ${v:s}"
    (procedure "__entry-call_foreign-write" line 5)
    invoked from within
"__entry-call_foreign-write {2	randomSeed	1,zombieStep	0.1,humanStep	0.5,human_count	200,zombie_count	2} instance_1/upf.txt {file 7 is_mapped 1}"
Turbine worker task error in: __entry-call_foreign-write {2	randomSeed	1,zombieStep	0.1,humanStep	0.5,human_count	200,zombie_count	2} instance_1/upf.txt {file 7 is_mapped 1}
    invoked from within
"c::worker_loop $WORK_TYPE($mode) $keyword_args"
    (procedure "standard_worker" line 27)
    invoked from within
"standard_worker $rules $startup_cmd "
    (procedure "enter_mode_unchecked" line 5)
    invoked from within
"enter_mode_unchecked $rules $startup_cmd"
    (procedure "enter_mode" line 5)
    invoked from within
"enter_mode $rules $startup_cmd “

Jonathan


More information about the ExM-user mailing list