SPAWN(3PVM)
π SPAWN(3PVM) π
okay bestie, welcome to pvm_spawn β the PVM 3.4 era glow-up that literally starts new PVM processes for you. it's giving "mom, can we get more tasks" and the answer is yes. let's go π«Ά
β¨ NAME β¨
pvm_spawn β Starts new PVM processes. that's it, that's the whole job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
C girlies:
int numt = pvm_spawn( char *task, char **argv, int flag,
char *where, int ntask, int *tids )
Fortran girlies:
call pvmfspawn( task, flag, where, ntask, tids, numt )
π PARAMETERS π
taskβ a character string, aka the executable file name of the PVM process you wanna start. important: the executable has to already be chilling on the host where it's gonna start. the name can be a file in the PVM search path or an absolute path. the default PVM search path is$HOME/pvm3/bin/$PVM_ARCH/.argvβ pointer to an array of arguments for the executable (if that's supported on the target machine), not including the executable name, and the end of the array is marked byNULL.argv[0]of the spawned task gets set to the executable path relative to the PVM working directory (or absolute if you specified an absolute filename). if your executable needs no arguments, then the second argument topvm_spawnis justNULL. simple as πflagβ integer that specifies the spawn options. no cap, this is where the lore is:
In C, flag should be the sum of:
PvmTaskDefault0β PVM can choose any machine to start taskPvmTaskHost1βwherespecifies a particular hostPvmTaskArch2βwherespecifies a type of architecturePvmTaskDebug4β Start up processes under debuggerPvmTaskTrace8β Processes will generate PVM trace data. *PvmMppFront16β Start process on MPP front-end.PvmHostCompl32β Use complement host set
In Fortran, flag should be the sum of:
PVMDEFAULT0β PVM can choose any machine to start taskPVMHOST1βwherespecifies a particular hostPVMARCH2βwherespecifies a type of architecturePVMDEBUG4β Start up processes under debuggerPVMTRACE8β Processes will generate PVM trace data. *
* future extension π (yes, the asterisk is doing all that work, iconic behavior)
whereβ character string saying where to start the PVM process. depending on the value offlag,wherecan be a host name like"ibm1.epm.ornl.gov"or a PVM architecture class like"SUN4". also!! the host name"."is taken as the localhost. and ifflagis0, thenwhereis ignored when determining the target host or architecture, and PVM will select the most appropriate host. main character energy honestly.
the where argument can also be used to specify a custom working directory for each given spawn command. you do this by appending a ':' and the desired working directory path to the where string, i.e.:
"ibm1.epm.ornl.gov:/home/user/project/foo"
PVM will temporarily change the working directory to spawn the given task(s), and will then reset to the default working directory after the spawn is executed. this option need not be used in conjunction with either the PvmTaskHost or PvmTaskArch flags, because the working directory path is stripped off prior to parsing any host or architecture name. so a valid specification for where is therefore:
":/home/user/project/foo"
the working directory can be either an absolute path name or can be relative to the current default working directory. flexible queen π
ntaskβ integer specifying the number of copies of the executable to start.tidsβ integer array of lengthntaskreturning the tids of the PVM processes started by thispvm_spawncall.numtβ integer returning the actual number of tasks started. values less than zero indicate a system error π. a positive value less thanntaskindicates a partial failure. in this case the user should check thetidsarray for the error code(s).
π¦ DESCRIPTION π¦
the routine pvm_spawn starts ntask copies of the executable named task. on systems that support environment, spawn passes selected variables from parent environment to children tasks. if set, the envar PVM_EXPORT is passed. if PVM_EXPORT contains other names (separated by ':') they will be passed too. this is useful for e.g.:
setenv DISPLAY myworkstation:0.0
setenv MYSTERYVAR 13
setenv PVM_EXPORT DISPLAY:MYSTERYVAR
the hosts on which the PVM processes are started are determined by the flag and where arguments. on return the array tids contains the PVM task identifiers for each process started.
if pvm_spawn starts one or more tasks, numt will be the actual number of tasks started. if a system error occurs then numt will be < 0. if numt is less than ntask then some executables have failed to start and the user should check the last ntask - numt locations in the tids array which will contain error codes (see below for meaning). the first numt tids in the array are always valid. β¨
when flag is set to 0 and where is set to NULL (or "*" in Fortran) a heuristic (round-robin assignment) is used to distribute the ntask processes across the virtual machine. she's just rotating through hosts like it's a fit check π₯
if the PvmHostCompl flag is set, the resulting host set gets complemented. given that the TaskHost host name "." is taken as localhost, these can be used together, for example, to request n - 1 tasks on host "." but with flags TaskHost|HostCompl to spawn n - 1 tasks on hosts other than the localhost.
in the special case where a multiprocessor is specified by where, pvm_spawn will start all ntask copies on this single machine using the vendor's underlying routines.
the spawned task will have argv[0] set to the the executable path relative to its inherited working directory (or possibly an absolute path), so the base filename can be got by using:
char *p;
p = (p = rindex(argv[0], '/')) ? p + 1 : argv[0];
if PvmTaskDebug is set, then the pvmd will start the task(s) under debugger(s). in this case, instead of executing pvm3/bin/ARCH/task args it executes pvm3/lib/debugger pvm3/bin/ARCH/task args. debugger is a shell script that the users can modify to their individual tastes. presently the script starts an xterm with dbx or comparable debugger in it. ngl that's kinda cute π
π EXAMPLES π
C besties:
numt = pvm_spawn( "host", 0, PvmTaskHost, "sparky", 1, &tid[0] );
numt = pvm_spawn( "host", 0, (PvmTaskHost+PvmTaskDebug),
"sparky", 1, &tid[0] );
numt = pvm_spawn( "node", 0, PvmTaskArch, "RIOS", 1, &tid[i] );
char *args[] = { "12", "60" , (char*)0 };
numt = pvm_spawn( "FEM1", args, 0, 0, 16, tids );
numt = pvm_spawn( "pde", 0, PvmTaskHost, "paragon.ornl", 512, tids );
Fortran besties:
FLAG = PVMARCH + PVMDEBUG
CALL PVMFSPAWN( 'node', FLAG, 'SUN4', 1, TID(3), NUMT )
CALL PVMFSPAWN( 'FEM1', PVMDEFAULT, '*', 16, TIDS, NUMT )
CALL PVMFSPAWN( 'TBMD', PVMHOST, 'cm5.utk.edu', 32, TIDS, NUMT )
π ERRORS π
these error conditions can be returned by pvm_spawn either in numt or in the tids array. keep an eye out π
PvmBadParamβ giving an invalid argument value.PvmNoHostβ Specified host is not in the virtual machine.PvmNoFileβ Specified executable cannot be found. The default location PVM looks in is~/pvm3/bin/ARCH, whereARCHis a PVM architecture name.PvmNoMemβ Malloc failed. Not enough memory on host.PvmSysErrβ pvmd not responding.PvmOutOfResβ out of resources.
π SEE ALSO π
pvm_export(3PVM) β go read her too, she's iconic π
okay that's the whole page bestie, you're officially a pvm_spawn girlie now. this was PVM Version 3.4, dated 30 August, 1993 β vintage, but she ate and left no crumbs. slay, bye π¦β¨π
π¦ where this page comes from
- debian bookworm: pvm-dev 3.4.6-5
- ubuntu jammy: pvm-dev 3.4.6-3.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms