OpenGL vs. OpenCL, which to choose and why?
文章推薦指數: 80 %
The "feature" that OpenCL is designed for general-purpose computation, while OpenGL is for graphics. You can ... Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore OpenGLvs.OpenCL,whichtochooseandwhy? AskQuestion Asked 10years,9monthsago Modified 1year,5monthsago Viewed 92ktimes 86 37 WhatfeaturesmakeOpenCLuniquetochooseoverOpenGLwithGLSLforcalculations?Despitethegraphicrelatedterminologyandinpracticaldatatypes,isthereanyrealcaveattoOpenGL? Forexample,parallelfunctionevaluationcanbedonebyrenderingatoatextureusingothertextures.Reducingoperationscanbedonebyiterativelyrendertosmallerandsmallertextures.Ontheotherhand,randomwriteaccessisnotpossibleinanyefficientmanner(theonlywaytodoisrenderingtrianglesbytexturedrivenvertexdata).IsthispossiblewithOpenCL?WhatelseispossiblenotpossiblewithOpenGL? openglopenclgpgpu Share Follow editedOct26,2011at19:17 MichaelDurrant 90k9191goldbadges307307silverbadges470470bronzebadges askedOct26,2011at18:57 dronusdronus 10.1k88goldbadges5151silverbadges7575bronzebadges 5 1 AnotherinterestingquestionwouldbeifOpenGLcanoffersomethingthatOpenCLcan't.Forexample,OpenGLwillautomaticallyinterpolatevertexdatathathasbeendeclaredwiththevarying-keyword,foryou.HowwouldyouachievethecorrespondingthinginOpenCL? – HelloGoodbye Jan12,2014at1:53 Ithinkthatwouldeasilybepossiblebyusinginterpolationbysomeindexgiventothecomputekernelforeveryinvocation. – dronus Jan12,2014at11:41 1 Wehave2015,stillnoreliableaccessofOpenCLonallplatforms,stillcuriouswhatqualityofcomputationcanbeachievedbyOpenCLbutnotOpenGL2.0. – dronus Apr11,2015at7:43 1)OpenCLdevicecanbeacpu,withoutanygpusandstillworkingwheregraphicsrenderfailsatall. – xakepp35 Jul18,2017at6:34 2)Considerwhichstackisthinner,e.gonbarebonelinuxkernel?OpenCLwhichrequiresonlysimplethinglikedriver,amdgpu-pro,shippedwithallnesesarylibs(ididOpenCLminerfirmwarewithonly50mbfootprint).Orrenderer(150+mb)whichrequiresmoremessing,severalheavyframeworks,xorgsandsoon,andthingsaredonelikeinsidemesa3d/galliumandsoon.whatisitallfor?ifyourtaskonlyistocomputeandyouhavenorunningxserver,and,even,nomonitorattached.so,basically,GLismore"junk-overloaded"thanCL,inordertosupportall-and-everythingdevelopedforyears. – xakepp35 Jul18,2017at6:41 Addacomment | 11Answers 11 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 68 OpenCLiscreatedspecificallyforcomputing.WhenyoudoscientificcomputingusingOpenGLyoualwayshavetothinkabouthowtomapyourcomputingproblemtothegraphicscontext(i.e.talkintermsoftexturesandgeometricprimitivesliketrianglesetc.)inordertogetyourcomputationgoing. InOpenCLyoujustformulateyoucomputationwithacalculationkernelonamemorybufferandyouaregoodtogo.ThisisactuallyaBIGwin(sayingthatfromaperspectiveofhavingthoughtthroughandimplementedbothvariants). Thememoryaccesspatternsarethoughthesame(yourcalculationstillishappeningonaGPU-butGPUsaregettingmoreandmoreflexiblethesedays). Butwhatelsewouldyouexpectthanusingmorethanadozenparallel"CPUs"withoutbreakingyourheadabouthowtotranslate-e.g.(sillyexample)FouriertoTrianglesandQuads...? Share Follow answeredOct26,2011at19:08 cli_hltcli_hlt 6,93822goldbadges2525silverbadges2222bronzebadges 6 1 FouriertoTrianglesandQuads...wellwithasimplescaffoldofrenderingonelargequadontoatexturewejusthaveasimpleparallelmappingofoneormorelargememoryblockstoanother.Withtexturesofdifferentscaleitsalsoeasytomapadifferentamount(ususally2^n)ofvaluesontoanother.ThatsnottoomuchGLcodeandfitsalargeareaofproblems.SoIliketoknowwhatOpenCLcoulddomore... – dronus Dec7,2011at20:35 3 ByusingOpenCLyousimplyomitthemappingaltogether,avoidwritingtheshadersthatoughttodealwithgeometryandfragments,avoidthinkingaboutthevarioustransformationofcoordinates(world,screen/buffer,texture)anddirectlyexpressyouralgorithmlikeyoulearntinyournumericsclass.Ihaven'thadaproblemwiththefirst,butlikethelattermore.Andwell,Ididn'tcomeupwiththeideatoOpenCLinthefirstplace-butassomebodyelsedid,whyshouln'titbeputtoitsintendeduse?GPGPUwascoolforitstimebeing,nowjustuseOpenCL. – cli_hlt Dec7,2011at21:26 7 @cli_hlt,OpenCLisalsoGPGPU. – Simon Jul13,2013at16:31 @SimonInabroadsense,yesyouareright.But,accordingtoWikipedia"General-purposecomputingongraphicsprocessingunits(GPGPU,rarelyGPGPorGP²U)istheutilizationofagraphicsprocessingunit(GPU),whichtypicallyhandlescomputationonlyforcomputergraphics,toperformcomputationinapplicationstraditionallyhandledbythecentralprocessingunit(CPU)"(theyhaveadditionalreferencesthatIomitnow).WithOpenCLthewholepointof"whichtypicallyhandlescomputationonlyforcomputergraphics"isnotgivenanymore.SoitisnotGPGPUintheoriginalmeaning. – cli_hlt Oct24,2014at20:26 @cli_hlt:Perhaps,butthedevicesarestillmeantprimarilyforcomputergraphics.TheyarestillcalledGPUs,afterall! – TimČas Jan19,2016at2:03 | Show1morecomment 62 +50 Somethingthathasn'tbeenmentionedinanyanswerssofarhasbeenspeedofexecution.IfyouralgorithmcanbeexpressedinOpenGLgraphics(e.g.noscatteredwrites,nolocalmemory,noworkgroups,etc.)itwillveryoftenrunfasterthananOpenCLcounterpart.Myspecificexperienceofthishasbeendoingimagefilter(gather)kernelsacrossAMD,nVidia,IMGandQualcommGPUs.TheOpenGLimplementationsinvariablyrunfasterevenafterhardcoreOpenCLkerneloptimization.(aside:Isuspectthisisduetoyearsofhardwareanddriversbeingspecificallytunedtographicsorientatedworkloads.) MyadvicewouldbethatifyourcomputeprogramfeelslikeitmapsnicelytothegraphicsdomainthenuseOpenGL.Ifnot,OpenCLismoregeneralandsimplertoexpresscomputeproblems. Anotherpointtomention(ortoask)iswhetheryouarewritingasahobbyist(i.e.foryourself)orcommercially(i.e.fordistributiontoothers).WhileOpenGLissupportedprettymucheverywhere,OpenCListotallylackingsupportonmobiledevicesand,imho,ishighlyunlikelytoappearonAndroidoriOSinthenextfewyears.IfwidecrossplatformcompatibilityfromasinglecodebaseisagoalthenOpenGLmaybeforceduponyou. Share Follow answeredJul1,2014at13:02 user2746401user2746401 2,83711goldbadge2020silverbadges4444bronzebadges 3 Ithinkthisanswerreallyneedsmoreupvotestoshowupearlierinthisthread.Performanceconsiderationsandmobiledevicecompatibilityshouldbecriticalaspectstoconsiderfirst...atleasttheperformanceconsiderations,incaseyouhavenointerestinmobile(buttoday,howcan'tyouor,rather,howcanyouaffordnotto?:p) – warship Jul6,2016at5:43 HowcanOpenGLbefasterthanOpenCL?ItdoesmuchmoreandtheoverheadofmanagingOpenGLstateishigh.DidyoucomparetoOpenCLwithnative_*functions?Whatkindofoperationsdidyoucompare?Canyoupublishthecode? – Yoav Aug15,2016at20:53 2 HiBen-Uri.SadlyIcan'tsharecode.YouarerightaboutGLstatebeingratherheavybutwellwrittenGLcodecanmostlyavoidstatechanges,especiallyforcompute-liketasks(Vulkaniswaybetterinthisrespectbtw).IndividualoperationstendtobeaboutthesamebetweenGL/CLbuttheGLSLcompilersseemmorematureandproduceoveralltightercode.Also,forstructuredwrites,GLpixelshaderscanmakeuseoftherenderoutputunits(ROPs)whereasCLmustusethegenericmemorysubsystem(slower)asit(usually)cannotbeknownatcompiletimeifthewriteswillbestructured. – user2746401 Aug16,2016at12:05 Addacomment | 28 WhatfeaturesmakeOpenCLuniquetochooseoverOpenGLwithGLSLforcalculations?Despitethegraphicrelatedterminologyandinpracticaldatatypes,isthereanyrealcaveattoOpenGL? Yes:it'sagraphicsAPI.Therefore,everythingyoudoinithastobeformulatedalongthoseterms.Youhavetopackageyourdataassomeformof"rendering".Youhavetofigureouthowtodealwithyourdataintermsofattributes,uniformbuffers,andtextures. WithOpenGL4.3andOpenGLES3.1computeshaders,thingsbecomeabitmoremuddled.AcomputeshaderisabletoaccessmemoryviaSSBOs/ImageLoad/StoreinsimilarwaystoOpenCLcomputeoperations(thoughOpenCLoffersactualpointers,whileGLSLdoesnot).TheirinteropwithOpenGLisalsomuchfasterthanOpenCL/GLinterop. Evenso,computeshadersdonotchangeonefact:OpenCLcomputeoperationsoperateataverydifferentprecisionthanOpenGL'scomputeshaders.GLSL'sfloating-pointprecisionrequirementsarenotverystrict,andOpenGLES'sareevenlessstrict.Soiffloating-pointaccuracyisimportanttoyourcalculations,OpenGLwillnotbethemosteffectivewayofcomputingwhatyouneedtocompute. Also,OpenGLcomputeshadersrequire4.x-capablehardware,whileOpenCLcanrunonmuchmoreinferiorhardware. Furthermore,ifyou'redoingcomputebyco-optingtherenderingpipeline,OpenGLdriverswillstillassumethatyou'redoingrendering.Soit'sgoingtomakeoptimizationdecisionsbasedonthatassumption.Itwilloptimizetheassignmentofshaderresourcesassumingyou'redrawingapicture. Forexample,ifyou'rerenderingtoafloating-pointframebuffer,thedrivermightjustdecidetogiveyouanR11_G11_B10framebuffer,becauseitdetectsthatyouaren'tdoinganythingwiththealphaandyouralgorithmcouldtoleratethelowerprecision.Ifyouuseimageload/storeinsteadofaframebufferhowever,you'remuchlesslikelytogetthiseffect. OpenCLisnotagraphicsAPI;it'sacomputationAPI. Also,OpenCLjustgivesyouaccesstomorestuff.ItgivesyouaccesstomemorylevelsthatareimplicitwithregardtoGL.Certainmemorycanbesharedbetweenthreads,butseparateshaderinstancesinGLareunabletodirectlyaffectone-another(outsideofImageLoad/Store,butOpenCLrunsonhardwarethatdoesn'thaveaccesstothat). OpenGLhideswhatthehardwareisdoingbehindanabstraction.OpenCLexposesyoutoalmostexactlywhat'sgoingon. YoucanuseOpenGLtodoarbitrarycomputations.Butyoudon'twantto;notwhilethere'saperfectlyviablealternative.ComputeinOpenGLlivestoservicethegraphicspipeline. TheonlyreasontopickOpenGLforanykindofnon-renderingcomputeoperationistosupporthardwarethatcan'trunOpenCL.Atthepresenttime,thisincludesalotofmobilehardware. Share Follow editedDec13,2016at15:21 answeredOct27,2011at0:10 NicolBolasNicolBolas 419k6262goldbadges725725silverbadges918918bronzebadges 6 6 'OpenGLhideswhatthehardwareisdoingbehindanabstraction.OpenCLexposesyoutoalmostexactlywhat'sgoingon.'isstillonanabstractlevelIthink.TheGPUshavefixedmodules(like'RenderOutputUnits'and'TextureMappingUnits')expressedinOpenGLfeatures. – dronus Feb17,2012at14:37 1 @ybungalobillAccordingtothedescriptionofglTexImage2D,"TheGLwillchooseaninternalrepresentationthatcloselyapproximatesthatrequestedbyinternalFormat,butitmaynotmatchexactly". – GuyRT Jun30,2014at11:02 1 @GuyRT:Itusuallydoesgiveyou32Ffor32F---thetypicalchangeisadifferentorderofchannels,though(e.g.BGRAinsteadofRGBA). – TimČas Jan19,2016at2:07 Doesthisanswerreferto"OpenGL/GSLS"orjustOpenGL? – wotanii Dec13,2016at14:57 1 @wotanii:GLSListheshadinglanguageusedbyOpenGL.Sothereisno"justOpenGL". – NicolBolas Dec13,2016at15:19 | Show1morecomment 12 Onenotablefeaturewouldbescatteredwrites,anotherwouldbetheabsenceof"Windows7smartness".Windows7will,asyouprobablyknow,killthedisplaydriverifOpenGLdoesnotflushfor2secondsorso(don'tnailmedownontheexacttime,butIthinkit's2secs).Thismaybeannoyingifyouhavealengthyoperation. Also,OpenCLobviouslyworkswithamuchgreatervarietyofhardwarethanjustthegraphicscard,anditdoesnothavearigidgraphics-orientedpipelinewith"artificialconstraints".Itiseasier(trivial)torunseveralconcurrentcommandstreamstoo. Share Follow answeredOct26,2011at19:10 DamonDamon 65.1k1717goldbadges129129silverbadges179179bronzebadges 6 +1formentioningscattering,thoughrecentextensions(likeshader_image_load_store)workonthat,oryoucouldusethegeometryshadertogenerateadditionalpointsorselectdifferentoutputtargets.ButnothingcomparedtotheflexibilityofOpenCL. – ChristianRau Oct26,2011at19:15 Thingisthatyoudon'tknowatallwhathappensbecauseeverythingisessentiallydriverdependent.Ofcourseyoucandoe.g.randommemoryaccessiftheimplementationallowsit,butwhatwouldbethebenefitifitturnsoutthatbydoingthisthedriverjustswapsyourwholecomputationtothehostinsteadofthehwyourcodeissupposedtorunon... – cli_hlt Oct26,2011at19:45 2 @cli_hlt:Yougettodecidewhatdeviceyourtaskqueues(anthuskernels)willrunon,beforehand.Theimplementationhasnooptiontodecidesomethingelselater.Also,featureslikescatteredwritesorlocalmemoryarenotsomething"special"thatthehardwaresupportsordoesnotsupport.It'sjustthatunderOpenGLthesamehardwarewillnotexposeit,becauseOpenGLimplementsagraphicspipeline.Assuch,itsimplydoesnotmakesensetosupportwritingtolocalmemoryinapixelshader(and"historic"hardwarecouldindeednotdothat).UnderOpenCL,itmakessenseandisallowed. – Damon Oct26,2011at19:56 2 ("itsimplydoesnotmakesense"maybeasomewhattooharshwording,butyougetwhatImean.Itisnotwhatyouusuallywantforgraphics,anditisnotwhatGPUscoulddo,say,adecadeago.OpenGLimplementsa"turnverticesandconnectivityinformationintoimage"service.OpenCLimplementsa"cruncharbitrarydataintosomeotherdata"service.) – Damon Oct26,2011at20:00 1 YoudoknowthattheOSwillkillthedrivertooifOpenCLdoesalengthycalculationontheGPU? – Tara Mar27,2013at13:37 | Show1morecomment 12 AlthoughcurrentlyOpenGLwouldbethebetterchoiceforgraphics,thisisnotpermanent. ItcouldbepracticalforOpenGLtoeventuallymergeasanextensionofOpenCL.Thetwoplatformsareabout80%thesame,buthavedifferentsyntaxquirks,differentnomenclatureforroughlythesamecomponentsofthehardware.Thatmeanstwolanguagestolearn,twoAPIstofigureout.Graphicsdriverdeveloperswouldpreferamergebecausetheynolongerwouldhavetodevelopfortwoseparateplatforms.Thatleavesmoretimeandresourcesfordriverdebugging.;) AnotherthingtoconsideristhattheoriginsofOpenGLandOpenCLaredifferent:OpenGLbeganandgainedmomentumduringtheearlyfixed-pipeline-over-a-networkdaysandwasslowlyappendedanddeprecatedasthetechnologyevolved.OpenCL,insomeways,isanevolutionofOpenGLinthesensethatOpenGLstartedbeingusedfornumericalprocessingasthe(unplanned)flexibilityofGPUsallowedso."Graphicsvs.Computing"isreallymoreofasemanticargument.Inbothcasesyou'realwaystryingtomapyourmathoperationstohardwarewiththehighestperformancepossible.TherearepartsofGPUhardwarewhichvanillaCLwon'tusebutthatwon'tkeepaseparateextensionfromdoingso. SohowcouldOpenGLworkunderCL?Speculatively,trianglerasterizerscouldbeenqueuedasaspecialCLtask.SpecialGLSLfunctionscouldbeimplementedinvanillaOpenCL,thenoverriddentohardwareacceleratedinstructionsbythedriverduringkernelcompilation.WritingashaderinOpenCL,pendingthelibraryextensionsweresupplied,doesn'tsoundlikeapainfulexperienceatall. Tocallonetohavemorefeaturesthantheotherdoesn'tmakemuchsenseasthey'rebothgaining80%thesamefeatures,justunderdifferentnomenclature.ToclaimthatOpenCLisnotgoodforgraphicsbecauseitisdesignedforcomputingdoesn'tmakesensebecausegraphicsprocessingiscomputing. Share Follow answeredNov21,2012at11:44 user515655user515655 94911goldbadge1010silverbadges2222bronzebadges 0 Addacomment | 6 AnothermajorreasonisthatOpenGL\GLSLaresupportedonlyongraphicscards.Althoughmulti-coreusagestartedwithusinggraphicshardwaretherearemanyhardwarevendorsworkingonmulti-corehardwareplatformtargetedforcomputation.ForexampleseeIntelsKnightsCorner. DevelopingcodeforcomputationusingOpenGL\GLSLwillpreventyoufromusinganyhardwarethatisnotagraphicscard. Share Follow answeredOct27,2011at12:52 TalDaromTalDarom 1,33911goldbadge88silverbadges2626bronzebadges 1 IthinkOpenCLwillalsopreventmycodefromrunningefficientlyonanyhardwarethatisnotagraphicscardtoday..BecausethefavorableparallelcomputationdoneinOpenCLiswellmatchedforGPUbutquiteinefficientontodaysvanillaCPUs. – dronus Dec7,2011at20:38 Addacomment | 4 WellasofOpenGL4.5thesearethefeaturesOpenCL2.0hasthatOpenGL4.5Doesn't(asfarasIcouldtell)(thisdoesnotcoverthefeaturesthatOpenGLhasthatOpenCLdoesn't): Events BetterAtomics Blocks WorkgroupFunctions: work_group_allandwork_group_any work_group_broadcast: work_group_reduce work_group_inclusive/exclusive_scan EnqueueKernelfromKernel Pointers(thoughifyouareexecutingontheGPUthisprobablydoesn'tmatter) AfewmathfunctionsthatOpenGLdoesn'thave(thoughyoucouldconstructthemyourselfinOpenGL) SharedVirtualMemory (More)CompilerOptionsforKernels EasytoselectaparticularGPU(orotherwise) CanrunontheCPUwhennoGPU Moresupportforthosenichehardwareplatforms(e.g.FGPAs) Onsome(all?)platformsyoudonotneedawindow(anditscontextbinding)todocalculations. OpenCLallowsjustabitmorecontroloverprecisionofcalculations(includingsomethroughthosecompileroptions). AlotoftheabovearemostlyforbetterCPU-GPUinteraction:Events,SharedVirtualMemory,Pointers(althoughthesecouldpotentiallybenefitotherstufftoo). OpenGLhasgainedtheabilitytosortthingsintodifferentareasofClientandServermemorysincealotoftheotherpostsherehavebeenmade. OpenGLhasbettermemorybarrierandatomicssupportnowandallowsyoutoallocatethingstodifferentregisterswithintheGPU(toaboutthesamedegreeOpenCLcan).ForexampleyoucanshareregistersinthelocalcomputegroupnowinOpenGL(usingsomethingliketheAMDGPUsLDS(localdatashare)(thoughthisparticularfeatureonlyworkswithOpenGLcomputeshadersatthistime). OpenGLhasstrongermoreperformingimplementationsonsomeplatforms(suchasOpenSourceLinuxdrivers). OpenGLhasaccesstomorefixedfunctionhardware(likeotheranswershavesaid).Whileitistruethatsometimesfixedfunctionhardwarecanbeavoided(e.g.Crytekusesa"software"implementationofadepthbuffer)fixedfunctionhardwarecanmanagememoryjustfine(andusuallyalotbetterthansomeonewhoisn'tworkingforaGPUhardwarecompanycould)andisjustvastlysuperiorinmostcases.ImustadmitOpenCLhasprettygoodfixedfunctiontexturesupportwhichisoneofthemajorOpenGLfixedfunctionareas. IwouldarguethatIntelsKnightsCornerisax86GPUthatcontrolsitself. IwouldalsoarguethatOpenCL2.0withitstexturefunctions(whichareactuallyinlesserversionsofOpenCL)canbeusedtomuchthesameperformancedegreeuser2746401suggested. Share Follow editedApr5,2018at7:33 answeredNov27,2014at12:06 afree100afree100 19111silverbadge88bronzebadges Addacomment | 3 OpenCL(in2.0version)describesheterogeneouscomputationalenvironment,whereeverycomponentofsystemcanbothproduce&consumetasks,generatedbyothersystemcomponents.NomoreCPU,GPU(etc)notionsarelongerneeded-youhavejustHost&Device(s). OpenGL,inopposite,hasstrictdivisiontoCPU,whichistaskproducer&GPU,whichistaskconsumer.That'snotbad,aslessflexibilityensuresgreaterperformance.OpenGLisjustmorenarrow-scopeinstrument. Share Follow answeredJun28,2014at14:56 RomanArzumanyanRomanArzumanyan 1,7761010silverbadges1010bronzebadges Addacomment | 2 Inadditiontothealreadyexistinganswers,OpenCL/CUDAnotonlyfitsmoretothecomputationaldomain,butalsodoesn'tabstractawaytheunderlyinghardwaretoomuch.Thiswayyoucanprofitfromthingslikesharedmemoryorcoalescedmemoryaccessmoredirectly,whichwouldotherwisebeburriedintheactualimplementationoftheshader(whichitselfisnothingmorethanaspecialOpenCL/CUDAkernel,ifyouwant). Thoughtoprofitfromsuchthingsyoualsoneedtobeabitmoreawareofthespecifichardwareyourkernelwillrunon,butdon'ttrytoexplicitlytakethosethingsintoaccountusingashader(ifevencompletelypossible). Onceyoudosomethingmorecomplexthansimplelevel1BLASroutines,youwillsurelyappreciatetheflexibilityandgenericityofOpenCL/CUDA. Share Follow answeredOct26,2011at19:56 ChristianRauChristianRau 44.4k1010goldbadges111111silverbadges184184bronzebadges 3 1 Imnotsureabout'butalsodoesn'tabstractawaytheunderlyinghardwaretoomuch'.ItseemsOpenCLwouldinfacttotallyignorepartsofthehardware,forexamplerasterizationunits. – dronus Dec7,2011at20:40 @dronusWell,yesitignoresthefixed-functionparts.Butontheotherhandshadersabstractawaythemany-corenatureofthehardwareandsuchthingsasthedifferentmemorytypesandoptimizedmemoryaccesses. – ChristianRau Dec7,2011at20:43 1 Rasterizationevenenablessomekindofrandommemoryaccess(to"triangularconnected"regions...)withaguaranteedoutcome(fragmentsoverwrittenorderedbyzdepth).Thinkinginkernelsandmemorystreams,theemulationofsuchbehaviourwouldmeanrandomaccesswithwelldefinedorderedmutexesamongallparallelthreadsorsomethingelse.WhatisausableOpenCLideomforparallelrandomaccesslikethis? – dronus Dec7,2011at20:52 Addacomment | 2 The"feature"thatOpenCLisdesignedforgeneral-purposecomputation,whileOpenGLisforgraphics.YoucandoanythinginGL(itisTuring-complete)butthenyouaredrivinginanailusingthehandleofthescrewdriverasahammer. Also,OpenCLcanrunnotjustonGPUs,butalsoonCPUsandvariousdedicatedaccelerators. Share Follow answeredJan14,2014at21:26 BasilMarteBasilMarte 3122bronzebadges Addacomment | 0 Onethoughtistowriteyourprograminbothandtestthemwithrespecttoyourpriorities. Forexample:Ifyou'reprocessingapipelineofimages,maybeyourimplementationinopenGLoropenCLisfasterthantheother. Goodluck. Share Follow answeredFeb20,2021at10:41 AdamAdam 6522silverbadges1111bronzebadges Addacomment | YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedopenglopenclgpgpuoraskyourownquestion. TheOverflowBlog Greatengineeringculturesarebuiltonsociallearningcommunities Satelliteinternet:Moreusefulthansendingacarintospace(Ep.470) FeaturedonMeta AnnouncingtheStacksEditorBetarelease! AnnouncingDesignAccessibilityUpdatesonSO Linked 1 Usecaseforresidenttextures Related 4 IDEAs:howtointeractivelyrenderlargeimageseriesusingGPU-baseddirectvolumerendering 2 OpenGL3.3,GLSL1.5:HowtosetupaTextureBufferObjectcontainingvarioustexture2D? 10 ShadersinplaceofGPGPU 5 AdvantageofOpenCLinteroperabilitywithOpenGL 2 GetdatabackfromOpenGLshader? 1 HowtodynamicallybindanarrayofmultipletexturecoordinatessetsformixinginmodernOpenGL? 0 LoadingmodelsandtheirmaterialsinAssimprobustlywithOpenGL? 1 OpenglPixelCo-ordinatemanipulation HotNetworkQuestions Whywouldaruralvillageneedropeintimesoffamine? Whatsinglechangeinhistorywouldmakerearsteeringcarsastandard? "Playingcornetinopenstyle"? Doesthedebrisfromthere-entryofLongMarchcorestageeverreachthesurface? Canthewavelengthofthestandingwavebedifferentfromthewavelengthofthesounditemits? Whyaremostthecommonprocessors'bitcountapowerof2? DidamillionGermansdieafterWorldWar2in"Eisenhower'sdeathcamps"? DatetickedLTSAusingPAMGuardbinariesfromdutycycledsoundtrapdata '80/'90smovieaboutastrangehole/tunnelinthefloorofahouseandbadthingshappeningbecauseofit Howtocurlcase-insensitive TheExpanse:SustainedGsduringspacetravel Reasonforbreakdownofanicebinomialidentity AdditionofgravitationalfieldsinGeneralRelativity Whydofixies(fixed-gearbicycles)haveonebrakeonthefront? Genesis3:6"Desirabletomakeonewise" Whycompanieschoosetomakezeroeconomicprofitsinthelong-termwhenitcanmaximizeitinstead?WhydoesApplehavelargeprofitmargins? Whydosomeairportsdoimmigrationcheckatarrivalgatebeforepassengersgothroughtheactualimmigration? Whatwasaturfrick,circa1833? Educators:Let'ssharetheresourceswe'vebuiltaheadofthenewyear! Whyisthereanextrapartinmytoilet?(rubberthingybetweentankandbowl) Accessibleasinwebaccessibility SQLServerLOBvariablesandmemoryusage Howtopass1000elo Isitreasonablethatanationrejectreincarnation? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1OpenGL與OpenCL是何關係 - w3c菜鳥教程
OpenGL與OpenCL是何關係,opengl open graphics library opencl open computing language opencl和ope.
- 2OpenCL™和OpenGL®相容性套件免費 - Microsoft
相容性套件可讓您最愛的OpenCL™ 和OpenGL® 應用程式在未預設安裝OpenCL 和OpenGL 硬體驅動程式的Windows 10 電腦上執行。如果已安裝DirectX 12 驅動程式...
- 3OpenGL与OpenCL是何关系? - CSDN博客
OpenCL和OpenGL是两个不同的API。 ... OpenGL或DirectX是什么呢? ... 拿到OpenCL 就变成“cl” 开头,有很多函数名称和用法都相似, 熟悉GL 的应该不难...
- 4OpenCL/OpenGL/DirectX/CUDA - 作业部落
IRIS GL 是一个工业标准的3D图形软件接口,功能虽然强大但是移植性不好,于是SGI公司便在IRIS GL的基础上开发了OpenGL。OpenGL的英文全称是“Open Graphics ...
- 5OpenGL vs. OpenCL, which to choose and why?
The "feature" that OpenCL is designed for general-purpose computation, while OpenGL is for graphi...