CATCHOUT(3PVM)

πŸ“¦ version 3.4.6, in debian bookworm, ubuntu jammy

✨ CATCHOUT πŸ’… β€” the pvm_catchout page (3PVM, PVM Version 3.4)

okay bestie, pull up a chair because this one is literally about being the nosy parent who reads their kids' texts. except the "kids" are child tasks and the "texts" are stdout and stderr. πŸŽ€


🌸 NAME 🌸

pvm_catchout β€” catch output from child tasks. that's it, that's the whole vibe. it's giving "helicopter parent but for spawned processes". πŸ¦‹


✨ SYNOPSIS ✨

C bestie:

#include <stdio.h>

int info = pvm_catchout( FILE *ff )

Fortran bestie:

call pvmfcatchout( onoff, info )

πŸ’– PARAMETERS πŸ’–

  • ff β€” the file descriptor you want all the collected output to get written to. that's the lil bucket you're catching everything in. πŸͺ£
  • onoff β€” an integer, bestie. flips output collection on or off. the switch. the toggle. the main character of Fortran-land.
  • info β€” the integer status code the routine hands back to you. anything less than zero means something went wrong. no cap. 😭

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea. pvm_catchout makes the calling task (that's the parent) start catching output from any tasks spawned after the call to pvm_catchout. characters printed on stdout or stderr in children tasks get collected by the pvmds and sent in control messages to the parent task, which tags each line and appends it to the specified file. ✨

and the grandchildren?? the tasks spawned by the children?? their output gets collected too, provided the children don't reset their PvmOutputTid. so it's a whole family group chat, fr fr. 🫢

if the option PvmShowTids (peep pvm_setopt) is true (nonzero), the output gets printed like this, tagged with the task id where the output originated:

[txxxxx] BEGIN
[txxxxx] (text from child task)
[txxxxx] END

so the output from each task includes one BEGIN line and one END line, with whatever the task prints sitting in between. if PvmShowTids is false, you just get the raw output printed with no extra info at all. plain. unseasoned. πŸ€·β™€οΈ

in C, you get to specify the output file descriptor. giving a null pointer turns output collection off for any subsequently spawned child tasks. (any existing output collection will still proceed at the child tasks, until they exit or change their PvmOutputTid or related settings β€” go read the man page for pvm_setopt() for that whole situation.) πŸ’…

in Fortran, output collection can only be turned on or off (again, only for subsequently spawned child tasks), and it's always logged to the stdout of the parent task. no file descriptor choices for you, sorry babes.

⚠️ real talk: if pvm_exit is called while output collection is in effect, it will block in order to print all the output, until all tasks sending the given task output have exited. that's a yikes. to avoid it, turn output collection off by calling pvm_catchout(0) before you call pvm_exit. save yourself the pain. πŸ™ˆ

and the iconic finale: pvm_catchout() always returns 0. always. every time. periodt. πŸ’€


🌈 EXAMPLES 🌈

C bestie:

#include <stdio.h>

pvm_catchout(stdout);

Fortran bestie:

CALL PVMFCATCHOUT( 1, INFO )

πŸ¦‹ SEE ALSO πŸ¦‹

  • pvm_exit(3PVM)
  • pvm_setopt(3PVM)
  • pvm_spawn(3PVM)

and that's the whole page, bestie!! this was PVM Version 3.4 energy, dated 13 July, 1994 β€” yeah she's vintage, she's an icon, she ate and left no crumbs. now go catch that output. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from