ѧ
JOURNAL OF SOFTWARE
1999ꡡ109ڡVol.10No.91999



pC++ݻ㷨оĽ*
ʯˡ
ժҪģмǵǰоһȵ.ڴӦݲ,Ǹزݲм㷽ʵ.ݲм,ӰٶȵһҪݵĻ״.һֽΪеݲԡpC++ݻ㷨˷,ָ䲻֮,ͬʱһָĽݻ㷨.ʵ,㷨ԭ㷨ȾԵԽ.
ؼʡģм,ݲ,,pC++,ݻ㷨.
ͼšTP311
Research and Improvement on the Data Distribution Algorithm of pC++ Language
SHI WeiFANG Bin-xing HU Ming-zeng
(Department of Computer Science and EngineeringHarbin Institute of TechnologyHarbin150001)
AbstractLarge-scale parallel computing is a hot spot of current research. Because most of the scientific calculation is data parallel calculation, people would like to solve real problems by means of data parallelism. As for data parallel calculation, one of the critical factors that influence the running performance is the status of data distribution. In this paper, the authors analyze the data distribution algorithm of a prevalent object-oriented data parallel languagepC++ and point out the weaknesses of it. Then they present an improved algorithm. The results of the experiment show that it is superior to the former algorithm.
Key wordsLarge-scale parallel computing, data parallel, object-oriented, pC++, data distribution algorithm.
ģмҪΪкݲ.Ҫݲм.
ݲмصǣȶݿռл,ȻݵĲͬλûּռ,ԱݽƵĲ.,ݲٶȵĹؼھܵؾȻ,ʹؾ.ݻ㷨ݵĻ,˽ֱӰ첢г.
ǰеݲҪHPF1,pC++2ݵ,Ǿ֧BLOCK,CYCLIC,WHOLEֲ.㷺Ӧ,pC++ݲҲõ˸Ϊ㷺Ӧ,ڹܶлڶнһо3.ǶpC++Եݻ㷨˷,ܽϺõشBLOCK,CYCLIC,ڴWHOLEʱ,ȴصĸز.ˣһݻ㷨,WHOLEֲҲܽϺõؽд.
ĵ1ڼҪC++ԵһݲչpC++.2ڽݻ㷨.3ڸǵݻ㷨.ʵ.
1pC++Լ
pC++C++ԵĻCollectionṹ.򵥵˵,Collectionͬಢļ.Щĳһʵ.һCollectionҪṹ.
.׼align object
׼Collectionڲݽṹ,CollectionеԪӳ䵽һɻֶģ.
.ֶdistribution object
ֶһģ,ѸģBLOCK,CYCLICWHOLEķʽֵ.
pC++,ݻ㷨Ҫνϻֵ.pC++֧3ַֻʽ:BLOCK,CYCLICWHOLE.BLOCKָݴĸCollectionԪػֳĿ,Ȼڸ.CYCLICǰCollectionڵԪεطõ.WHOLEֱʾά뻮.pC++ݻ㷨ڴWHOLEʱݻֲ.
2pC++Եݻ㷨
ԶάCollectionΪ˵pC++ݻ㷨.
: ÿһάķֲʽСԪ±
: Ĵ
(1)p=ƽ;
(2)switch (1άķֲʽ){
(3)case BLOCK:
(4)q=1άĴС/p;
(5)index1=Ԫصĵ1ά±/q;break;
(6)case CYCLIC:
(7)index1=Ԫصĵ1ά±%p;break;
(8)case WHOLE:
(9)index1=0;}
(10) switch(2άķֲʽ){
(11) case BLOCK:
(12) q=2άĴС/p;
(13) index2=Ԫصĵ2ά±/q;break;
(14) case CYCLIC:
(15) index2=Ԫصĵ2ά±%p;break;
(16) case WHOLE:
(17) index2=0;}
(18) proc=index1+index2*p;
(19) return proc.
㷨CollectionĳԪص±ֵάĻַʽԼάĴСΪ,ΪԪرĴ.
Ƿһ¸㷨.Ȳһά߼,ÿάĴСǴƽ.Ȼ󣬸ÿһάĻ,Ԫص±ijӳ䵽߼,ɶӦĶά±index1index2,߼ӳ䵽ϣظԪĴproc.
BLOCKCYCLICֲ,˺Ϻõݻ,WHOLEֲȴصĸز.ͨһpC++ݻ㷨ıײ.
Collection1άBLOCKֲ,2άWHOLEֲ,ĸΪ4,CollectionԪصĸΪ8*8=64,p=2,1άֲʽΪBLOCK,2άֲʽΪWHOLE,ڴ1άֲʱ,ɵ35п֪,index1Ŀȡֵ01,ڴ2άֲʱ,ɵ1617п֪,index2ȡֵʼΪ0.,ɵ20п֪,procֵΪ01,ֵֻ0ź͵1Ŵ,23Ŵ.
3Ľݻ㷨
pC++ݻ㷨ıײ,Ƕ˸Ľ,ʾ:
: ÿһάķֲʽСԪ±
: Ĵ
(1)p=ƽ;
(2)if (1,2άΪWHOLEֲʽ)
(3){δʽpC++ͬ}
(4)
(5)if (1άΪWHOLEֲ,2άΪWHOLEֲ)
(6)switch (1άֲʽ)
(7){
(8)case BLOCK;
(9)q=1άС/;
(10) proc=1ά±/q;break;
(11) case CYCLIC:
(12) proc=1άС%;
(13) }
(14) if (1άΪWHOLEֲ,2άΪWHOLEֲ)
(15) {}
(16) if (1,2άΪWHOLEֲʽ)
(17) {proc=0;}
(18) return proc.
ǵݻ㷨Ҫ˼,WHOLEֲBLOCK,CYCLICֲʽֿԴ,BLOCKCYCLICĴpC++Ĵͬ,WHOLEֲ,ͨ߼ά,ֻþзWHOLEַʽάCollectionл,Ӷʹĸؾ.
ԶάCollectionΪ,ȿǷWHOLEֲ,û,pC++Ļַʽڶά߼Ͻл;,ֻһάWHOLEֲ,һά߼Ϸֲ,άΪWHOLEֲ,򲻶ݽл.ƹ㿪,CollectionάΪn,iάWHOLEֲ,ǽCollectionֲn-iά߼,ӶĳЩݵ.ʵ˶άCollectionݻ,ڸάCollection,Բͬķʵ.
ǵݻ㷨,ܹԵ2еӽЧĻ.ڵ2άWHOLEֲ,ǽCollectionһά߼Ͻл,߼ĴСΪ,Ľ㷨ĵ9.Collectionĵ1άе,2ά뻮.,߼֮һһӦĹϵ,procȡֵΧΪ0,3.,ͨ߼ά,ǽCollectionȵػֵ˸.
4ʵ
4̨̫ͨIBM-POWERPC-AIXվ,ǲþ֤ǵ㷨,ĶάֱBLOCKWHOLE.ʵͼ1ʾ.ͼ1ɼ,ģ,ǵݻ㷨ԭеpC++㷨ʾõ,pC++ݻ㷨ڼģʱ˸ĸزƽ,Ӷʹʱ伱.ݹģСʱ,ͨӳٶܵʱнϴӰ,pC++ݻ㷨µĸزƽʹͨڽٵĴ,ͨŲĶ⿪,ʹԺǵ㷨.ǰݲмһҪص,ˣǵݻ㷨ܹõ֧ݲм.

ͼ1
㷨pC++ʵֵ,ܾԵ,ڸмӦ,˶ݲмձ.
*оõƹί塱Ԥл.
߼飺ʯ,1973,ʿ,ҪоΪб룬ֲʽб̻.
,1960,ڣʿʦ,ҪоΪдܼϵͳṹ.
,1935,ڣʿʦ,ҪоΪܼϵͳṹд.
ͨѶϵˣʯ,150001,ҵѧѧ빤ϵ
ߵλҵѧѧ빤ϵ150001E-mail: sw@pact97a.hit.edu.cn
οף
1Koelbel C, Loveman D, Schreiber R et al. The High Performance Fortran Handbook. Cambridge, MA: MIT Press, 1994
2Gannon D, Yang S X, Beckman P. User guide for a portable parallel C++ programming system: pC++. Technical Report, Indiana University, 1994
3HPC++ Working Group. HPC++ whitepapers and draft working document. Indiana University, http: //www.extreme.indiana.edu/
ոڣ1998-07-14޸ڣ1998-11-10
