box
所属分类:超算/并行计算
开发工具:C/C++
文件大小:3KB
下载次数:103
上传日期:2008-06-11 21:17:03
上 传 者:
shmily7901
说明: 经典的一维装箱问题(Bin Packing Problem)是指,给定 件物品的序列 ,物品 的大小 ,要求将这些物品装入单位容量1的箱子 中,使得每个箱子中的物品大小之和不超过1,并使所使用的箱子数目 最小。
(Classic one-dimensional bin-packing problem (Bin Packing Problem) means that a given sequence of items, item size, request these items into one unit of capacity of the box, making the items for each box size and non- more than one, and the number used in the smallest box.)
文件列表:
16-3\box.c (12291, 2003-07-15)
16-3\data1 (31, 2003-07-14)
16-3 (0, 2008-05-21)
Example:
编译:mpicc -o box box.c -lm
运行:(group_size为处理器个数)
mpirun -np group_size box 这里运行mpirun Cnp 8 box
运行结果:
input a[8]:
0.200000
0.500000
0.400000
0.200000
0.300000
0.300000
0.100000
0.800000
d 0 1:1
d 0 2:3
d 0 3:6
d 0 4:8
processor number is 8
my_rank 4
number 4 goods put into box 2
processor number is 8
my_rank 1
number 1 goods put into box 1
processor number is 8
my_rank 5
number 5 goods put into box 2
processor number is 8
my_rank 7
number 7 goods put into box 3
processor number is 8
my_rank 2
number 2 goods put into box 1
processor number is 8
my_rank 3
number 3 goods put into box 2
processor number is 8
my_rank 8
number 8 goods put into box 4
processor number is 8
my_rank 6
number 6 goods put into box 3
说明:物品的体积存在文件data1中
近期下载者:
相关文件:
收藏者: