Newsgroups: comp.parallel.pvm
From: Clarence Yuen <s935715@mailserv.cuhk.hk>
Subject: Problems in some PVM functions and config. ( A new user question)
Organization: The Chinese University of Hong Kong
Date: 9 Feb 1996 08:05:31 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <4fev8b$n4d@hpg30a.csc.cuhk.hk>

    I am a new user to the PVM. And I am using it in my final year 
project. I find some problems in PVM function pvm_config()
and pvm_tasks(). Can anyone tell me what the problem in my program and how 
to solve it. Thank you. 

(1) I have add serval hosts. When I call pvm_config() to get the host 
information in my program. The function return me the information of one 
host only. Why? And what should I do to get all host's information.

(2) I have a master program which spawn a number of tasks. It then get the 
task information using the function pvm_tasks. The same, this function 
give me back information of 1 task only. What is the reason? What should I 
do?

 
Here is part of my testing program:
#include<stdio.h>
#include"pvm3.h"
#define SLAVENAME "slave"

main()
{
 int info;
 struct pvmhostinfo *inform[16];           /* array of pointers*/
 struct pvmtaskinfo *taskinform[32];
 int tids[32];				/* slave task ids */
 int nhost, narch;
 int numt,nproc=5;



 /* getting host info */
 info=pvm_config(&nhost,&march,inform);
 for(i=0;i<nhost;i++)
   {
    if(inform[i]!=null)
      printf("host name:%s\n",inform[i]->hi_name);
    else
      printf("null pointer\n");
   }

 /* spawn task*/
 numt=pvm_spawn(SLAVENAME, (char**)0, 0, "", nproc, tids);
 if( numt < nproc )
   {
    printf("Trouble spawning slaves. Aborting. Error codes are:\n");
    for( i=numt ; i<nproc ; i++ )
      {
       printf("TID %d %d\n",i,tids[i]);
       pvm_kill( tids[i] );
      }
    pvm_exit();
    exit();
   }
 
 /* getting task information */
 info=pvm_tasks(0,&ntask,ptr2);
 for( i=0; i<ntask;i++)
   {
    if(taskinform[i]!=NULL)
      printf("info:%d\n",taskinform[i]->ti_host);
    else printf("null pointer\n");
   }

 /* end of test */

 exit();
}

  In addition, if my PVM_ROOT is not in my home directory but a public 
/usr directory, which I cannot white anything on it. What should I set the 
config so that the PVM knows hows to find my own PVM program which is in 
the directory $HOME/pvm3/bin/$PVM_ARCH

Thank you for you help.

Clarence Yuen Pui Ho 
Physics Dept. CUHK



