Gather type efficient implementation

User 97 | 7/10/2014, 9:59:35 PM

Hi,

I am trying to make the gathered message more efficient. I customize the message returned from the gather() function, and the message contains dynamically allocated matrices using Eigen::MatrixXd. If this message is created every time in the gather function, it means each message would require a heap memory allocation and would tend to slow down the execution. Therefore, I attempted to put this message in the edge class of the graph, and simply modify its values in the gather() function.

The strange things happen: it takes more time with this approach and the aggregated results are wrong.

This is what I did:

mymessage gather(){ // 1. modify edge.data().message edge.data().message.matrix = (something new)

	// return the message in the edge
	return edge.data().message;

}

All these messages will be gathered by the += operator in GraphLab. However, the results I obtain are wrong.. and also it takes longer time than if I do the following:

mymessage gather(){ // 1. create a new message mymessage msg; msg = (something new)

	// return the message in the edge
	return msg;

}

Is it not advised to aggregate over the information in the edge class? In case the messages are bit and require heap, are there ways to get around it?

Thanks a lot!

Regards, Karida

No Comments