Skip to content
Rob Nagler edited this page Nov 17, 2019 · 35 revisions

Amazon Web Services (AWS)

Setup Instance

From console:

  • CentOS 7 Official AMI with HVM
  • Use public-ssh security group
  • Use existing key
  • Encrypt all disks
  • 10g root partion

Once booted, get public and private IPs:

  • Add IPs to named
  • ssh centos@<public-ip>
  • sudo su -
  • cat > /root/.ssh/authorized_keys -- add key
  • Do not logout yet, verify first
  • ssh root@<public-ip>
  • userdel -r centos
  • Logout of original session
  • yum install -y lvm2
  • fdisk -l -- determine local volume
  • pvcreate <disk>
  • vgcreate centos <disk>

Proceed with post installation instructions.

GPU Driver install

# need kernel source which is always the latest so do update first
yum update -y
yum install -y kernel-devel
# if new kernel, then
reboot
yum remove $(rpm -qa | grep ^kernel-3 | grep -v $(uname -r))
curl -O https://s3.amazonaws.com/nvidia-gaming/NVIDIA-Linux-x86_64-435.22-grid.run
# this is a curses program so don't run in emacs; doesn't respectmyterm.com!
sh NVIDIA*run
# you will probably have to reboot to add the nouveau driver to the modprobe blacklist
# See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-nvidia-driver.html#Cluster_GPUs_Manual_Install_Driver
echo vGamingMarketplace=2 > /etc/nvidia/gridd.conf
curl -o /etc/nvidia/GridSwCert.txt https://s3.amazonaws.com/nvidia-gaming/GridSwCert-Linux.cert
# https://nvidia.github.io/nvidia-container-runtime/
curl -s -L https://nvidia.github.io/nvidia-container-runtime/centos7/nvidia-container-runtime.repo \
    | install -m 444 /dev/stdin /etc/yum.repos.d/nvidia-container-runtime.repo
yum install -y nvidia-container-runtime
systemctl restart docker

Docker Container Build

See https://github.com/NVIDIA/nvidia-docker/wiki

docker run -it --name=gpu -u root radiasoft/beamsim-jupyter:prod bash <<'EOF'
rpm -i https://developer.download.nvidia.com/compute/cuda/repos/fedora29/x86_64/cuda-repo-fedora29-10.1.243-1.x86_64.rpm
dnf install -y kmodtool kernel-devel
dnf install -y cuda-drivers
EOF
docker commit --change 'USER vagrant' --change 'CMD ["/home/vagrant/.radia-run/tini", "--", "/home/vagrant/.radia-run/start"]' gpu gpu
docker rm gpu

Verify ssh key fingerprint

You have to convert the ssh private key to PEM format then DER format, and finally compute md5:

ssh-keygen -e -m PEM -f ~/.ssh/id_rsa | openssl rsa -RSAPublicKey_in -outform DER | openssl md5 -c

Clone this wiki locally