十年匠心定制 · 商业建站与技术教学双线并行 咨询热线:400-886-1026 service@lmnt.cn
ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

CANN/GE图引擎快速安装指南

CANN/GE图引擎快速安装指南 Environment Deployment【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge1. Environment PreparationThis project supports source code compilation. Before source code compilation, you need to ensure that CANN software (Toolkit development suite package and ops package (optional)) has been installed. If running samples, you also need to install NPU driver and firmware.Please choose the software installation method according to the following description:Installation MethodDescriptionUsage ScenarioCANNLabOne-stop development platform, providing online directly runnable Ascend environment, no manual installation required.Currently provides single-machine computing power,installs the latest commercial release CANN package by default.Suitable for developers without Ascend devices.DockerDocker image is an efficient deployment method, one-click deployment of CANN package and essential dependencies.Currently OS only supports Ubuntu operating system,installs the latest commercial release CANN package by default.Suitable for developers with Ascend devices who need to quickly set up the environment.Manual InstallationManual installation of CANN package and basic dependencies, high flexibility.Suitable for developers with Ascend devices who want to experience manual CANN package installation or experience the latest master branch capabilities.Method 1: CANNLabFor developers without Ascend devices, you can directly use CANNLab cloud development environment, which is a one-stop development platform. This platform provides online directly runnable Ascend environment for you, with essential driver firmware, software packages and dependencies already installed, no manual installation required.Note: The environment installs the latest commercial release CANN package by default. Please note the software compatibility when downloading source code. To experience master version capabilities or develop based on master version, please refer toMethod 3 - Scenario 1to install the latest CANN package dependencies.For more introduction about the development platform, please refer to CANNLab Guide.Enter the open source project and click the CANNLab button, log in with a certified Huawei Cloud account. If not registered or certified, please follow the page prompts to register and certify.Create NPU environment and configure specifications according to page prompts. After starting the cloud development environment, click Connect WebIDE to enter the one-stop development platform.Currently, open source project resources are located in the/mnt/workspace/gitCode/${gitCode_id}directory by default, where ${gitCode_id} represents the developers personal gitCode account.Method 2: Docker DeploymentFor developers who do not depend on Ascend devices, if you want to quickly set up a compilation build environment, you can use Docker image deployment.Note: The image file is relatively large and takes some time to download. Please wait patiently. For docker command options, you can query throughdocker --help.Install Drivers and Firmware (Runtime Dependencies)For downloading and installing Ascend drivers and firmware on the host machine, please refer to the Prepare Software Packages and Install NPU Driver and Firmware chapters in the CANN Software Installation Guide. Drivers and firmware are runtime dependencies. If only compiling operators, you dont need to install them.Download ImageStep 1: Log in to the host machine as root user. Ensure Docker engine (version 1.11.2 or above) is installed on the host machine.Step 2: Pull the image with CANN software package and development dependencies pre-integrated from Ascend Image Repository. The command is as follows, please choose according to actual architecture (taking Atlas A2 series products as example, compilation-only scenarios do not need to pay attention):# Example: Pull ARM architecture CANN development image docker pull --platformarm64 swr.cn-south-1.myhuaweicloud.com/ascendhub/cann:9.0.0-beta.1-910-ubuntu22.04-py3.11 # Example: Pull X86 architecture CANN development image docker pull --platformamd64 swr.cn-south-1.myhuaweicloud.com/ascendhub/cann:9.0.0-beta.1-910-ubuntu22.04-py3.11Run DockerChoose different startup methods according to usage scenarios:Scenario 1: Compilation Build Only (No Need to Run Samples)If you only need code compilation build without accessing NPU devices, use the following simplified command:docker run --name cann_container -it -u root --privilegedtrue -v /home/ge/:/home/ge swr.cn-south-1.myhuaweicloud.com/ascendhub/cann:9.0.0-beta.1-910-ubuntu22.04-py3.11 bashScenario 2: Need to Run Samples (Need to Access NPU Devices)If you need to run samples or tests, the container needs to access the host machines NPU devices. Taking Atlas A2 series products as example:docker run --name cann_container \ --device /dev/davinci0 \ --device /dev/davinci_manager \ --device /dev/devmm_svm \ --device /dev/hisi_hdc \ -v /usr/local/dcmi:/usr/local/dcmi \ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \ -v /etc/ascend_install.info:/etc/ascend_install.info \ -it -u root --privilegedtrue \ swr.cn-south-1.myhuaweicloud.com/ascendhub/cann:9.0.0-beta.1-910-ubuntu22.04-py3.11 bashParameterDescriptionNotes--name cann_containerSpecify a name for the container for easy management.Optional (value can be customized).--device /dev/davinci0Map NPU device files into the container.Required (when running samples). Multiple devices can use this parameter multiple times, such as/dev/davinci0/dev/davinci1.--device /dev/davinci_managerAscend device manager, responsible for device resource management.Required (when running samples).--device /dev/devmm_svmDevice memory management unit.Required (when running samples).--device /dev/hisi_hdcAscend high-definition codec device.Required (when running samples).-v /usr/local/dcmi:/usr/local/dcmiMount DCMI (Device Communication Management Interface) directory.Required (when running samples).-v /usr/local/bin/npu-smi:...Mount NPU monitoring tool for viewing NPU status.Required (when running samples).-v /usr/local/Ascend/driver/...Mount NPU driver library and version information.Required (when running samples).-v /etc/ascend_install.info:...Mount Ascend software installation information.Required (when running samples).-itCombination of-i(interactive) and-t(allocate pseudo-terminal) parameters.Required-u rootEnter the container as root (administrator).Recommended--privilegedtrueEnable container highest privilege mode.Recommendedswr.cn-south-1.myhuaweicloud.com/ascendhub/cann:...Specify the Docker image to run.Required, please ensure this image name and tag are exactly the same as the image you pulled throughdocker pull.bashCommand to execute immediately after container starts.RequiredNote:Scenario 1 is suitable for GE compilation build only, no NPU device support requiredScenario 2 is suitable for scenarios that need to run samples or perform NPU-related tests, requiring NPU driver and firmware installed on the host machineIf using other chip models (such as 950, Atlas A3 series products), please adjust device names in--deviceparameter accordinglyInitialize EnvironmentAfter entering the container, execute the following commands to initialize the environment:Scenario 1 (Compilation Build Only):curl -fsSL https://raw.gitcode.com/cann/ge/raw/master/scripts/init_env.sh | bashScenario 2 (Need to Run Samples, taking Atlas A2 series products as example):curl -fsSL https://raw.gitcode.com/cann/ge/raw/master/scripts/init_env.sh | bash -s -- --chip-type 910bNote:For other chip models, please replace the--chip-typeparameter with the corresponding model (such as950,A3)Method 3: Manual Installation of Software PackagesScenario 1: Experience master version capabilities or develop based on master versionInstall Drivers and Firmware (Optional, only required for running samples)Drivers and firmware are runtime dependencies. If only compiling source code, you dont need to install them. Usenpu-smi infoto check if there is NPU-related information. If not, please refer to CANN Quick Installation to complete driver and firmware installation.Install CANN PackagePlease click download link to get the latest timestamp version, and download the corresponding package according to product model and environment architecture. Installation commands are as follows, for more guidance please refer to CANN Software Installation Guide.Install CANN Toolkit development suite package.# Ensure the installation package has executable permissions chmod x Ascend-cann-toolkit_${cann_version}_linux-${arch}.run # Installation command ./Ascend-cann-toolkit_${cann_version}_linux-${arch}.run --install --install-path${install_path}${cann_version}: Represents CANN package version number.${arch}: Represents CPU architecture, such asaarch64,x86_64.${install_path}: Represents the specified installation path, needs to be installed in the same path as Toolkit package, root user defaults to/usr/local/Ascenddirectory.Install CANN ops operator package (optional, only required for running samples).# Ensure the installation package has executable permissions chmod x Ascend-cann-${soc_name}-ops_${cann_version}_linux-${arch}.run # Installation command ./Ascend-cann-${soc_name}-ops_${cann_version}_linux-${arch}.run --install --install-path${install_path}Where${soc_name}represents NPU model name.Install runtime dependencies (optional, only required for running samples).pip3 install attrs cython numpy decorator sympy cffi pyyaml pathlib2 psutil protobuf3.20.0 scipy requests absl-pyScenario 2: Experience released version capabilities or develop based on released versionIf you want to experienceofficially released CANN packagecapabilities, please visit CANN Official Download Center, select the corresponding version of CANN software package (only supports CANN 8.5.0 and later versions) for installation.【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表