Newsgroups: comp.parallel.pvm
From: john@elroy.jpl.nasa.gov (John Wright)
Subject: Re: Halting the pvmd within your program
Organization: Image Analysis Systems Group, JPL
Date: 11 Jan 1996 15:15:38 GMT
Message-ID: <4d39ir$6af@elroy.jpl.nasa.gov>

In article <4d0t0j$bik@hpcvsnz.cv.hp.com>,
Jonathan King <jking@cv.HP.COM> wrote:
>Howdy folks.
>
>I know I've seen the solution to this problem here before.  
>I want my application to be PVM transparent, and starting 
>the pvmd with pvm_start_pvmd works great.  However, as I 
>recall, the function pvm_halt halts the calling program as 
>well.  Can somebody re-post the solution?
>
>Thanks.
>Jon King
>

This is the solution I use:

int pvm_halt(void)
{
        char    *tname, *aname, command[1024];

        tname = getenv("PVM_ROOT");
        if(!tname) {
                fprintf(stderr," PVM Root Directory not set -- check
.cshrc\n");                return(PvmCantStart);
        }
        aname = getenv("PVM_ARCH");
        if(!aname) {
                fprintf(stderr," PVM Architecture Environment not set --
check .cshrc\n");
                return(PvmCantStart);
        }

        fprintf(stderr,"Shutting down PVM net.\n");
        sprintf(command,"echo halt | %s/lib/%s/pvm >/dev/null", tname,
aname);
        system(command);
        return(NET_OFFLINE);
}

Basically it just runs the pvm console and tells it to halt.  Be
sure to check the calling program out of pvm before calling this
or it will kill it anyway (I think).

John

-- 
john.r.wright@jpl.nasa.gov
http://www-dial.jpl.nasa.gov/~john

