AWS (Linux)

Important

This guide is meant for demonstration purposes only.

This guide will walk through how to setup a single AWS instance with multiple GPUs.

Before starting, it is recommended to have the following items ready:

  • AWS account

  • AWS subscription and quota capable of starting GPU instances such as p2.xlarge or better

  • SSH public key

  • SSH/SCP programs on local computer (eg. Putty/Winscp on windows)

  • M-Star license file (you may need to first obtain the MAC address of the instance before a license file will be issueed)

After finishing these steps, you will have a AWS GPU instance fully setup. The installation of the software will be done to the /usr/local folder for a system-wide installation.

Create a virtual machine

  • Go to the EC2 Dashboard

  • Launch Instance

  • Choose “Ubuntu Server 18.04 LTS (HVM), SSD Volume Type”. Click Select

  • Choose the Instance type: p2 or p3 instances are recommended. Click Next.

  • Configure Instance Details. (Setup as needed). Click Next.

  • Configure Add Storage

    • Setup Root device with 20GB

    • Click “Add New Volume”. Setup a data disk with the capacity you need for simulations. 100GB+

    • Click Next

  • Configure Tags. Setup as needed. Click Next.

  • Configure Security Group

    • Create or select a security group that has the following rule. This allows SSH traffic to the instance

      • Type: SSH

      • Source: Custom, 0.0.0.0/0

    • Click Review and Launch

  • Launch the instance

  • Proceed back to the instance dashboard

  • Wait for instance to come up

Install Software

  • SSH to the instance using the “ubuntu” username

  • Copy and paste the script shown below into a new file and execute it once. This script does the following:

    • Sets up the data disk you defined under the /data directory

    • Install CUDA

    • Install OpenMPI to /usr/local

  • Install M-Star CFD using the standard Linux instructions

Warning

  • This instance is configured open to the internet

  • Be aware of how storage volume persist after virtual machine termination

Ubuntu AWS Setup Script:

#!/bin/bash

function add_disk () {

partname=$1
partname+="1"

lsblk | grep -q $partname

if [ $? -eq 0 ]; then

echo "Existing partition found at $1, skipping fdisk, mkfs"

else

sudo fdisk $1 <<EOF
n
p
1


w
EOF

sudo mkfs.ext4 $partname
echo "$partname      $2   ext4    defaults        0 0" |sudo tee -a /etc/fstab
sudo mkdir -p $2
sudo mount -a
sudo chmod 777 $2

fi

}

function install_cuda () {
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.105-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.1.105-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install -y cuda vim nano git build-essential
}

function install_openmpi () {
sudo apt-get update
sudo apt-get install -y build-essential
wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.3.tar.gz
tar xzf openmpi-3.1.3.tar.gz
mkdir openmpi-3.1.3-build
cd openmpi-3.1.3-build
../openmpi-3.1.3/configure --prefix=$INSTALL_PATH --with-cuda
make -j 4 && sudo make install
cd ..
sudo ldconfig
}

add_disk /dev/xvdb /data
install_cuda
install_openmpi

# Now Install M-Star CFD using the standard Linux instructions