[MPICH] Sending, receiving and braodcasting a user defined C++ class

Yann Golanski yann at kierun.org
Wed Dec 21 10:00:50 CST 2005


I'm looking for advice here and hopefully this could be included into
an FAQ or whatnot. 

The attached code move data from a class in processor 0 to all the
other in such a way as said data ends up in the same type of class at
the end.  

My questions are:
  1- Is there a better way of doing this?
  2- How can my code be optimised?
  3- Any other comments?

Thanks.

-- 
yann at kierun.org                  -=*=-                      www.kierun.org
    PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cc
Type: text/x-c++src
Size: 3381 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20051221/cebc9073/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.h
Type: text/x-chdr
Size: 620 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20051221/cebc9073/attachment.h>
-------------- next part --------------
## MAKEFILE
# change the values of the below variables if you nee to.
PREFIX=$(HOME)

# Don't change anything below unless you know what you are doing.
# Use: C_INCLUDE_PATH=/usr/local/include and LIBRARY_PATH=/usr/local/lib
# http://www.gnu.org/software/make/manual/html_mono/make.html#SEC103

SRCS    = main.cc 
OBJS    = $(SRCS:.cc=.o)
HEADERS = main.h
EXE     = a.out

CXX     = mpicxx

SYSFLAG =
INCLUDES=-I/usr/local/include
CXXFLAGS=$(SYSFLAG) $(INCLUDES) -Wall -ansi -ggdb

LFLAGS=-L/usr/local/lib
LNFLAGS=-lm $(LFLAGS)

all : main

main: $(OBJS)
	$(CXX) -o $(EXE) $(LNFLAGS) $(LIBXML_CFLAGS) $(OBJS)

$(OBJS): $(HEADERS)

install:
	$(CXX) -o $(EXE) $(LNFLAGS) $(OBJS)
	install -d $(PREFIX)/bin
	install $(EXE) $(PREFIX)/bin/

deinstall:
	rm -f $(PREFIX)/bin/$(EXE)

linecount:
	/bin/ls *.*[ch] */*.*[ch] | xargs wc -l

clean :
	rm -f *.o rsp_mainlog.*[0-9]\
        chronos/*.o \
	entrenched/*.o \
	traveller/*.o \
	xml/*.o \
	$(EXE) $(EXE).core


More information about the mpich-discuss mailing list