|
|
|
|
|
|
|
|
|
|
## Preconfigured AMI |
|
|
|
|
|
|
|
We've prepared an preconfigured AMI for you with the ID: `ami-18642967` in the |
|
|
|
We've prepared a preconfigured AMI for you with the ID: `ami-18642967` in the |
|
|
|
(Ubuntu)](https://aws.amazon.com/marketplace/pp/B077GCH38C). If you want to do |
|
|
|
training without the headless mode, you need to enable X Server on it. After |
|
|
|
launching your EC2 instance using the ami and ssh into it, run the following |
|
|
|
commands to enable it: |
|
|
|
(Ubuntu)](https://aws.amazon.com/marketplace/pp/B077GCH38C). The AMI has been |
|
|
|
tested with p2.xlarge instance. Furthermore, if you want to train without |
|
|
|
headless mode, you need to enable X Server. |
|
|
|
|
|
|
|
After launching your EC2 instance using the ami and ssh into it, run the |
|
|
|
following commands to enable it: |
|
|
|
//Start the X Server, press Enter to come to the command line |
|
|
|
# Start the X Server, press Enter to come to the command line |
|
|
|
//Check if Xorg process is running |
|
|
|
//You will have a list of processes running on the GPU, Xorg should be in the list, as shown below |
|
|
|
# Check if Xorg process is running |
|
|
|
# You will have a list of processes running on the GPU, Xorg should be in the |
|
|
|
# list, as shown below |
|
|
|
/* |
|
|
|
* Thu Jun 14 20:27:26 2018 |
|
|
|
* +-----------------------------------------------------------------------------+ |
|
|
|
* | NVIDIA-SMI 390.67 Driver Version: 390.67 | |
|
|
|
* |-------------------------------+----------------------+----------------------+ |
|
|
|
* | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | |
|
|
|
* | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |
|
|
|
* |===============================+======================+======================| |
|
|
|
* | 0 Tesla K80 On | 00000000:00:1E.0 Off | 0 | |
|
|
|
* | N/A 35C P8 31W / 149W | 9MiB / 11441MiB | 0% Default | |
|
|
|
* +-------------------------------+----------------------+----------------------+ |
|
|
|
* |
|
|
|
* +-----------------------------------------------------------------------------+ |
|
|
|
* | Processes: GPU Memory | |
|
|
|
* | GPU PID Type Process name Usage | |
|
|
|
* |=============================================================================| |
|
|
|
* | 0 2331 G /usr/lib/xorg/Xorg 8MiB | |
|
|
|
* +-----------------------------------------------------------------------------+ |
|
|
|
*/ |
|
|
|
//Make the ubuntu use X Server for display |
|
|
|
# Thu Jun 14 20:27:26 2018 |
|
|
|
# +-----------------------------------------------------------------------------+ |
|
|
|
# | NVIDIA-SMI 390.67 Driver Version: 390.67 | |
|
|
|
# |-------------------------------+----------------------+----------------------+ |
|
|
|
# | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | |
|
|
|
# | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |
|
|
|
# |===============================+======================+======================| |
|
|
|
# | 0 Tesla K80 On | 00000000:00:1E.0 Off | 0 | |
|
|
|
# | N/A 35C P8 31W / 149W | 9MiB / 11441MiB | 0% Default | |
|
|
|
# +-------------------------------+----------------------+----------------------+ |
|
|
|
# |
|
|
|
# +-----------------------------------------------------------------------------+ |
|
|
|
# | Processes: GPU Memory | |
|
|
|
# | GPU PID Type Process name Usage | |
|
|
|
# |=============================================================================| |
|
|
|
# | 0 2331 G /usr/lib/xorg/Xorg 8MiB | |
|
|
|
# +-----------------------------------------------------------------------------+ |
|
|
|
|
|
|
|
# Make the ubuntu use X Server for display |
|
|
|
$ export DISPLAY=:0 |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
1. Install and setup Xorg: |
|
|
|
|
|
|
|
```console |
|
|
|
//Install Xorg |
|
|
|
# Install Xorg |
|
|
|
//Get the BusID information |
|
|
|
# Get the BusID information |
|
|
|
//Add the BusID information to your /etc/X11/xorg.conf file |
|
|
|
# Add the BusID information to your /etc/X11/xorg.conf file |
|
|
|
//Remove the Section "Files" from the /etc/X11/xorg.conf file |
|
|
|
$ sudo vim /etc/X11/xorg.conf //And remove two lines that contain Section "Files" and EndSection |
|
|
|
# Remove the Section "Files" from the /etc/X11/xorg.conf file |
|
|
|
# And remove two lines that contain Section "Files" and EndSection |
|
|
|
$ sudo vim /etc/X11/xorg.conf |
|
|
|
//Download and install the latest Nvidia driver for ubuntu |
|
|
|
# Download and install the latest Nvidia driver for ubuntu |
|
|
|
//Disable Nouveau as it will clash with the Nvidia driver |
|
|
|
# Disable Nouveau as it will clash with the Nvidia driver |
|
|
|
$ sudo echo 'blacklist nouveau' | sudo tee -a /etc/modprobe.d/blacklist.conf |
|
|
|
$ sudo echo 'options nouveau modeset=0' | sudo tee -a /etc/modprobe.d/blacklist.conf |
|
|
|
$ sudo echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf |
|
|
|
|
|
|
4. Make sure there are no Xorg processes running: |
|
|
|
|
|
|
|
```console |
|
|
|
//Kill any possible running Xorg processes |
|
|
|
//Note that you might have to run this command multiple times depending on how Xorg is configured. |
|
|
|
# Kill any possible running Xorg processes |
|
|
|
# Note that you might have to run this command multiple times depending on |
|
|
|
# how Xorg is configured. |
|
|
|
//Check if there is any Xorg process left |
|
|
|
//You will have a list of processes running on the GPU, Xorg should not be in the list, as shown below. |
|
|
|
# Check if there is any Xorg process left |
|
|
|
# You will have a list of processes running on the GPU, Xorg should not be in |
|
|
|
# the list, as shown below. |
|
|
|
/* |
|
|
|
* Thu Jun 14 20:21:11 2018 |
|
|
|
* +-----------------------------------------------------------------------------+ |
|
|
|
* | NVIDIA-SMI 390.67 Driver Version: 390.67 | |
|
|
|
* |-------------------------------+----------------------+----------------------+ |
|
|
|
* | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | |
|
|
|
* | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |
|
|
|
* |===============================+======================+======================| |
|
|
|
* | 0 Tesla K80 On | 00000000:00:1E.0 Off | 0 | |
|
|
|
* | N/A 37C P8 31W / 149W | 0MiB / 11441MiB | 0% Default | |
|
|
|
* +-------------------------------+----------------------+----------------------+ |
|
|
|
* |
|
|
|
* +-----------------------------------------------------------------------------+ |
|
|
|
* | Processes: GPU Memory | |
|
|
|
* | GPU PID Type Process name Usage | |
|
|
|
* |=============================================================================| |
|
|
|
* | No running processes found | |
|
|
|
* +-----------------------------------------------------------------------------+ |
|
|
|
*/ |
|
|
|
|
|
|
|
# Thu Jun 14 20:21:11 2018 |
|
|
|
# +-----------------------------------------------------------------------------+ |
|
|
|
# | NVIDIA-SMI 390.67 Driver Version: 390.67 | |
|
|
|
# |-------------------------------+----------------------+----------------------+ |
|
|
|
# | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | |
|
|
|
# | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |
|
|
|
# |===============================+======================+======================| |
|
|
|
# | 0 Tesla K80 On | 00000000:00:1E.0 Off | 0 | |
|
|
|
# | N/A 37C P8 31W / 149W | 0MiB / 11441MiB | 0% Default | |
|
|
|
# +-------------------------------+----------------------+----------------------+ |
|
|
|
# |
|
|
|
# +-----------------------------------------------------------------------------+ |
|
|
|
# | Processes: GPU Memory | |
|
|
|
# | GPU PID Type Process name Usage | |
|
|
|
# |=============================================================================| |
|
|
|
# | No running processes found | |
|
|
|
# +-----------------------------------------------------------------------------+ |
|
|
|
|
|
|
|
//Start the X Server, press Enter to come to the command line |
|
|
|
# Start the X Server, press Enter to come back to the command line |
|
|
|
//Check if Xorg process is running |
|
|
|
//You will have a list of processes running on the GPU, Xorg should be in the list. |
|
|
|
# Check if Xorg process is running |
|
|
|
# You will have a list of processes running on the GPU, Xorg should be in the list. |
|
|
|
//Make the ubuntu use X Server for display |
|
|
|
# Make the ubuntu use X Server for display |
|
|
|
$ export DISPLAY=:0 |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
//For more information on glxgears, see ftp://www.x.org/pub/X11R6.8.1/doc/glxgears.1.html. |
|
|
|
# For more information on glxgears, see ftp://www.x.org/pub/X11R6.8.1/doc/glxgears.1.html. |
|
|
|
//If Xorg is configured correctly, you should see the following message |
|
|
|
/* |
|
|
|
* Running synchronized to the vertical refresh. The framerate should be |
|
|
|
* approximately the same as the monitor refresh rate. |
|
|
|
* 137296 frames in 5.0 seconds = 27459.053 FPS |
|
|
|
* 141674 frames in 5.0 seconds = 28334.779 FPS |
|
|
|
* 141490 frames in 5.0 seconds = 28297.875 FPS |
|
|
|
*/ |
|
|
|
# If Xorg is configured correctly, you should see the following message |
|
|
|
|
|
|
|
# Running synchronized to the vertical refresh. The framerate should be |
|
|
|
# approximately the same as the monitor refresh rate. |
|
|
|
# 137296 frames in 5.0 seconds = 27459.053 FPS |
|
|
|
# 141674 frames in 5.0 seconds = 28334.779 FPS |
|
|
|
# 141490 frames in 5.0 seconds = 28297.875 FPS |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
## Training on EC2 instance |
|
|
|
|
|
|
2. Open the Build Settings window (menu: File > Build Settings). |
|
|
|
3. Select Linux as the Target Platform, and x86_64 as the target architecture. |
|
|
|
4. Check Headless Mode (If you haven't setup the X Server). |
|
|
|
3. Select Linux as the Target Platform, and x86_64 as the target architecture |
|
|
|
(the default x86 currently does not work). |
|
|
|
4. Check Headless Mode if you have not setup the X Server. (If you do not use |
|
|
|
Headless Mode, you have to setup the X Server to enable training.) |
|
|
|
7. Test the instance setup from Python using: |
|
|
|
7. Change the permissions of the executable. |
|
|
|
|
|
|
|
```console |
|
|
|
chmod +x <your_env>.x86_64 |
|
|
|
``` |
|
|
|
8. (Without Headless Mode) Start X Server and use it for display: |
|
|
|
|
|
|
|
```console |
|
|
|
# Start the X Server, press Enter to come back to the command line |
|
|
|
$ sudo /usr/bin/X :0 & |
|
|
|
|
|
|
|
# Check if Xorg process is running |
|
|
|
# You will have a list of processes running on the GPU, Xorg should be in the list. |
|
|
|
$ nvidia-smi |
|
|
|
|
|
|
|
# Make the ubuntu use X Server for display |
|
|
|
$ export DISPLAY=:0 |
|
|
|
``` |
|
|
|
9. Test the instance setup from Python using: |
|
|
|
|
|
|
|
```python |
|
|
|
from mlagents.envs import UnityEnvironment |
|
|
|
|
|
|
Where `<your_env>` corresponds to the path to your environment executable. |
|
|
|
|
|
|
|
You should receive a message confirming that the environment was loaded successfully. |
|
|
|
8. Train the executable |
|
|
|
10. Train your models |
|
|
|
chmod +x <your_env>.x86_64 |
|
|
|
mlagents-learn <trainer-config-file> --env=<your_env> --train |
|
|
|
``` |