---
name: "pvm_setopt"
section: "3"
platform: "linux"
package: "pvm-dev"
version: "3.4.2-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/pvm_setopt"
---

# pvm\_setopt(3)

Sets libpvm options.

## NAME

pvm\_setopt - Sets libpvm options.

## SYNOPSIS

```
C	int oldval = pvm_setopt( int what, int val )
Fortran	call pvmfsetopt( what, val, oldval )
```

## PARAMETERS

- what

  **Integer defining what to set.  One of:**

  ```
  PvmRoute            1    Message routing policy
  PvmDebugMask        2    Libpvm debug mask
  PvmAutoErr          3    Auto error reporting
  PvmOutputTid        4    Stdout destination for children
  PvmOutputCode       5    Output message tag
  PvmTraceTid         6    Trace data destination for children
  PvmTraceCode        7    Trace message tag
  PvmFragSize         8    Message fragment size
  PvmResvTids         9    Allow messages to reserved tags and TIDs
  PvmSelfOutputTid   10    Stdout destination
  PvmSelfOutputCode  11    Output message tag
  PvmSelfTraceTid    12    Trace data destination
  PvmSelfTraceCode   13    Trace message tag
  PvmShowTids        14    pvm_catchout prints task ids with output
  PvmPollType        15    Message wait policy (shared memory)
  PvmPollTime        16    Message spinwait duration
  ```

- val

  **Integer specifying new setting of option.** **Predefined values for** *PvmRoute* are:

  ```
  PvmDontRoute        1    Don't request or grant connections
  PvmAllowDirect      2    (Default) Don't request but allow
  PvmRouteDirect      3    Request and allow connections
  ```

- oldval

  Integer returning the previous setting of the option.

## DESCRIPTION

The routine *pvm\_setopt* is a general purpose function used to set miscellaneous options in the PVM library. *What* is one of:

- PvmRoute

  Advises PVM on whether to set up direct task-to-task links *PvmRouteDirect* (using TCP) for all subsequent communication. Once a link is established it persists until the application finishes. If a direct link can not be established because one of the two tasks has requested *PvmDontRoute* or because adequate resources aren't available, then the default route through the PVM daemons is used. On multiprocessors such as Intel Paragon this option is ignored because the communication between tasks on these machines always uses the native protocol for direct communication. pvm\_setopt can be called multiple times to selectively establish direct links, but is typically set only once near the beginning of each task. *PvmAllowDirect* is the default route setting. This setting on task A allows other tasks to set up direct links to A. Once a direct link is established between tasks both tasks will use it for sending messages.

- PvmDebugMask

  When debugging is turned on, PVM will log detailed information about its operations and progress on its *stderr* stream. *val* is the debugging level. Default is not to print any debug information.

- PvmAutoErr

  When an error results from a libpvm function call and *PvmAutoErr* is set to 1 (the default), an error message is automatically printed on *stderr*. A setting of 0 disables this. A setting of 2 causes the library to terminate the task by calling exit() after printing the error message. A setting of 3 causes the library to abort after printing the error message.

- PvmOutputTid

  Sets the *stdout* destination for children tasks (spawned after the call to pvm\_setopt). Everything printed on the standard output of tasks spawned by the calling task is packed into messages and sent to the destination. *val* is the TID of a PVM task. Setting PvmOutputTid to 0 redirects stdout to the master pvmd, which writes to the log file /tmp/pvml.\<uid\> The default setting is inherited from the parent task, else is 0.

- PvmOutputCode

  Sets the message tag for standard output messages. Should only be set when a task has *PvmOutputTid* set to itself.

- PvmTraceTid

  Sets the trace data message destination for children tasks (spawned after the call to pvm\_setopt). Libpvm trace data is sent as messages to the destination. *val* is the TID of a PVM task. Setting PvmTraceTid to 0 discards trace data. The default setting is inherited from the parent task, else is 0.

- PvmTraceCode

  Sets the message tag for trace data messages. Should only be set when a task has *PvmTraceTid* set to itself.

- PvmFragSize

  *Val* specifies the message fragment size in bytes. Default value varies with host architecture.

- PvmResvTids

  A *val* of 1 enables the task to send messages with reserved tags and to non-task destinations. The default (0) causes libpvm to generate a *PvmBadParam* error when a reserved identifier is specified.

- PvmSelfOutputTid

  Sets the *stdout* destination for the task. Everything printed on *stdout* is packed into messages and sent to the destination. Note: this only works for spawned tasks, because the pvmd doesn't get the output from tasks started by other means. *val* is the TID of a PVM task. Setting PvmSelfOutputTid to 0 redirects stdout to the master pvmd, which writes to the log file /tmp/pvml.\<uid\>. The default setting is inherited from the parent task, else is 0. Setting either PvmSelfOutputTid or PvmSelfOutputCode also causes both *PvmOutputTid* and *PvmOutputCode* to take on the values of PvmSelfOutputTid and PvmSelfOutputCode, respectively.

- PvmSelfOutputCode

  Sets the message tag for standard output messages.

- PvmSelfTraceTid

  Sets the trace data message destination for the task. Libpvm trace data is sent as messages to the destination. *val* is the TID of a PVM task. Setting PvmSelfTraceTid to 0 discards trace data. The default setting is inherited from the parent task, else is 0. Setting either PvmSelfTraceTid or PvmSelfTraceCode also causes both *PvmTraceTid* and *PvmTraceCode* to take on the values of PvmSelfTraceTid and PvmSelfTraceCode, respectively.

- PvmSelfTraceCode

  Sets the message tag for trace data messages.

- PvmShowTids

  If true (nonzero), *pvm\_catchout* tags each line of output printed by a child task with the task id. Otherwise, output is exactly as printed.

- PvmPollType

  Sets the message wait policy when using shared-memory message transport. Setting PvmPollType to PvmPollConstant causes the application to spin on its message queue waiting for a message. Setting PvmPollType to PvmPollSleep causes the application to poll the message queue for messages PvmPollTime times before pending on the semaphore.

- PvmPollTime

  Sets the poll count for applications checking their message queue before they pend on the semaphore.  This option is ignored if PvmPollType is set to PvmPollConstant.

pvm\_setopt returns the previous value of the option. If an error occurs, the PVM error code is returned in place of the option value.

## EXAMPLES

```
C:
	oldval = pvm_setopt( PvmRoute, PvmRouteDirect );
Fortran:
	CALL PVMFSETOPT( PVMAUTOERR, 1, OLDVAL )
```

## ERRORS

This error condition can be returned

- PvmBadParam

  giving an invalid value.

## SEE ALSO

pvm\_getopt(3PVM)
