SINGULAR [5] implements MP interface for distributed computation and a competitive Gröbner basis computation is illustrated as an example of distributed computation. Such a distributed computation is also possible on OpenXM. The following Risa/Asir function computes a Gröbner basis by starting the computations simultaneously from the homogenized input and the input itself. The client watches the streams by ox_select() and the result which is returned first is taken. Then the remaining server is reset.
/* G:set of polys; V:list of variables */ /* O:type of order; P0,P1: id's of servers */ def dgr(G,V,O,P0,P1) { P = [P0,P1]; /* server list */ map(ox_reset,P); /* reset servers */ /* P0 executes non-homogenized computation */ ox_cmo_rpc(P0,"dp_gr_main",G,V,0,1,O); /* P1 executes homogenized computation */ ox_cmo_rpc(P1,"dp_gr_main",G,V,1,1,O); map(ox_push_cmd,P,262); /* 262 = OX_popCMO */ F = ox_select(P); /* wait for data */ /* F[0] is a server's id which is ready */ R = ox_get(F[0]); if ( F[0] == P0 ) { Win = "nonhomo"; Lose = P1; } else { Win = "homo"; Lose = P0; } ox_reset(Lose); /* reset the loser */ return [Win,R]; }