[Beowulf] Seg Fault with pvm_upkstr() and Linux.
Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.
Josh Zamor jzamor at gmail.comWed Mar 16 12:14:52 PST 2005
- Previous message: [Beowulf] Seg Fault with pvm_upkstr() and Linux.
- Next message: [Beowulf] Seg Fault with pvm_upkstr() and Linux.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mar 16, 2005, at 7:30 AM, Robert G. Brown wrote: > I assume that you've experimented and have no difficulty returning and > unpacking ordinary ints, strings, or raw data blocks with PVM. If so > you probably aren't making a pointer error on the master server side, > although it never hurts to check. Actually, I had tried passing ints and the like in other programs and had no problem, but when I tired to pass just a string in my factorial program, not using GMP, but still having the GMP library, it would segfault. What I hadn't tried was to create a simple test program for just sending strings using PVM. I have now written a test program that does not use the GMP and tries to send a basic string back from a child to the parent. This again will segfault on the linux machine and work just fine on the OSX machine (essentially BSD). The code that I tried is posted below. For convenience I have also posted the source of this test program, my simple factorial program, Makefiles, and script outputs from both OSX and the linux machine at the following address: http://www.cet.nau.edu/~jrz4/pvmTest/ --strPVM.c-- #include <pvm3.h> #include <stdio.h> int main(int argc, char** argv) { int info, mytid, myparent, child[2]; 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) { char* retStr; info = pvm_recv(-1, 11); info = pvm_upkstr(retStr); printf("Recieved return string: %s\n", retStr); } pvm_exit(); return 0; } else { /* Child follows */ char str[3]; str[0] = 'a'; str[1] = 'b'; str[3] = (char)0; pvm_initsend(PvmDataDefault); pvm_pkstr(str); pvm_send(myparent, 11); pvm_exit(); return 0; } } Also, for the character array "str" in the child segment above, I have tried using malloc to create the memory, and using const char arrays as well. While all of these methods give seg faults on the linux machine, the above way was the only way that I tried that worked and didn't give a bus error on Mac OSX. Thanks again.
- Previous message: [Beowulf] Seg Fault with pvm_upkstr() and Linux.
- Next message: [Beowulf] Seg Fault with pvm_upkstr() and Linux.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Beowulf mailing list
