Click or drag to resize

Run examples in the documentation easily

Problem

You want to run the examples included in this documentation file easily.

Solution

The SDK includes a compiled jar that includes all the code included in this documentation.

The path to the jar is: [PathToSTKParallelComputingServerApiJavaFolder]\Documentation\stkparallelcomputingserversdk-examples-2.9.0.jar

To run one of the examples, first select an example to run. For instance, let's pick the example code from Optimize task setup time with task environment.

Take note that the class name is stkparallelcomputingserversdk.howto.TaskEnvironmentExample.

Copy agi.parallel.client-2.9.0.jar to the Documentation directory.

Finally, run a Java command that includes both the Client and SDK Examples jars in the classpath and uses the name of the example as the main class.

java -cp "agi.parallel.client-2.9.0.jar;stkparallelcomputingserversdk-examples-2.9.0.jar" stkparallelcomputingserversdk.howto.TaskEnvironmentExample
Example output from running examples
Discussion

The code for all the examples in this documentation is included and compiled so that it is easier to test and experiment without having to write too much code. All the examples in the documentation have a main entry point and will usually write something to standard output. In addition to the complete example applications in the SDK, the documentation examples are a good resource for the API for Java. As you go through the examples in the How To sections, make sure you run each example so that you can better understand what the API can do.

An important thing to note is that all the examples hard-code "localhost" as the address of the cluster job scheduler. You will have to ensure that the Coordinator is running locally on your submitter machine.

See Also

STK Parallel Computing Server 2.9 API for Java