Dynamic Probe Class Library

DPCL Class Reference


Chapter 10. Class PoeAppl : public Application

The PoeAppl class is derived from the Application class, and is used specifically to represent a POE application. Since it is derived from the Application class, all of the Application class member functions are available to objects of the PoeAppl class. In addition, the PoeAppl class has member functions that are relevant only to POE applications. These member functions enable an analysis tool to:

For more information on POE, refer to IBM Parallel Environment for AIX: Operation and Use, Volume 1.

Constructors

Synopsis

#include <PoeAppl.h>
PoeAppl(void);
PoeAppl(const PoeAppl copy);

Description

Default constructor. The copy constructor uses the values contained in the copy argument to initialize the new (constructed) object.

Exceptions

ASC_insufficient_memory
a memory allocation routine failed

bcreate

Synopsis

#include <PoeAppl.h>
AisStatus bcreate(
        const char *host,
        const char *path,
        const char *const argv[],
        const char *const envp[],
        char *remote_stdin_filename,
        char *remote_stdout_filename,
        char *remote_stderr_filename,
        GCBFuncType stdout_cb_fp,
        GCBTagType stdout_cb_tag,
        GCBFuncType stderr_cb_fp,
        GCBTagType stderr_cb_tag)
 
AisStatus bcreate(
        const char *host,
        const char *path,
        const char *const argv[],
        const char *const envp[],
        GCBFuncType stdout_cb_fp,
        GCBTagType stdout_cb_tag,
        GCBFuncType stderr_cb_fp,
        GCBTagType stderr_cb_tag)
 
AisStatus bcreate(
        const char *host,
        const char *path,
        const char *const argv[],
        const char *const envp[],
        char *remote_stdin_filename,
        char *remote_stdout_filename,
        char *remote_stderr_filename);
 

Parameters

host
host name or IP address of the host machine where the POE application is to be created. This will be the home node for POE. If NULL, then the process is considered local.

path
complete path to POE, including absolute directory

argv
specifies an array of pointers to null-terminated character strings. These strings constitute the argument list that is available to POE or the target program. The last argument of the argv parameter is a NULL pointer. argv [0] must contain a string containing the name and path of the executable.

envp
null-terminated array of environment variables to be provided for POE

remote_stdin_filename
remote file to use for stdin

remote_stdout_filename
remote file to use for stdout

remote_stderr_filename
remote file to use for stderr

stdout_cb_fp
callback function that handles stdout from the application

stdout_cb_tag
tag to be used with the stdout callback function

stderr_cb_fp
callback function that handles stderr from the application

stderr_cb_tag
tag to be used with the stderr callback function

Description

Creates an MPI program in a suspended state. All of the processes get created but are suspended at the first executable instruction. The current working directory for the processes is $HOME. Use the start function to allow the MPI program to run.

The POE executable specified in the path parameter is run with the argv and envp parameters provided on the host that is specified by the host parameter. This creates the MPI program, which is set up but not run. The configuration of the MPI program will be found and a Process class will be added to the PoeAppl for each task in the MPI program.

After the create has completed, each process within the PoeAppl will be in a created state and probes may be installed, activated, removed, and so forth.

To find the number of Process objects that are now contained in PoeAppl, use Application::get_count. To access a particular process within PoeAppl, use Application::get_process.

stdio for the MPI program will be handled by POE, depending on the options and environment variables specified for POE. In other words the stdin, stdout and stderr all get funneled through the POE process. The input, output file names, output callbacks and PoeAppl::send_stdin can be used to access the stdio to and from the POE process.

If you pass callback functions to the stdout_cb_fp and stderr_cb_fp parameters, the output from POE will be available in these callbacks. Input to POE can be sent using send_stdin().

Another way to access POE's stdio is to specify the remote file name parameters. In this case, stdin, stdout, and stderr can be set to use files on the host where POE is running. It is expected that the remote_stdin_filename specified will already exist. The files for the remote_stdout_filename and remote_stderr_filename are created or overwritten if they already exist. If one of the remote file parameters is specified, it takes precedence over the corresponding callback or send_stdin() method of handling stdio.

Note that bcreate does not return control to the caller until the new application has been created or has failed to be created. The return value indicates whether the operation succeeded or failed. The function Application::status(int index) may be queried to determine whether the operation succeeded or failed on any given process.

Return Values

The return value for bcreate indicates whether the application was successfully created.

PoeAppl::bcreate is used to:

Because of this, return values other than the following may be encountered due to errors in the contained DPCL calls.

ASC_bad_path
an invalid pathname was specified as a parameter

