[Beowulf] Stupid MPI programming question

Clements, Brent M (SAIC) brent.clements at bp.com
Wed Sep 27 20:47:17 EDT 2006


Hey Guys,
 
I've been sitting here working for the past 48 hours and I'm fighting a stupid bug in some mpi code I'm working on
 
How do I broadcast a char string to my slave mpi processes? And how do I receive that char string and print it out on my slave mpi process.
 
 
This is what I have in my code(some things have been removed)
 
#define MASTER_RANK 0
 
char* mystring;
 
mystring = "some test";
 
MPI_Bcast(&mystring, sizeof(basedir), MPI_CHAR, MASTER_RANK, MPI_COMM_WORLD);
 
in my slave process code I have this
 
printf("my string I received: %s", mystring);
 
 
Am I doing something wrong? Or if someone has some sample code they can point me to on how to send a string to a slave mpi process and have that slave mpi process print out the string..that would be even better. That way..I relearn MPI basics 101
 
 
This message may contain confidential and/or privileged information.  If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein.  If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.

_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list