diff --git a/Makefile.include b/Makefile.include index 54a0966..e7a5e3c 100644 --- a/Makefile.include +++ b/Makefile.include @@ -1,6 +1,6 @@ .NOPARALLEL: -INCLUDE_DIRS=Nuclei,Utils,Basis,SCF,MOBasis,CI +INCLUDE_DIRS=Parallel,Nuclei,Utils,Basis,SCF,MOBasis,CI LIBS= PKGS= OCAMLBUILD=ocamlbuild -j 0 -cflags $(ocamlcflags) -lflags $(ocamlcflags) $(ocamldocflags) -Is $(INCLUDE_DIRS) -ocamlopt $(ocamloptflags) diff --git a/Parallel/Parallel.ml b/Parallel/Parallel.ml new file mode 100644 index 0000000..351ddeb --- /dev/null +++ b/Parallel/Parallel.ml @@ -0,0 +1,6 @@ +(** Module for handling distributed parallelism *) + +let size = Mpi.comm_size Mpi.comm_world +let rank = Mpi.comm_rank Mpi.comm_world + + diff --git a/Parallel/Parallel.mli b/Parallel/Parallel.mli new file mode 100644 index 0000000..4fbac42 --- /dev/null +++ b/Parallel/Parallel.mli @@ -0,0 +1,10 @@ +(** Module for handling distributed parallelism *) + +val size : int +(** Number of distributed processes. *) + +val rank : Mpi.rank +(** Rannk of the current distributed processe. *) + + + diff --git a/_tags b/_tags index c7598f6..21edbda 100644 --- a/_tags +++ b/_tags @@ -1,4 +1,4 @@ -true: package(str,unix,bigarray,lacaml,alcotest,zarith) +true: package(str,unix,bigarray,lacaml,alcotest,zarith,mpi) <*.byte> : linkdep(Utils/math_functions.o), custom <*.native>: linkdep(Utils/math_functions.o) : not_hygienic diff --git a/run_parallel.ml b/run_parallel.ml new file mode 100644 index 0000000..f3e415f --- /dev/null +++ b/run_parallel.ml @@ -0,0 +1,5 @@ + +let () = + Printf.printf "Hello from rank %d of %d.\n" + Parallel.rank Parallel.size +