ASC_bad_rem_errfile_open
Unable to open file specified by remote_stderr_filename parameter

ASC_bad_rem_infile_open
Unable to open file specified by remote_stdin_filename parameter

ASC_bad_rem_outfile_open
Unable to open file specified by remote_stdout_filename parameter

ASC_bad_remote_stderr_filename
invalid filename for remote_stderr_filename parameter

ASC_bad_remote_stdin_filename
invalid filename for remote_stdin_filename parameter

ASC_bad_remote_stdout_filename
invalid filename for remote_stdout_filename parameter

ASC_duplicate_create
this PoeAppl object has already been created

ASC_missing_predef_func
attempted to create a target program which has not been prelinked

ASC_no_create_from_attached
cannot create program from the PRC_attached state

ASC_no_create_from_connected
cannot create program from the PRC_connected state

ASC_not_full_path
a parameter did not contain full path name

ASC_operation_failed
application was not created

ASC_success
create request was completed successfully

Callback Data

The stdout_cb_fp callback function is invoked each time the process sends data to stdout.

The stderr_cb_fp callback function is invoked each time the process sends data to stderr.

The output will be contained in the message parameter of the callback. The size of the output will be contained in the msg_size field of the sys callback parameter. The output from the application may be received in different size blocks than were actually sent by the program.

See Also

bdestroy, bstart, create, destroy, get_count, get_process, send_stdin, start, status

binit_procs

Synopsis

#include <PoeAppl.h>
AisStatus binit_procs(
         const char *hostname,
         int poe_pid);

Parameters

hostname
A string representing the hostname or IP address where POE was invoked to start the MPI program. This host is referred to as the home node in the PE user publications.

poe_pid
The process identifier (pid) of the POE invocation on its home node.

Description

Initializes the PoeAppl class to contain the set of processes used by the MPI program. The process and node configuration of the MPI program is read, and a corresponding set of Process objects are created that contain the process identifier (pid) and hostname of the individual tasks in the MPI program. These Process classes are then added to the PoeAppl object.

To find the number of Process objects that are now contained in PoeAppl, use Application::get_count. To access a particular process within PoeAppl, use Application::get_process.

A subsequent connect must be issued in order to insert instrumentation into the application.

Note that binit_procs does not return control to the caller until either an attempt to obtain the MPI program configuration information fails, or all of the Process classes have attempted to be created.

Return Values

If the MPI program configuration information is successfully found and parsed, the return value indicates whether all binit_procs operations succeeded, or some succeeded and some failed. The function Application::status(int index) may be queried to determine whether the operation succeeded or failed on any given process.

ASC_success
processes have been added to PoeAppl class

ASC_bad_att_cfg_version
unrecognized POE version

ASC_bad_att_cfg_numtask
attach configuration file error parsing number of tasks

ASC_bad_att_cfg_task
attach configuration file error parsing task number

ASC_bad_att_cfg_ipaddr
attach configuration file error parsing IP address

ASC_bad_att_cfg_hostname
attach configuration file error parsing hostname

ASC_bad_att_cfg_pid
attach configuration file error parsing process identifier

ASC_bad_att_cfg_sid
attach configuration file error parsing session identifier

ASC_bad_att_cfg_progname
attach configuration file error parsing program name

ASC_operation_failed
attempt to connect to this process failed

See Also

bconnect, connect, get_count, get_process, init_procs

create

Synopsis

#include <PoeAppl.h>
AisStatus create(
        const char *host,
        const char *path,
        const char *const argv[],
        const char *const envp[],
        char *remote_stdin_filename,
        char *remote_stdout_filename,
        char *remote_stderr_filename,
        GCBFuncType stdout_cb_fp,
        GCBTagType stdout_cb_tag,
        GCBFuncType stderr_cb_fp,
        GCBTagType stderr_cb_tag,
        GCBFuncType ack_cb_fp,
        GCBTagType ack_cb_tag);
 
AisStatus create(
        const char *host,
        const char *path,
        const char *const argv[],
        const char *const envp[],
        GCBFuncType stdout_cb_fp,
        GCBTagType stdout_cb_tag,
        GCBFuncType stderr_cb_fp,
        GCBTagType stderr_cb_tag,
        GCBFuncType ack_cb_fp,
        GCBTagType ack_cb_tag);
 
AisStatus create(
        const char *host,
        const char *path,
        const char *const argv[],
        const char *const envp[],
        char *remote_stdin_filename,
        char *remote_stdout_filename,
        char *remote_stderr_filename,
        GCBFuncType ack_cb_fp,
        GCBTagType ack_cb_tag);
 

Parameters

