amax
is allowed to use sudo
on server 84. If need to use, you can
sudo
from amax
.id_rsa
file so that you can access this private repo.Here provide a method to share Internet of your laptop to server.
sudo apt-get install openssh-client
In the most case, this works:
ssh -gfNTD 1080 username@serverip
proxychains curl ip.gs
If 1080 is being used, you can
cp /etc/proxychains.conf ./
vim ./proxychains.conf # and modify 1080 to 1081
ssh -gfNTD 1081 username@serverip
proxychains curl ip.gs
For convenience, you can add this to .bashrc
or other rc
files you are using.
alias git='proxychains git'
alias pip='proxychains pip2'
alias pip2='proxychains pip2'
alias pip3='proxychains pip3'
alias wget='proxychains wget -c '
alias conda='proxychains conda'
In terminal, before running program, set environment variable.
export CUDA_VISIBLE_DEVICES=0,1
python train.py
python resume.py
CUDA_VISIBLE_DEVICES=0,1 python train.py
In python, set environment variable.
def init_dev(n=(0,)):
from os.path import expanduser
logging.info('use gpu {}'.format(n))
home = expanduser("~")
if isinstance(n, int):
n = (n,)
devs = ''
for n_ in n:
devs += str(n_) + ','
os.environ["CUDA_VISIBLE_DEVICES"] = devs
# set_env('PATH', home + '/cuda-8.0/bin' )
# set_env('LD_LIBRARY_PATH', '/usr/local/cuda-8.0/lib64')
def set_env(key, value):
os.environ[key] = value + ':' + os.environ[key]
In python: use tf.device
when construct graph.
In order to know how much memory I consume, really.
def allow_growth_tf():
import tensorflow as tf
_sess_config = tf.ConfigProto(allow_soft_placement=True)
_sess_config.gpu_options.allow_growth = True
return _sess_config
def allow_growth_keras():
import tensorflow as tf
tf_graph = tf.get_default_graph()
_sess_config = allow_growth_tf()
sess = tf.Session(config=_sess_config, graph=tf_graph)
import keras.backend as K
K.set_session(sess)
return sess
System config: Apt source, use one of:
Copy them to your home path, i.e., ~.
.condarc
: use ustc’s mirror.pip
: use tsinghua’s mirrorCopy them to current directory to override system config.
proxychains.conf
: proxy for http(s) and sock5tsocks.conf
: proxy for sock5