配有英伟达显卡的主机,装完 Ubuntu 16.04 后出现闪屏现象,是由于没有安装显卡驱动。
显卡型号
NVIDIA Corporation GM204 [GeForce GTX 970]
# -*- coding: utf-8 -*- | |
""" | |
@src: https://github.com/QuantumLiu/tf_gpu_manager/blob/master/manager_torch.py | |
Example: | |
in shell: | |
gpu_id=$(python gpu_selector.py 3>&2 2>&1 1>&3) | |
in python: | |
gm=GPUManager() | |
with torch.cuda.device(gm.auto_choice()): |
# -*- coding: utf-8 -*- | |
# requirements: requests | |
# conda/pip install requests | |
# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests==1.2.3 # version for python2.6, but has problem in SSL | |
import os | |
from contextlib import closing | |
import threading | |
import time | |
import sys | |
import requests |
import os | |
import sys | |
import argparse | |
import numpy as np | |
from PIL import Image, ImageDraw | |
import cv2 | |
import time | |
import json | |
# Make sure that caffe is on the python path: |
These commands are based on a askubuntu answer http://askubuntu.com/a/581497 | |
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below. | |
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING. | |
ABSOLUTELY NO WARRANTY. | |
If you are still reading let's carry on with the code. | |
sudo apt-get update && \ | |
sudo apt-get install build-essential software-properties-common -y && \ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ |
DEVICE="he-ipv6" | |
DEVICETYPE=sit | |
BOOTPROTO=none | |
ONBOOT=yes | |
IPV6INIT=yes | |
IPV6TUNNELIPV4=184.105.253.10 | |
IPV6TUNNELIPV4LOCAL=XXX.XXX.XXX.XXX | |
IPV6ADDR=2001:470:YYYY:YYYY::2/64 | |
IPV6_DEFAULTGW=2001:470:YYYY:YYYY::1 |
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" | |