host
host name or IP address of the POE process. This will be the hostname sometimes referred to as the home node in the PE user publications. If NULL, then the process is considered local.

path
complete path to the POE executable, including absolute directory

argv
specifies an array of pointers to null-terminated character strings. These strings constitute the argument list that is available to POE or the target program. The last element of the argv parameter is a NULL pointer. argv [0] must contain a string containing the name and path of the POE executable.

envp
an array of pointers to null-terminated character strings. These strings constitute the environment for POE. The last element of the envp parameter is a NULL pointer.

remote_stdin_filename
remote file to be used for stdin

remote_stdout_filename
remote file to be used for stdout

remote_stderr_filename
remote file to be used for stderr

stdout_cb_fp
callback function that handles stdout from the application

stdout_cb_tag
tag to be used with the stdout callback function

stderr_cb_fp
callback function that handles stderr from the application

stderr_cb_tag
tag to be used with the stderr callback function

ack_cb_fp
callback function to be invoked with a successful or failed create. Specify the function name or NULL. operation

ack_cb_tag
callback tag to be used when the callback function is invoked

Description

Creates an MPI program in a suspended state. All of the processes get created but are suspended at the first executable instruction. The current working directory for the processes is $HOME. Use the start function to allow the MPI program to run.

The POE executable specified in the path parameter is run with the argv and envp parameters that are provided on the host that is specified by the host parameter. This creates the MPI program, which is set up but not run. DPCL finds the configuration of the MPI program and a Process object is added to the PoeAppl for each task in the MPI program.

After the create operation has completed, each process within the PoeAppl will be in a created state, and probes are installed, activated, removed, and so forth.

To find the number of Process objects that are now contained in PoeAppl, use Application::get_count. To access a particular process within the PoeAppl, use Application::get_process.

stdio for the MPI program will be handled by POE depending on the options and environment variables specified for POE. In other words the stdin, stdout and stderr all get funneled through the POE process. The input file name, output file names, output callbacks, and PoeAppl::send_stdin can be used to access the stdio to and from the POE process.

If you pass callback functions to the stdout_cb_fp and stderr_cb_fp parameters, the output from POE will be available in these callbacks. Input to POE can be sent using send_stdin().

Another way to access stdio to POE is to specify the remote filename parameters. In this case stdin, stdout, and stderr can be set to use files on the host where POE is running. In most cases, the remote_stdin_filename that is specified must already exist. The files for the remote_stdout_filename and remote_stderr_filename are created or overwritten if they already exist. If one of the remote file parameters is specified, it takes precedence over the corresponding callback or send_stdin() method of handling stdio.

Note that create immediately returns control to the caller. It does not wait until the application has been created. If the return value has an AisSeverityCode of ASC_error or worse, the function returns immediately and the user-specified callback will not be invoked.The return value indicates whether the request was submitted successfully, but does not indicate whether it was executed successfully, or if it failed.

Return Values

The return value for create indicates whether the request to create an application was successfully submitted, but does not indicate whether it was executed successfully, or if it failed.

ASC_bad_path
an invalid pathname was specified as a parameter

ASC_bad_rem_errfile_open
Unable to open file specified by remote_stderr_filename parameter

ASC_bad_rem_infile_open
Unable to open file specified by remote_stdin_filename parameter

ASC_bad_rem_outfile_open
Unable to open file specified by remote_stdout_filename parameter

ASC_bad_remote_stderr_filename
invalid filename for remote_stderr_filename parameter

ASC_bad_remote_stdin_filename
invalid filename for remote_stdin_filename parameter

ASC_bad_remote_stdout_filename
invalid filename for remote_stdout_filename parameter

ASC_duplicate_create
this PoeAppl object has already been created

ASC_missing_predef_func
attempted to create a target program which has not been prelinked

ASC_no_create_from_attached
cannot create program from the PRC_attached state

ASC_no_create_from_connected
cannot create program from the PRC_connected state

ASC_not_full_path
a parameter did not contain full path name

ASC_operation_failed
application was not created

ASC_success
create request was completed successfully

Callback Data

The acknowledgement callback function is invoked once when the new application is created. When the callback is invoked, the callback function is passed a pointer to the PoeAppl as the callback object. The callback message is the request status, of type AisStatus, which may contain one of the status values that follow:

PoeAppl::create is implemented using the existing DPCL interface including calls to Process:create and Process::start to initiate POE on the home node, and PoeAppl::init_procs to initialize the PoeAppl class with contained Process classes. Because of this, return values other than the following may be encountered due to errors in the contained DPCL calls:

ASC_success
connection was successfully established on this process

