Solver Execution on a Remote Computer using PuTTY

This tutorial allows you to solve an existing optimization on a remote computer.

Task Description

This tutorial demonstrates how to do the following:

  • Prepare PuTTY

  • Prepare the process chain on a local computer

  • Send input files to a remote computer

  • Execute the solver process remotely

  • Receive output files from a remote computer

Prerequisites

This tutorial is written with the assumption that you are an advanced user and are familiar with scripting, PuTTY, and parametrizing text-based input and output files in optiSLang. Some steps in this tutorial will not be shown explicitly.

Preparation

Before you start the tutorial, download the putty_ssh zip file from here , and extract it to your working directory.

Tutorial Steps

Preparing PuTTY

PuTTY is included as part of the optiSLang installation. The connection between local computer and server is established using key files (*.ppk).

  1. Following the instructions in the PuTTY User Manual, generate a key file using PuTTYgen and install the public key on the compute server.

  2. Set up and test the PuTTY connection.

  3. Verify that you have user rights for remote access.

Preparing the Solver Execution Script

To run the tutorial, you need to create a script that executes the solver process on the remote computer. The following example script is based on optiSLang on a Linux server. It serves as an example for any CAE tool that can be launched by a console command.

#!/bin/bash
# First line: call bash
# Important: send any graphics output into the void
export DISPLAY=:0.0
# Variables for SLang executable, input and output files
export slang==<optislang installation path>/slang/bin/slang
export inputfile=ten_bar_truss.s
export outputfile=ten_bar_truss.out
# launch SLang and test for successful run and existing output file
if $slang -b $inputfile # this is the actual solver call
then
    if test -e $outputfile
    then
        echo 'SLang terminated successfully'
        exit 0
    else
        echo $outputfile 'does not exist.'
        exit 1
    fi
else
    echo 'SLang terminated with error.' 1>&2
    exit 1
fi
exit 0 # exit code for successful solver run
  1. Replace the italicized text with the optiSLang installation path.

  2. Save the script as run_slang.cmd.

  3. Test the script on the compute server.

  4. Transfer the script to the local computer (no matter what operating system the local computer uses).

Preparing the Process Chain on a Local Computer

  1. In optiSLang, create the ten_bar_truss system using one of the following methods:

    • Use the Solver wizard to create a common text based system, then delete the script node and connect the two remaining nodes manually.

      For an example of this method, see the Optimization of a Damped Oscillator tutorial.

    • Build the system manually using individual modules.

    Use the following files located in the putty_ssh folder:

    • Input file: Input file: ten_bar_truss.s

    • Output file: ten_bar_truss.out

    The final system should resemble the following image:

  2. In the Modules pane, drag the PuTTY_SSH node onto the connection between WriteParameters and ReadResults.

  3. Double-click the PuTTY_SSH node to open it.

  4. Open the run_slang.cmd file.

  5. Optionally, set up parallel execution settings.

  6. Click Change settings.

  7. On the Process tab, enter the following:

    • Remote user name

    • Remote host name

    • Remote working directory

  8. To run the process in an additional unique folder, to the right of the Remote working directory field, select Unique.

  9. Switch to the Send input files tab.

  10. In the Working file name field, enter ten_bar_truss.s.

  11. To define the file source as the design directory, select Relative to working dir.

  12. Switch to the Receive output files tab.

  13. In the Working file name field, enter ten_bar_truss.out.

  14. To wait for the result file, select Wait.

  15. Set the maximum wait time as 20 seconds.

  16. Switch to the Delete files tab.

  17. Select the Delete remote working directory check box.

  18. Click OK.

Saving and Running the Project

  1. To save the project, click  .

  2. Browse to the location to save the project and type a project name in the File name field.

  3. Click Save.

  4. To run the project, click  .

    As the project runs, the PuTTY_SSH node will:

    1. Send the ten_bar_truss.s input file to the remote working directory.

    2. Send the run_slang.cmd script file to the remote working directory.

    3. Run the run_slang.cmd script file in the remote working directory.

    4. Wait (maximum 20 seconds) for the ten_bar_truss.out result file.

    5. Receive the ten_bar_truss.out result file from the remote working directory (if it exists).

    6. Delete the remote working directory.