#include #include "templ.h" #include #include #include "Client.h" // Make sure that the command line arguments are correctly passed on by the // user. void parseArguments(int argc) { const int maxLengthOfName = 100; char localHostName [maxLengthOfName]; int error = gethostname(localHostName, maxLengthOfName); if (error){ cout << "Error ... gethostname() failed ... exiting \n"; exit(EXIT_FAILURE); } cout << "Gramtest-Client is running on: " << localHostName << endl; if (argc != 4) { cout << "Please check your command line arguments \n"; cout << "GramClient \n"; cout << "... Exiting ...\n"; exit(EXIT_FAILURE); } } // Run the client void runClient(char **argv) { char *gateKeeperMachine = strdup(argv[1]); char *executableMachine = strdup(argv[2]); char *executablePath = strdup(argv[3]); // A client object that encapsulates the client's code. Client client; // initialize the client for access through the Globus based HPC++. client.initialize(); // Instantiate a remote component (i.e. context) and make a few method // calls on it, and finally kill it! client.instantiateComponent(gateKeeperMachine, executableMachine, executablePath); cout << "Server instantiated and killed !!\n"; cout << "test Complete\n"; free(gateKeeperMachine); free(executableMachine); free(executablePath); } static HPCxx_Group *group; int main(int argc, char **argv) { // Every HPC++ context (not created by hpcxx_createContext) calls this // function to initialize. Must be called only once in a context. hpcxx_init(argc, argv, group); // Make sure that the arguments are OK and extract the machines names // etc. from them. parseArguments(argc); runClient(argv); // Call this before exiting. Used for cleanup. hpcxx_exit(); }