GLUT Event Handling and MPIglut
CS 481/681 2007 Lecture, Dr. Lawlor
(Regarding the homeworks: HW8 is due on Thursday, not today.
Also, HW8 problem 4 is *not* supposed to be an interactive program,
which should make your job easier. Finally, I think I'm going to
back off to giving you just one homework per week until the projects
are done--because I'm spamming myself with homeworks too!)
GLUT Event Handling
You register "event handler" callback functions with GLUT by making calls in your main routine. GLUT then calls your event handler functions when stuff happens:
glutDisplayFunc (main_display);
glutReshapeFunc (main_reshape);
glutMotionFunc (main_motion);
glutKeyboardFunc(key_going_down);
glutKeyboardUpFunc(key_going_up);
glutSpecialFunc (special_going_down);
glutSpecialUpFunc(special_going_up);
glutIdleFunc (idle_fn);
MPI Event Handling
Most MPI calls are "blocking", in that they just sit there and wait
until the communication you asked for is finished. This usually
simplifies your program, but it makes it tricky to interface MPI (which
wants to just sit there waiting on the network) with other interfaces
like GLUT (which wants to just sit there waiting on the user)!
There is a sort of solution for calls like MPI_Recv called MPI_Irecv,
which "initiates" a receive, but doesn't wait for it to finish.
This call fills out an MPI_Request object, which you can later test
with MPI_Test or just finish up with MPI_Wait.
Unfortunately, MPI does not include an MPI_Ibcast, which would be a useful way for MPI to wait on messages from processor 0 while still handling GLUT events normally.
The rather unsatisfactory solution I'm currently using is to funnel
*all* events through processor 0, and have everybody wait inside a big
blocking MPI_Bcast. This actually works OK as long as I broadcast
out "idle" messages now and then.
MPIglut--parallel rendering without pain
MPIglut (~olawlor/research/powerwall/mpiglut) is our little research
program that tries to wrap all the MPI horror beneath a 100%
GLUT-compatible interface. For example, the MPIglut version
of "glutInit" actually calls MPI_Init internally. We do this via
a "#define glutInit mpiglutInit" in our header file.
We are *actively* developing mpiglut, so please report any problems you have with it!
Powerwall Setup
There are some nice photos and good technical info on the CS powerwall page or in ~/README.txt.