A bundle of data sent, via a proxy, to another chare. A message is a special kind of heap-allocated C++ object.
It depends on the application. We've found parameter marshalling to be less confusing and error-prone than messages for small parameters. Nevertheless, messages can be more efficient, especially if you need to buffer incoming data, or send complicated data structures (like a portion of a tree).
You can't pass pointers across processors. This is a basic fact of life on distributed-memory machines.
You can, of course, pass a copy of an object referenced via a pointer across processors-either dereference the pointer before sending, or use a varsize message.
No. You must allocate messages with new.
Yes, or you will leak memory! If you receive a message, you are responsible for deleting it. This is exactly opposite of parameter marshalling, and much common practice. The only exception are entry methods declared as [nokeep]; for these the system will free the message automatically at the end of the method.
No, this will certainly corrupt both the message and the heap! Once you've sent a message, it's not yours any more. This is again exactly the opposite of parameter marshalling.
Variable-length messages can contain arrays of any type, both primitive type or any user-defined type. The only restriction is that they have to be 1D arrays.
No, this will certainly corrupt the heap! These arrays are allocated in a single contiguous buffer together with the message itself, and is deleted when the message is deleted.
Priorities are special values that can be associated with messages, so that the Charm++ scheduler will prefer higher priority messages when choosing a message to deliver. Priorities are respected by Charm++ as much as possible: until there are higher priority messages in the queue, lower priority message will never be delivered. Nevertheless, this is not a guarantee, and a lower priority message can be delivered before a higher priority one.
Messages with priorities are typically used to perform optimizations on the order of the computation.
For integer priorities, the smaller the priority value, the higher the priority of the message. Negative value are therefore higher priority than positive ones. To enable and set a message's priority there is a special new syntax and CkPriorityPtr function; see the manual for details. If no priority is set, messages have a default priority of zero.
June 29, 2008
Charm Homepage