I am original, reprinted please indicate the source! Welcome to the Giraph technical exchange group: 228591158 this article aims to describe how to compile and distribute the GPS source code to the Worker nodes in detail. The following uses the GraphColoring algorithm as an example. The first three articles based on GPS are described in this article. 1. First, modify the source code on the Master (test150. G
I am original, reprinted please indicate the source! Welcome to the Giraph technical exchange group: 228591158 this article aims to describe how to compile and distribute the GPS source code to the Worker nodes in detail. The Graph Coloring algorithm is used as an example. The first three articles based on GPS are described below. 1. First, modify the source code on the Master (test150. G
I am original, reprinted please indicate the source! Welcome to joinGiraph technical exchange group228591158
This article aims to describe how to compile and distribute the GPS source code to each Worker node. The Graph Coloring algorithm is used as an example. The first three articles based on GPS are described below.
1. First, modify the source code on the Master (test150. Graph Coloring algorithm source code path: gps. examples. coloring package, mainly modify the ColoringVertex. java class. In Section (MIS_1), this algorithm selects UNDECIDED state vertices Based on the probability of vertex output. The source code is as follows:
if (ColoringVertexType.NOT_IN_SET == value.type|| ColoringVertexType.IN_SET == value.type) {return;}double probability = getNeighborsSize() > 0 ? 1.0 / ((double) 2*value.numRemainingNeighbors) : 1;if (Math.random() <= probability) {value.type = ColoringVertexType.SELECTED_AS_POSSIBLE_IN_SET;if (value.numRemainingNeighbors > 0) {ColoringMessage newSelectedAsPossibleMessage = ColoringMessage.newNeighborSelectedAsPossibleMessage(getId());for (int neighborId : getNeighborIds()) {if (neighborId >= 0) {sendMessage(neighborId, newSelectedAsPossibleMessage);}}}}Modify the following to: select all UNDECIDED state vertices, instead of the probability selection. The source code after modification is as follows:
if (ColoringVertexType.NOT_IN_SET == value.type|| ColoringVertexType.IN_SET == value.type) {return;}//double probability = getNeighborsSize() > 0 ? 1.0 /// ((double) 2*value.numRemainingNeighbors) : 1;//if (Math.random() <= probability) {//value.type = ColoringVertexType.SELECTED_AS_POSSIBLE_IN_SET;if (value.numRemainingNeighbors > 0) {ColoringMessage newSelectedAsPossibleMessage = ColoringMessage.newNeighborSelectedAsPossibleMessage(getId());for (int neighborId : getNeighborIds()) {if (neighborId >= 0) {sendMessage(neighborId, newSelectedAsPossibleMessage);}}}//}2. Because the GPS source code has been compiled and the Jar package and other files have been distributed to the Worker nodes in the cluster, this step deletes the previous files. Delete the gps-0.0.1-slave.tar.gz, gps_node_runner.jar, and classes folders under the Master node trunk directory, and delete the conf packages, gps_node_runner.jar, libs, scripts, and logs folders under the Worker node trunk directory.
3. Refer to the installation notes of the GPS-Graph Processing System cluster (1) and recompile and distribute Jar packages and other files.
The following is an example of my script. Because my script is used in the middle, it cannot be used directly, but you can refer to it. Directory of the script:/home/gougou/GPS/trunk.
cd /home/gougou/GPS/trunk# delete master filesrm -rf gps_node_runner.jarrm -rf classesrm -rf gps-0.0.1-slave.tar.gz# delete worker files. the Shell writed by myself.cd /home/gougou/ShellUtils./deleteDirectory.sh /home/gougou/GPS/trunk/conf./deleteDirectory.sh /home/gougou/GPS/trunk/gps-0.0.1-slave.tar.gz./deleteDirectory.sh /home/gougou/GPS/trunk/gps_node_runner.jar./deleteDirectory.sh /home/gougou/GPS/trunk/libs./deleteDirectory.sh /home/gougou/GPS/trunk/scripts/# compile GPS source codecd /home/gougou/GPS/trunkcd local-master-scripts# generate gps_node_runner.jar and classes under trunk directory./make_gps_node_runner_jar.sh# generate gps-0.0.1-slave.tar.gz under trunk directory./make_gps_tar_gz.shcd ../master-scriptscp slaves tempcp slaves-12 slaves./copy_and_untar_gps_tar_to_slaves.sh 12mv temp slaves
4. Run the Graph Coloring algorithm in the trunk/master-scripts directory. The command is as follows:
./start_gps_nodes.sh 2 GC-Test5-1 \"-ifs /user/gougou/GC-Test5/gc-5.txt \-hcf /home/gougou/hadoop-1.0.3/conf/core-site.xml \-jc gps.examples.coloring.JobConfiguration \-mcfg /machine-configs/test_machine_config_2.cfg \-log4jconfig /home/gougou/GPS/trunk/conf/log4j.config"
Complete!