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 the Ubuntu 18.04 AMI. Click Select

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

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

  • Configure Add Storage

  • Setup Root device with 500GB, 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:

Tip

To perform a quick install on Ubuntu 18. Please see Ubuntu 18 Quick Setup

Warning

  • This instance is configured open to the internet

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

Install CUDA

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda

Build and install OpenMPI

wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.1.tar.gz
tar xzf openmpi-4.1.1.tar.gz
cd openmpi-4.1.1
mkdir build
cd build
../configure --prefix=$HOME/openmpi --with-cuda
make -j 4 && sudo make install

Copy this text into a new file $HOME/openmpi/env.sh

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export PATH=$DIR/bin:$PATH
export LD_LIBRARY_PATH=$DIR/lib:$LD_LIBRARY_PATH

Download and install M-Star

# Now Install M-Star CFD using the standard Linux instructions
cd $HOME
mkdir mstarcfd
cd mstarcfd
wget ##COPY-PASTE LINK##
tar xzf mstarcfd-centos7-2.0.X.tar.gz

# SETUP license file according to license install instructions.

Download test cases

cd
wget https://cdn.mstarcfd.com/testcases-10272021.tar
tar xf testcases-10272021.tar

Navigate to one of the test cases directories containing an input.xml file.

Create run.sh script in the test case directory to bring in the openmpi and mstar environments.

source $HOME/openmpi/mstar.sh
source $HOME/mstarcfd/mstar.sh

mpirun -np 4 mstar-cfd-mgpu -i input.xml -o out --gpu-auto

Run the execution script

chmod +x run.sh
./run.sh