ASC_operation_failed
attempt to connect to this process failed

stdout_cb_fp. This callback function is invoked each time the process sends data to stdout

stderr_cb_fp. This callback function is invoked each time the process sends data to stderr

The output is contained in the message parameter of the callback. The size of the output will be contained in the msg_size field of the sys callback parameter. The output from the application may be received in different size blocks than were actually sent by the program.

See Also

bcreate, bdestroy, bstart, destroy, get_count, get_process, send_stdin, start

init_procs

Synopsis

#include <PoeAppl.h>
AisStatus init_procs(
        const char *hostname,
        int poe_pid,
        GCBFuncType fp,
        GCBTagType tag);

Parameters

hostname
A string that represents the hostname or IP address where POE was invoked to start the MPI program. This host is referred to as the home node in the PE user publications.

poe_pid
The process identifier (pid) of the POE invocation on its home node

fp
callback function to be invoked with a successful or failed initialization of the PoeAppl class

tag
callback tag to be used as a parameter to the callback, when the callback function is invoked.

Description

Initializes the PoeAppl class to contain the set of processes used by the MPI program. The process and node configuration of the MPI program is read and a corresponding set of Process classes are created. These Process classes contain the process identifier (pid) and hostname of the individual tasks of the MPI program. These Process classes are then added to the PoeAppl objects.

To find the number of Process objects that are now contained in the PoeAppl, objects use Application::get_count. To access a particular process within the PoeAppl object, use Application::get_process. A subsequent connect must be issued in order to insert instrumentation into the application.

Note that init_procs immediately returns control to the caller upon submitting the request to the daemon. It does not wait until the configuration has been obtained or for the Process classes to be initialized. The acknowledgement callback function receives notification of the success or failure of the PoeAppl initialization.

Return Values

The return value for init_procs indicates whether the requests were submitted successfully, but does not indicate whether the requests themselves were successfully executed.

ASC_success
request to initialize the PoeAppl class was submitted successfully

ASC_operation_failed
attempt to submit the request for the MPI program configuration data failed

Callback Data

If the MPI program configuration information is successfully found and parsed, the return value indicates whether all processes have been added to the PoeAppl object, or if some succeeded and some failed. The function Application::status(int index) may be queried to determine whether the operation succeeded or failed on any given process.

ASC_success
processes have been added to the PoeAppl class

ASC_bad_att_cfg_version
unrecognized POE version

ASC_bad_att_cfg_numtask
attach configuration file error parsing number of tasks

ASC_bad_att_cfg_task
attach config file error found while parsing task number

ASC_bad_att_cfg_ipaddr
attach config file error found while parsing IP address

ASC_bad_att_cfg_hostname
attach config file error found while parsing hostname

ASC_bad_att_cfg_pid
attach config file error found while parsing pid

ASC_bad_att_cfg_sid
attach config file error found while parsing session ID

ASC_bad_att_cfg_progname
attach config file error found while parsing program name

ASC_operation_failed
attempt to connect to this process failed

See Also

bconnect, binit_procs, connect, get_count, get_process

send_stdin

Synopsis

#include <PoeAppl.h>
AisStatus send_stdin(
        char *buffer,
        int size,
        GCBFuncType ack_cb_fp,
        GCBTagType ack_cb_tag);

Parameters

buffer
character array that contains text to be fed to the application through the controlling POE process

size
number of bytes in the buffer to be sent

ack_cb_fp
callback function that indicates stdin has been sent to the controlling POE process. Specify the function name or NULL.

ack_cb_tag
tag to be used as an argument to the acknowledgement callback, when it is invoked.

Description

This function provides text to be used as input to the POE process for the stdin device (file descriptor 0). To send an EOF to the stdin device of the controlling POE process, call send_stdin() with the buffer parameter set to NULL.

In order for send_stdin to be used, the POE application must have been created using the create function.

Note that send_stdin immediately returns control to the caller upon submitting the request to the daemon. It does not wait until the application has received the input.

Return Values

The return value for send_stdin indicates whether the request to provide application input was submitted successfully. It does not indicate whether the request was executed successfully.

ASC_success
request to provide input was submitted successfully

ASC_operation_failed
request to provide input failed

Callback Data

The acknowledgement callback function is invoked once when the buffer has been sent to POE. When the callback is invoked, the callback function is passed a pointer to the PoeAppl as the callback object. The callback message is the request status, of type AisStatus, which may contain one of the status values values that follow.

ASC_success
the buffer was successfully sent to POE

ASC_operation_failed
attempt to send the buffer to POE failed

See Also

bcreate, create


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]