[Beowulf] Seg Fault with pvm_upkstr() and Linux.

Robert G. Brown rgb at phy.duke.edu
Wed Mar 16 13:34:58 PST 2005


On Wed, 16 Mar 2005, Josh Zamor wrote:

(Stuff).

OK, it works perfecto-mundally.  See code below:

#include <pvm3.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char** argv) {
     int info, mytid, myparent, child[2];
     char buf[1024];

     if(mytid = pvm_mytid() < 0) {
	pvm_perror("Could not get mytid");
	return -1;
     }

     myparent = pvm_parent();
     if((myparent < 0) && (myparent != PvmNoParent)) {
	pvm_perror("Some odd errr for my parent");
	pvm_exit();
	return -1;
     }

     /* I am parent */
     if(myparent == PvmNoParent) {
	info = pvm_spawn(argv[0], NULL, PvmTaskDefault, NULL, 2, child);

	for(int i = 0; i < 2; ++i) {
	    if(child[i] < 0)
		printf(" %d", child[i]);
	    else
		printf("t%x\t", child[i]);
	}
	putchar('\n');

	if(info != 2) {
	    pvm_perror("Kids didn't all spawn!");
	    pvm_exit();
	    return -1;
	}

	for(int i = 0; i < 2; ++i) {
	    info = pvm_recv(-1, 11);
	    info = pvm_upkstr(buf);
	    printf("Received return string: %s\n", buf);
	}

	pvm_exit();
	return 0;
     } else { /* Child follows */
        strcpy(buf,"Testing PVM's string line.");
	pvm_initsend(PvmDataDefault);
	pvm_pkstr(buf);
	pvm_send(myparent, 11);
	pvm_exit();
	return 0;
     }
}

rgb at lilith|B:1074>gcc -O3 -std=c99 -g -I/usr/share/pvm3/include
-L/usr/share/pvm3/lib/LINUXI386 -o pvm_test pvm_test.c -lpvm3 -lm 
rgb at lilith|B:1075>/tmp/pvm_test 
t4000e  t4000f
Received return string: Testing PVM's string line.
Received return string: Testing PVM's string line.


(So it was probably one or the other of the bugs I pointed out.)

   rgb

-- 
Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu





More information about the Beowulf mailing list