{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 计图入门教程 0 --- 介绍与安装"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "**计图 (Jittor)** 是一个以 Python 为前端语言的深度学习框架，它  \n",
    "* 效率高：可作为 NumPy，PyTorch 的替代品，可以使用 GPU 等其他加速器进行高效的数据运算。除此之外，计图还拥有多个创新点，旨在大幅提升其运算效率；\n",
    "* 易使用：是一个用于实现神经网络的自动微分库，并集成了大量有关深度学习的函数库，方便您快速开展开发任务。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "**通过本教程，您将**\n",
    "* 学习并理解计图中基本类型的一般操作；\n",
    "* 了解神经网络的一些基本概念，并学会如何利用计图进行神经网络的训练；\n",
    "* 解决一个机器学习的经典实战问题。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**本教程的适用群体：**  \n",
    "我们的目标是，只要您会 Python 编程，即可通过本教程学习并掌握如何使用计图进行深度学习的开发。不用担心，本教程几乎对所有的关键代码都加以注释说明。只要您耐心跟着本教程一步步学习，便一定能有所斩获。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "现在，请您开启计图快速入门之旅。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## 安装\n",
    "\n",
    "\n",
    "Jittor框架对环境要求如下:\n",
    "\n",
    "\n",
    "* 操作系统: **Ubuntu** >= 16.04 或 **Windows Subsystem of Linux（WSL）**\n",
    "* Python：版本 >= 3.7\n",
    "* C++编译器 （需要下列至少一个）\n",
    "    - g++ （>=5.4.0）\n",
    "    - clang （>=8.0）\n",
    "* GPU 编译器（可选）：nvcc >=10.0\n",
    "* GPU 加速库（可选）：cudnn-dev (cudnn开发版, 推荐使用tar安装方法，[参考链接](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-tar))\n",
    "\n",
    "如果您不希望手动配置环境，我们推荐使用 Docker 进行安装。\n",
    "除此之外，您还可以使用 pip 安装和手动安装。\n",
    "\n",
    "注意：目前Jittor通过WSL的方式在Windows操作系统上运行，WSL的安装方法请参考[微软官网](https://docs.microsoft.com/en-us/windows/wsl/install-win10)，WSL版本目前尚不支持CUDA。\n",
    "\n",
    "Jittor 提供了三种安装方法：docker，pip和手动安装：\n",
    "\n",
    "\n",
    "\n",
    "## Docker 安装\n",
    "\n",
    "我们提供了Docker安装方式，免去您配置环境，Docker安装方法如下：\n",
    "\n",
    "\n",
    "```\n",
    "# CPU only(Linux)\n",
    "docker run -it --network host jittor/jittor\n",
    "# CPU and CUDA(Linux)\n",
    "docker run -it --network host --gpus all jittor/jittor-cuda\n",
    "# CPU only(Mac and Windows)\n",
    "docker run -it -p 8888:8888 jittor/jittor\n",
    "# Upgrade jittor docker image\n",
    "docker pull jittor/jittor\n",
    "docker pull jittor/jittor-cuda\n",
    "```\n",
    "\n",
    "关于Docker安装的详细教程，可以参考[Windows/Mac/Linux通过Docker安装计图](https://cg.cs.tsinghua.edu.cn/jittor/tutorial/2020-5-15-00-00-docker/)\n",
    "\n",
    "## Pip 安装\n",
    "\n",
    "\n",
    "如果您没有准备好环境，或者使用的不是Ubuntu操作系统， 推荐使用**docker安装**， 如果您已经装好编译器和对应版本的Python,我们强烈推荐您使用这种方法\n",
    "(如果无法访问github, 可以通过jittor主页下载):\n",
    "\n",
    "```bash\n",
    "sudo apt install python3.7-dev libomp-dev\n",
    "python3.7 -m pip install jittor\n",
    "# or install from github(latest version)\n",
    "# python3.7 -m pip install git+https://github.com/Jittor/jittor.git\n",
    "python3.7 -m jittor.test.test_example\n",
    "\n",
    "# Upgrade jittor from pip\n",
    "python3.7 -m pip install jittor -U\n",
    "# Upgrade jittor from github\n",
    "python3.7 -m pip install git+https://github.com/Jittor/jittor.git -U\n",
    "```\n",
    "\n",
    "如果测试运行通过,恭喜你已经安装完成.\n",
    "jittor会自动在路径中寻找合适的编译器, 如果您希望手动指定编译器, 请使用环境变量 `cc_path` 和 `nvcc_path`(可选).\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
