This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/library/lammpi/examples/gowait
Vítor Santos Costa 2d919a4a09 MPI fixes
2015-02-11 01:50:59 +00:00

48 lines
636 B
Prolog
Executable File

#!/usr/local/bin/yap -L --
% called with
% mpirun -np 2 gowait.
% prints
% ------
% main
% main
% after_init
% after_init
% [0,2]
% [1,2]
% irecv
% wait_end
% after_send
% c(535755152,)
:- use_module(library(lam_mpi)).
:- use_module(library(system)).
main:-
write(main),nl,
mpi_init,
write(after_init),nl,
mpi_comm_size(S),
mpi_comm_rank(R),
write([R,S]),nl,
(R == 0->
sleep(2),
write(wait_end),nl,
mpi_send(ciao,1,201),
write(after_send),nl
;
mpi_irecv(0,_201,H),
write(irecv),nl,
test(H)
),
mpi_finalize.
test(H):-
(mpi_wait_recv(H,S,Data)->
write(c(S,Data)),nl
;
write(no),nl,
test(H)
).
:-main.