Navigation: Scripting Reference Manual > Functions & Subroutines > IPCLoadConfigFile

 

IPCLoadConfigFile

 

Contact Us: fredsupport@photonengr.com

 

Description

This function reads information from a CSV "configuration" file that describes the remote nodes intended for connection and populates a connections array with the information.  This is purely a convenience function as the connections array can be populated manually as well.  Use of a configuration file, however, permits easy maintenance and storage of connection settings for remote nodes.  This command does NOT initiate a connection to the remote nodes, it simply populates a connections array that can be used later with an IPCConnect() function call to initiate a connection with the remote nodes.

 

 

Syntax

count = IPCLoadConfigFile(  connections(), configFile )

 

 

Parameters

count (Long)

Returned number of remote node descriptions that were successfully loaded from the configuration file.  Note that this does indicate the success, failure or validity of connection to the remote nodes.

 

connections() As T_IPCINSTANCE

An array of T_IPCINSTANCE structures, with each structure defining the connection information for a remote node.  This argument is passed into the function call without being initialized but will be populated with the information read from configFile after the function call is executed.

 

configFile As String

Full path file name to the configuration file being used to populate the connections() array.  The configuration file is an ASCII comma separated value formatted text file that contains one row of values for each remote instance that can be connected to (i.e. multiple specifications of the same remote node will indicate that multiple remote instances should be started on the remote node).  A header row and a blank row begin the configuration file and the individual rows (consecutive) of remote node specifications follow.  Example configuration files can be found in the <FRED install dir>\Resources\Samples\DistributedComputing folder.  The column headers indicate the following specifications:

 

Header

Meaning

ActiveNode

When specified as "active", this node will be used for IPC commands sent by the master.  When empty, this node will not be used.  For example, only nodes with "active" will be connected to when the master issues an IPCConnect() command.

Host

Remote computer's name as known on the network.

BaseDirectory

Remote node's base directory specified in the remote computer's local file system.  When the remote instance of FRED is launched, a local working directory used by FRED will be created in the base directory.  This will commonly be the "C:\users\public\documents\FRED_Remote" directory that gets created when the FRED Remote Service is installed on the remote computer.

TransferDirectory

Intermediate transfer directory as known by its network specification that will be used for transferring files between master and remote.  This directory must be accessible by both master and remote for file push/pull to be successful.  This directory may be unique for each remote node, common to all remote nodes or any combination.  If, for example, the transfer directory is a folder named "c:\temp" on a computer called "fredmaster", the transfer directory specification on the network would be:  "\\fredmaster\temp".

FredExePath

