Install Vulkan on Raspberry Pi 4 - Q-engineering
文章推薦指數: 80 %
This page guides you through the installation of Vulkan on a Raspberry Pi 4. Vulkan is a low-level 3D graphics accelerator using a balanced ... Q-engineering × Machinelearning Computervision Embeddedvision Deeplearning Math Optics Shop Contact Gotocontent InstallVulkanonaRaspberryPi4. Lastupdated:November15,2021Introduction.ThispageguidesyouthroughtheinstallationofVulkanonaRaspberryPi4.Vulkanisalow-level3DgraphicsacceleratorusingabalancedmixofCPUandGPUinstructionsandoptimizedforparalleltaskingwithmultipleCPUcores.ManyplatformsarealreadyusingVulkan,andnowtheRaspberryPiisonboardtoo.Oneimportantpointtomention,thesoftwareisstillunderconstruction.AllthehardworkisdonebyIgalia'slagoToral.Andthat'snoteasyconsideringthelackofadetailedVideoCoreVIdatasheet.Atthemoment(Dec2020),manytestshavebeensuccessful.Asaresultofthat,theVulkandriverismergedwithMesaupstream,therebygettinganofficialstatus.ForthoselookingforagraphicalimprovementtotheirgamesonaRaspberryPi4,theVulkanAPIisthebest(andonly)solution.Ontheotherhand,forallthepeoplelookingtousetheVulkanlibrarytoboosttheirdeeplearningframeworks,abigdisappointmentawaits.TheAPIisnotyetwellequippedtoperformtensorcalculations.Therequiredoperationsarecurrentlynotsupported.Maybethenearfuturewillbringusgoodnews.Onelastremark,theVulkanAPIworksonlyontheRaspberryPi4.TheRaspberryPi3hasanotherVideoCoreGPUonboardwhichisincompatiblewiththeversionfoundonthePi4. PiKISS.Byfar,theeasiestwaytoinstallVulkanonyourRaspberryPi4istousePiKISS.PiKISSisacollectionofinstallationandconfigurationscriptspackedinamenustructure.Itworksonlyfor32-bitoperatingsystems,64-bitarenotsupportedyet.Complicatedinstallationsarebecomingonemouseclick.Atip:keepyourPiKISSuptodatebecauseoftheever-changingsoftware.InstallPiKISSwiththefollowinginstruction. #installPiKISS$sudoapt-getinstallcurl$curl-sSLhttps://git.io/JfAPE|bash#orupdatePiKISSonceinstalled$cd~/piKiss$gitpull OncePiKISSisinstalled,youcanfindtheapplicationinthesystemtoolsmenu.TherearealotoftutorialsandvideosonthenetexplainingthemanyfeaturesofPiKISS.WewillmentionthisonefromthemakerofPiKISS.NowthatPiKISSisupandrunning,Vulkancanbeinstalled.Justfollowthescreendumps,andtheinstallationwillstart.Itwilltakeawhile.Intheend,youwillendupwiththefollowingscreen.Infact,PiKISSfollowsallthestepsgiveninthisguideinjustonego. Installationfromscratch.Versioncheck.PleasecheckyouroperatingsystembeforeinstallingVulkanonyourRaspberryPi4.Runthecommanduname-aandverifyyourversionwiththescreendumpbelow.Ifyou'renotsure,checkalsotheversion,BusterorBullseye.Dependencies.TheVulkanAPIhasamanydependencies.Please,installthelistbelow. #checkforupdates$sudoapt-getupdate$sudoapt-getupgrade#installdependencies$sudoapt-getinstalllibxcb-randr0-devlibxrandr-dev$sudoapt-getinstalllibxcb-xinerama0-devlibxinerama-devlibxcursor-dev$sudoapt-getinstalllibxcb-cursor-devlibxkbcommon-devxutils-dev$sudoapt-getinstallxutils-devlibpthread-stubs0-devlibpciaccess-dev$sudoapt-getinstalllibffi-devx11proto-xext-devlibxcb1-devlibxcb-*dev$sudoapt-getinstalllibssl-devlibgnutls28-devx11proto-dri2-dev$sudoapt-getinstallx11proto-dri3-devlibx11-devlibxcb-glx0-dev$sudoapt-getinstalllibx11-xcb-devlibxext-devlibxdamage-devlibxfixes-dev$sudoapt-getinstalllibva-devx11proto-randr-devx11proto-present-dev$sudoapt-getinstalllibclc-devlibelf-devmesa-utils$sudoapt-getinstalllibvulkan-devlibvulkan1libassimp-dev$sudoapt-getinstalllibdrm-devlibxshmfence-devlibxxf86vm-devlibunwind-dev$sudoapt-getinstalllibwayland-devwayland-protocols$sudoapt-getinstalllibwayland-egl-backend-dev$sudoapt-getinstallvalgrindlibzstd-devvulkan-tools$sudoapt-getinstallgitbuild-essentialbisonflexninja-buildBuster$sudoapt-getinstallpython-makovulkan-utilsorBullseye$sudoapt-getinstallpython3-mako RaspberryPi4+Ubuntu.WereceivedanemailfromBenFerguson.HeinstalledtheVulkanSDKonaRaspberryPi(400)runninganUbuntuoperatingsystem.Inthiscase,someadditionallibrariesareneeded.Wearehappytosharethisinformationwithyou. #additionaldependenciesforUbuntuOS$sudoapt-getinstalllibxcb-glx0-devlibx11-xcb-devlibxcb-dri2-0-dev$sudoapt-getinstalllibxcb-dri3-devlibxcb-present-dev Installation.Withthedependenciesinstalled,theVulkanAPIcanbebuilt. Raspberry64-bit(aarch64) #removeoldversionsfirst $sudorm-rf/home/pi/mesa_vulkan #installmeson $sudoaptpurgemeson-y $sudopip3installmeson #installmako $sudopip3installmako #installv3dv $cd~ $gitclone-b20.3https://gitlab.freedesktop.org/mesa/mesa.gitmesa_vulkan #buildv3dv(±30min) $cdmesa_vulkan $CFLAGS="-mcpu=cortex-a72"\ CXXFLAGS="-mcpu=cortex-a72"\ meson--prefix/usr\ -Dplatforms=x11\ -Dvulkan-drivers=broadcom\ -Ddri-drivers=\ -Dgallium-drivers=kmsro,v3d,vc4\ -Dbuildtype=releasebuild $ninja-Cbuild-j4 $sudoninja-Cbuildinstall #checkyourdriver $glxinfo-B Raspberry32-bit(armv7l) #removeoldversionsfirst $sudorm-rf/home/pi/mesa_vulkan #installmeson $sudoaptpurgemeson-y $sudopip3installmeson #installmako $sudopip3installmako #installv3dv $cd~ $gitclone-b20.3https://gitlab.freedesktop.org/mesa/mesa.gitmesa_vulkan #buildv3dv(±30min) $cdmesa_vulkan $CFLAGS="-mcpu=cortex-a72-mfpu=neon-fp-armv8"\ CXXFLAGS="-mcpu=cortex-a72-mfpu=neon-fp-armv8"\ meson--prefix/usr\ -Dplatforms=x11\ -Dvulkan-drivers=broadcom\ -Ddri-drivers=\ -Dgallium-drivers=kmsro,v3d,vc4\ -Dbuildtype=releasebuild $ninja-Cbuild-j4 $sudoninja-Cbuildinstall #checkyourdriver $glxinfo-B Iftheinstallationwassuccessful,thescreenbelowshowsalltherelevantinformationafterthe$glxinfo-Bcommand.Ifyougettheerror:ERROR_EXTENSION_NOT_PRESENT,youhavemostlikelyusedthe32-bitinstallationona64-bitmachine.Removethewholemesa_vulkandirectoryandstartcloningtheGitHubrepoagain. Runningsomeexamples.TimetodosometestingwiththefamousSaschWillemVulkandemos.Asmentioned,thelibraryisstillunderdevelopment,sonotallexamplesworkonthecurrentversion.Butstill,someveryimpressivepicturescanstillbedrawn.Followthecommandsbelowtoinstallthedemo. #downloadthedemos$gitclone--recursivehttps://github.com/SaschaWillems/Vulkan.git sascha-willems$cdsascha-willems#downloadsomefonts$python3download_assets.py#buildthedemos$mkdirbuild$cdbuild$cmake-DCMAKE_BUILD_TYPE=Debug ..$make-j4 Gointothebuild/binfolderwith$cdbuild/binandrunsomeexampleslike:$./gears$./computeraytracing$./gltfscenerendering$./indirectdraw DeeplearningwithVulkan.We'vedonesomedisappointingtestswiththeVulkanAPIusedasabackendinvariousdeeplearningframeworks.Alibaba'sMNNandTencent'sncnn,bothuseVulkanasanacceleratorfortheirtensorcalculations.However,thecurrentVulkanAPIfortheRaspberryPi4doesnotyetsupportallnecessaryoperations.Inpractice,theperformancedropsbyafactorof5whenusingtheVulkanbackend.Seethebenchmarksbelow. ModelAlltimesinmSecMNNCPUMNNVulkanncnnCPUncnnVulkanSqueezeNet61.3431.165.9346.8MobileNetV169.8457.271.8558.2MobileNetV246.1425.972.2382.2ResNet1311670.9225.71085.5GoogleNet107.2786.5174.871124.12ShuffleNet55.1260.940.1409.6 TheRaspberryPi4with2GByteRAMwasrunningatadefaultclockspeedof1500MHz.MNNbuildwithcmake-DCMAKE_BUILD_TYPE=Release-DMNN_VULKAN=ON-DMNN_BUILD_BENCHMARK=ON..ncnnbuildwithcmake-DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.toolchain.cmake-DNCNN_VULKAN=ON-DCMAKE_BUILD_TYPE=Release.. Backtocontent
延伸文章資訊
- 1OpenGL without X on Raspberry Pi 4 (Part 1) - An external ...
Introduction Many people wanting to use OpenGL on a Raspberry Pi will be happy to boot into the g...
- 2Raspberry Pi 4 is Now OpenGL ES 3.1 Conformant, Work on ...
Raspberry Pi 4 Model B 4 was launched last June with a new Broadcom BCM2711 SoC featuring an upgr...
- 3Raspberry pi openGL setup and Hello world program - YouTube
- 4OpenGl 3.3 on Raspberry Pi 4 8gb
OpenGL is not just a software library, it's a software interface to hardware features of the grap...
- 5Raspberry Pi OpenGL ES 2 without an X server (using EGL)
This example also uses OpenGL ES 2 to setup a very simple shader to render a triangle. ... For th...