Hi folx, lets do another, more complete example translation from gridrpc to saga. Todays example is the pi_client_sync.c from the NinfG documentation. The original code (changed formating) is attached as pi_client_sync.c. The SAGA version is included below. I ommited the C version this time, for brevity - please let me know if you would like the direct comparison with C, and I'll try to come up with that. ---------------------------------------------------------- /* This is sample program for Ninf-G, calculate PI on one server */ #include <saga.h> std::string func_name = "pi/pi_trial"; std::string config_file = "client.conf"; int port = 0; int main (int argc, char *argv[]) { if ( argc != 3 ) { std::cerr << "\n\tUSAGE: " << argv[0] << " <times> <hostname>\n\n"; exit (2); } long times = atol (argv[1]); string host = argv[2]; try { /* Initialize Function handle */ saga::rpc handle (host, func_name); /* Synchronous call */ long answer; handle.call (0, times, &answer); /* Compute and display pi. */ std::cout << "PI = " << 4.0 * ((double) answer / times)) << std::endl; } catch ( const saga::exception & e ) { std::cerr << "Catched saga error: " << e.what () << std::endl; exit (2); } return (0); } ---------------------------------------------------------- Don't let yourself be fooled by the shortness of the programm - that is mainly due to C++, not due to saga (although again the session initialization/destroy is done behind the scenes by default). The semantics should be exactly the same as in GridRPC. Well, thats for now, the next example should tackle a async call I guess. Again, I would be more than happy to see more realistic code examples posted by you guys :-) Cheers, Andre. -- "So much time, so little to do..." -- Garfield
participants (1)
-
Andre Merzky