diff --git a/Parallel_mpi/Parallel.ml b/Parallel_mpi/Parallel.ml index bf81735..c79de10 100644 --- a/Parallel_mpi/Parallel.ml +++ b/Parallel_mpi/Parallel.ml @@ -84,7 +84,7 @@ module Node = struct let broadcast x = broadcast_generic Mpi.broadcast x - let barrier () = (* Mpi.barrier comm *) () + let barrier () = Mpi.barrier comm end diff --git a/Parallel_mpi/SharedMemory.ml b/Parallel_mpi/SharedMemory.ml index 8c40aa7..9fe9644 100644 --- a/Parallel_mpi/SharedMemory.ml +++ b/Parallel_mpi/SharedMemory.ml @@ -2,22 +2,24 @@ let create ?(temp_dir="/dev/shm") data_type size_array = let filename = Parallel.Node.broadcast (lazy (Filename.temp_file ~temp_dir "4idx." ".tmp")) in - at_exit (fun () -> try Sys.remove filename with _ -> ()); +Printf.printf "File:%s\n%!" filename; if Parallel.Node.master then begin - let fd = Unix.openfile filename [Unix.O_RDWR] 0o600 in + let fd = Unix.openfile filename Unix.[O_RDWR ; O_CREAT] 0o777 in let result = Unix.map_file fd data_type Bigarray.fortran_layout true size_array in Bigarray.Genarray.fill result 0.; Parallel.Node.barrier (); + at_exit (fun () -> Unix.close fd ; try Sys.remove filename with _ -> ()); result end else begin Parallel.Node.barrier (); - let fd = Unix.openfile filename [Unix.O_RDONLY] 0o600 in + let fd = Unix.openfile filename [Unix.O_RDONLY] 0o777 in + at_exit (fun () -> Unix.close fd ; try Sys.remove filename with _ -> ()); Unix.map_file fd data_type Bigarray.fortran_layout false size_array end