Abstract A Flexible Class of Parallel Matrix Multiplication Algorithms

  • 格式:pdf
  • 大小:128.12 KB
  • 文档页数:7

AFlexibleClassofParallelMatrixMultiplicationAlgorithmsJohnGunnelsCalvinLinGregMorrowRobertvandeGeijnDepartmentofComputerSciencesTheUniversityofTexasatAustinAustin,TX78712

AbstractThispaperexplainswhyparallelimplementationofma-trixmultiplication—aseeminglysimplealgorithmthatcanbeexpressedasonestatementandthreenestedloops—iscomplex:Practicalalgorithmsthatusematrixmultiplica-tiontendtousematricesofdisparateshapes,andtheshapeofthematricescansignificantlyimpacttheperformanceofmatrixmultiplication.Weprovideaclassofalgorithmsthatcoversthespectrumofshapesencounteredanddemonstratethatgoodperformancecanbeattainediftherightalgo-rithmischosen.Whilethepaperresolvesanumberofis-sues,itconcludeswithdiscussionofanumberofdirectionsyettobepursued.

1IntroductionOverthelastthreedecades,anumberofdifferentap-proacheshavebeenproposedforimplementingmatrix-matrixmultiplicationondistributedmemoryarchitecturesTheseincludeCannon’salgorithm[4],broadcast-multiply-roll[12,11],andgeneralizationsofbroadcast-multiply-roll[8,13,2].Theapproachnowconsideredthemostpracti-cal,knownasbroadcast-broadcast,wasfirstproposedbyAgarwaletal.[1],whoshowedthatasequenceofparallelrank-kupdatesisahighlyeffectivewaytoparallelize.ThissameobservationwasindependentlymadebyvandeGeijnandWatts[17],whointroducedtheScalableUniversalMatrixMultiplicationAlgorithm(SUMMA).Inadditiontocomputing,SUMMAimplementsandasasequenceofmatrix-panel-of-vectorsmultiplications,andasasequenceofrank-kupdates.Laterwork[5]showedhowthesetech-

ThisresearchwassupportedprimarilybythePRISMproject(ARPAgrantP-95006)andtheEnvironmentalMolecularSciencesconstructionprojectatPacificNorthwestNationalLaboratory.AdditionalsupportcamefromtheNASAHPCCProgram’sEarthandSpacesSciencesProject(NRAGrantsNAG5-2497andNAG5-2511),andtheIntelResearchCoun-cil.EquipmentwasprovidedbytheNationalPartnershipforAdvancedComputationalInfrastructure,theUniversityofTexasCompuationCen-ter’sHighPerformanceComputingFacility,andtheTexasInstituteforComputationalandAppliedMathematics.

niquescanbeextendedtoalargeclassofcommonlyusedmatrix-matrixoperationsthatarepartoftheLevel-3BasicLinearAlgebraSubprograms(BLAS)[9].Thesepreviouseffortshavefocusedprimarilyonthespecialcasewheretheinputmatricesareapproximatelysquare.RecentworkbyLi,etal.[15]createsa“poly-algorithm”thatchoosesbetweenalgorithms(Cannon’s,broadcast-multiply-roll,andbroadcast-broadcast).Empir-icaldatashowsomeadvantagefordifferentshapesofmeshes(e.g.squarevsrectangular).However,sincethethreealgorithmsarenotinherentlysuitedtospecificshapesofmatrices,limitedbenefitisobserved.Wepreviouslyobserved[16]theneedforalgorithmstobesensitivetotheshapeofthematricesandhintedthataclassofalgorithmsnaturallysupportedbytheParallelLin-earAlgebraPackage(PLAPACK)providesagoodbasisforsuchshape-adaptivealgorithms.Thus,anumberofhy-bridalgorithmsarenowpartofPLAPACK.Thisobserva-tionwasalsomadebytheScaLAPACK[6]project,andin-deedScaLAPACKincludesanumberofmatrix-matrixop-erationsthatchoosealgorithmsbasedontheshapeofthematrix.However,sinceScaLAPACKviewsvectorsasspe-cialcasesofmatricesanddistributesvectorslikematrices,someofthealgorithmswepresentcaninherentlynotbeimplementedusingScaLAPACK.Thispaperdescribesandanalyzesaclassofparallelma-trixmultiplicationalgorithmsthatnaturallylendsitselftohybridization.Theanalysiscombinestheoreticalresultswithempiricalresultstoprovideacompletepictureofthebenefitsofthedifferentalgorithmsandhowtheycanbecombinedintohybridalgorithms.Anumberofsimplifi-cationsaremadetofocusonthekeyissues.Havingdoneso,anumberofextensionsareidentifiedforfurtherstudy.

2DataDistributionForallalgorithms,wewillassumethattheprocessorsarelogicallyviewedasameshofcomputationalnodeswhichareindexed,and,sothatthetotalnumberofnodesis.Physically,thesenodesareconnectedthroughsomecommunicationnetwork,whichcouldbeahypercube(InteliPSC/860),ahigherdimensionalmesh(IntelParagon,CrayT3D/E)oramultistagenetwork(IBMSP2).

PhysicallyBasedMatrixDistribution(PBMD).Wehavepreviouslyobserved[10]thatdatadistributionsshouldfocusonthedecompositionofthephysicalproblemtobesolved,ratherthanonthedecompositionofmatrices.Typ-ically,itistheelementsofvectorsthatareassociatedwithdataofphysicalsignificance,andsoitistheirdistributiontonodesthatisimportant.Amatrix,whichisadiscretizedoperator,merelyrepresentstherelationbetweentwovec-tors,whicharediscretizedspaces:.Sinceitismorenaturaltostartbydistributingtheproblemtonodes,wefirstdistributeandtonodes.Thematrixisthendistributedsoastobeconsistentwiththedistributionofand.Todescribethedistributionofthevectors,assumethatandareoflengthand,respectively.Wewilldistributethesevectorsusingadistributionblocksizeof.Forsimplicityassumeand.Partitionandsothat