From: cnews@umr.edu (UMR Usenet News Post)
Subject: CM-5 CMMD problems
Apparently-To: comp-parallel@cis.ohio-state.edu
Organization: University of Missouri -- Rolla
Date: Fri, 22 Jan 1993 22:57:48 GMT



	I have some questions regarding the CMMD (v2.0) library on the CM-5.

	We are trying to learn how to use the CMMD_send/receive_packet()
routines but we keep getting bus errors on the nodes.  Below is a simple
program that is supposed to send a packet to each node and to wait for that
node to respond.  The source code is followed by the output of pndbx after
the program has been stoped ("where" in pndbx).  Is this a bug in the routines
or are we not using them correctly? (If not does anyone have any sample
code using the packet routines that we could look at?) This has been reported
to the system people and to the local news group where we work, but we have not
received any explanation as to what is wrong.

	The second problem is with the fprintf() routine from the nodes.  Our
programs seem to hang if we have a fprintf(stderr,...) call after any message
passing calls.  Below is the code that illustrates our problem.  With the
first CMMD_sync_with_host() call removed, we get a bunch of '1's followed by 
a bunch of '2's.  With the call not removed, we get a bunch of ones then the
program just hangs (no crashes, etc.).  Is there something wrong with this
program?  (I can get dbx/pndbx info if anyone would like it.)

	We are new at using the CM-5 (and, personally, new at parrallel
programing/archetectures) and are hesitant to bug our systems folks with
problems that may be programming errors.  Any and all help/comments/code
will be greatly appreciated.


	---Larry Coffin
		lcoffin@clciris.chem.umr.edu



***************************************************************

----- ping.cp.c -----

#include <stdio.h> 
#include <sys/types.h> 
#include <cm/cmmd.h> 
#include <cm/cmmd-io.h>
#include <cmsys/cm_memory.h>


main(argc, argv)
int argc;
char **argv;
{
    int reply, i;

    CMMD_enable();

    for (i = 0; i < CMMD_partition_size(); i++){
	while (CMMD_send_packet(i, 1, &i, 0) != TRUE){
		/*printf("Packet not sent\n"); */
	}
	while(CMMD_receive_packet(&reply) < 0);
	printf("Packet received from node %i\n", reply);
    }
    fprintf(stderr,"Bye!\n");

}

----- ping.pn.c -----

#include <stdio.h>
#include <cm/cmmd.h>
#include <cm/cmmd-io.h>

#define NUM_ELEM 32

main()
{
    int val, my_node;
 
    CMMD_enable_host();
    my_node = CMMD_self_address();
    
    while(CMMD_receive_packet(&val) < 0);
    
    val = my_node;
    
    while(CMMD_send_packet(CMMD_host_node(), 1, &val, 0) != TRUE);

}

----- output from pndbx using "where" after the program stops -----

signal BUS (bus error) in cmmd_send_and_receive_assem at 0x18054
cmmd_send_and_receive_assem+0x13c:      ldd     [%g4 + 32], %f4
cmmd_send_and_receive_assem() at 0x18054
cmmd_receive_some_packets(), line 1106 in "message.sh.c"
cmmd_handler(), line 1325 in "message.sh.c"
CM_message_func() at 0x2b1c0
signal() at 0xf80026bc
main(), line 14 in "/home/D/lenore/lcoffin/C/cmmd/packets/ping/ping.pn.c"

******************************************************************

----- print.cp.c -----

#include <stdio.h>
#include <sys/types.h> 
#include <cm/cmmd.h> 
#include <cm/cmmd-io.h>
#include <cmsys/cm_memory.h>

main ()
{
  fprintf(stderr,"Starting program....\n");
  CMMD_enable();


  CMMD_sync_host_with_nodes();
/**/

  CMMD_sync_host_with_nodes();
  exit(0);
}

----- print.pn.c -----

#include <stdio.h>
#include <cm/cmmd.h>
#include <cm/cmmd-io.h>


main()
{
  CMMD_enable_host();

  if(CMMD_fset_io_mode(stderr, CMMD_independent) != 0){
    CMPN_panic("PN_Main: Error setting io_mode\n");
  }

  fprintf(stderr,"1\n");


  CMMD_sync_with_host();
/**/

  fprintf(stderr,"2\n");
  CMMD_sync_with_host();
}






Newsgroups: comp.parallel