How to install MegEngine

Note

MegEngine currently supports Python package is installed in the following environments:

  • 操作系统: Linux-64 位 / Windows-64 位 / MacOS-10.14 及其以上

  • Python 版本:3.6 到 3.9

Among them, MacOS only supports Intel x86 CPU; in addition, MegEngine also supports inference operations on many other platforms.

Install via package manager

Command to install MegEngine by `` pip`` Package Manager follows:

python3 -m pip install --upgrade pip  # 将 pip 更新到最新版本
python3 -m pip install megengine -f https://megengine.org.cn/whl/mge.html

Note

For conda users, you can choose to install ``pip’’ in the environment first, and then install MegEngine in the above way;

Warning

MegEngine 包中集成了 CUDA 环境,但用户需确保环境中已经正确地安装好 GPU 设备 相关驱动。

Compile and install through source code

If the way the package manager is installed cannot meet your needs, such as:

  • The GPU device I use is not from Nvidia manufacturer, for example, I use GPU from AMD and other manufacturers;

  • The Nvidia GPU device I use is relatively new or relatively old, and is not in the current device support list;

  • I want to change some other compilation configuration options to enable some features that are turned off by default.

You can try to compile and install through source code yourself. For details, please refer to scripts/cmake-build/BUILD_README.md.

CUDA compilation support status

Status MegEngine CMake CUDA compiler follows:

  • Compiling with CUDA 11.1 and above can adapt to all Ampere cards on the market, adapt to sm80+sm86

  • CUDA 11.0 can be compiled to adapt to A100, but not to 30 series cards, only sm80

  • CUDA 10 is not compatible with the Ampere architecture (the official pre-compiled package is based on CUDA 10.1)

Note

Users can use cmake -DMGE_CUDA_GENCODE="-gencode arch=compute80, code=sm80" to freely specify.

Warning

Before compiling, the user needs to confirm the GPU device and the CUDA version used in the environment.

See also

Users can find the computing compatibility version corresponding to their GPU device on the `Compute Capability <https://developer.nvidia.com/cuda-gpus#compute>