Full path name to the directory where the FRED executable is located in the local file system of the remote computer (ex. "C:\Program Files\Photon Engineering\FRED 14.110.0\Bin).

RelSpeed

Relative speed/capacity of the remote computer.  By convention, the average "speed" is 100.  This specification can be adjusted from 100 in order to account for any difference in computation ability between multiple remote computers being used in a distributed calculation.  Note, however, that this parameter has no effect unless the master and remote scripts being executed take advantage of "work units".  Work units is an advanced distributed computing concept that allow the efficiency of an analysis be tuned for inhomogeneous networks but is not required (or necessary).

NumThreads

Reserved for future use.  Leave blank.

RayFrameCount

Number of ray buffer frames to be used by the remote instance.  Blank indicates that the default value should be used.  This is equivalent to the Tools > Preferences: Ray Buffer setting, "# of frames in memory" preference setting in the FRED GUI.  Should be specified according to the resources available on each individual remote computer.

RaysPerFrame

Number of rays per ray buffer frame to be used by the remote instance.  Blank indicates that the default value should be used.  This is equivalent to the Tools > Preferences: Ray Buffer setting, "# of rays per frame" preference setting in the FRED GUI.  Should be specified according to the resources available on each individual remote computer.

NodeHandle

Not specified by user; populated by FRED internally if a configuration file is saved.

LocalHandle

Not specified by user; populated by FRED internally if a configuration file is saved.

Status

Not specified by user; populated by FRED internally if a configuration file is saved.

WorkingDirectory

Not specified by user; populated by FRED internally if a configuration file is saved.

StartupMethod

Specifies whether the connection to the remote instance should be made using the FRED Remote Service or MPICH.  The FRED Remote Service can be installed with FRED.  MPICH is not included in the FRED installation and must be configured separately by your IT administrator.

 

An example configuration file is the following, shown in its raw CSV format.  It may be more convenient to manipulate the file in a program such as Excel, but it is not required.

ActiveNode,Host,BaseDirectory,TransferDirectory,FredExePath,RelSpeed,NumThreads,RayFrameCount,RaysPerFrame,NodeHandle,LocalHandle,Status,WorkingDirectory,StartupMethod

,,,,,,,,,,,,,

active,computer1,C:\Users\Public\Documents\Fred_Remote,\\computer3\Users\Public\Documents\Fred_Remote,C:\Program Files\Photon Engineering\FRED 14.110.0\Bin,100,,,,,,,,

active,computer2,C:\Users\Public\Documents\Fred_Remote,\\computer3\Users\Public\Documents\Fred_Remote,C:\Program Files\Photon Engineering\FRED 14.110.0\Bin,100,,,,,,,,

active,computer3,C:\Users\Public\Documents\Fred_Remote,\\computer3\Users\Public\Documents\Fred_Remote,C:\Program Files\Photon Engineering\FRED 14.110.0\Bin,100,,,,,,,,

 

 

Example

The example below demonstrates how to to load the connections() array with remote node connection information stored in a configuration file and then go through a series of connect, query and reconnect commands before finally terminating the remote FRED instances.

 

Sub Main

 

    EnableTextPrinting(True)

    ClearOutputWindow()

 

    'Use a CSV file to populate the connections array

    Dim nRemoteLoad As Long

    Dim connections() As T_IPCINSTANCE

    Dim configFile As String, configLocation As String

    configLocation = GetDocDir() & "\"

    configFile     = "DCTestBed_Connections.csv"

    nRemoteLoad    = IPCLoadConfigFile( connections(), configLocation & configFile )

 

    'Connect to the remotes

    Dim nConnect As Long

    nConnect = IPCConnect( connections() )

 

    'Query the status of the connections

    Dim nQuery As Long

    nQuery = IPCQueryStatus( connections(), "detail" )

 

    'Disconnect from the remote nodes and save a snapshot file of the connections array

    Dim nDisconnect As Long

    Dim snapShot As String

    snapShot    = configLocation & "DCTestBed_Reconnect.csv"

    nDisconnect = IPCDisconnect( connections(), snapShot )

 

    'Now reconnect

    Dim nReconnect As Long

    nReconnect = IPCReconnect( connections(), snapShot )

 

    'Query the status again

    nQuery = IPCQueryStatus( connections(), "detail" )

 

    'Terminate the connections

    Dim nTerminate As Long

    nTerminate = IPCTerminate( connections(), "sterilize", "1d" )

 

End Sub

 

The IPC commands generally report information to the output window that may be used as diagnostics.  For the example script shown above, the following output is reported:

[MASTER]IPCLoadConfigFile:  3 of 3 connections read from 'C:\temp\DCTestBed_Connections.csv'                                                            

                                                            

          index          active          speed          host                    status

          1          true          100          computer1          ---

          2          true          100          computer2          ---

          3          true          100          computer3          ---

                                                            

                                                            

[MASTER]IPCConnect:  3 of 3 Remote FRED instances connected and running                                                            

                                                            

          index          host                    result                    message

          1          computer1          connected          ---

          2          computer2          connected          ---

          3          computer3          connected          ---

                                                            

                                                            

[MASTER]IPCQueryStatus:  3 connections queried                                                            

                                                            

          index          host                              message                    

          1          computer1                    idle                    

          2          computer2                    idle                    

          3          computer3                    idle                    

                                                            

          index          host handle                    cmd handle          message

          1          NI_00000012                    HPOL                    check

                                                  PING                    

                                                   IDLE                    idle

          2          NI_00000013                    HPOL                    check

                                                   PING                    

                                                   IDLE                    idle

          3          NI_00000014                    HPOL                    check

                                                   PING                    

                                                   IDLE                    idle

                                                            

                                                            

[MASTER]IPCDisconnect:  3 of 3 Remote FRED instances disconnected but still running                                                            

                                                            

                                                            

[MASTER]IPCReconnect:  3 of 3 Remote FRED instances reconnected                                                            

                                                            

          index          host                    message                    

          1          computer1          reconnected - idle                    

          2          computer2          reconnected - idle                    

          3          computer31          reconnected - idle                    

                                                            

                                                            

[MASTER]IPCQueryStatus:  3 connections queried                                                            

                                                            

          index          host                    message                    

          1          computer1          idle                    

          2          computer2          idle                    

          3          computer3          idle                    

                                                            

          index          host handle                    cmd handle          message

          1          NI_00000015                    HPOL                    check

                                                   PING                    

                                                   IDLE                    idle

          2          NI_00000016                    HPOL                    check

                                                   PING                    

                                                   IDLE                    idle

          3          NI_00000017                    HPOL                    check

                                                   PING                    

                                                   IDLE                    idle

                                                            

                                                            

[MASTER]IPCTerminate:  3 of 3 Remote FRED instance terminations initiated                                                            

                                                            

          index          host                    message                    

          1          computer1          terminate - initiated                    

          2          computer2          terminate - initiated                    

          3          computer3          terminate - initiated                    

 

 

 

See Also

Distributed Computing Script Commands

T_IPCINSTANCE

 

 

 

 

 

Copyright © Photon Engineering, LLC