|1.||Introduction to C++|
|2||Variables, branching, and loops|
|3.||Functions and recursions|
|11.||Object oriented programming|
|12.||Trees in C++|
|14.||Sets and maps: simplified|
|15.||Sets and maps: standard|
|17.||Multi core programming and threads|
|18.||Representation of integers in computers|
|19.||Floating point representation|
|22.||Reading data from internet|
|23.||Graphic cards and OpenCL|
|24.||OpenCL on AWS|
|25.||OpenCV and optical mark recognition|
If you choose to follow these instructions you will have to initiate a P3 instance of Amazon Web Services for which you will be charged the usage fees. These fees are less than dollar for an hour. However, you may face a substantial several thousand dollars bill if you let the instance run continuously for a year without termination.
If you are creating P3 instance for the first time, you will very likely have to submit a "Limit Increase Request" to Amazon. It may take 3 days for Amazon to grant you the permission to run a P3 instance.
This document contains the explanation on how to create an Amazon p3.2xlarge instance that runs Ubuntu 18.04 on which it is possible to practice parallel programming in OpenCL and C++. It will take about 30 minutes to complete the steps outlined below. The instructions presented are adaption of instructions from CUDA 7.5 on AWS GPU Instance Running Ubuntu 14.04.
Go to console.aws.amazon.com and click on the link "Launch virtual machine with EC2".
Select Ubuntu Server 18.04 LTS (HVM), SSD Volume Type and make sure that the selection is made for 64-bit (x86). As of February 2019, the instance type is ami-0bbe6b35405ecebdb and the default offering by Amazon may change. The tutorial is tested on ami-0bbe6b35405ecebdb but will probably continue working for newer versions.
Choose GPU instance p3.2xlarge and click on Preview and Launch.
You will notice a warning that tells you that this instance is not free. If you are reading this tutorial, you are probably aware of the fact already.
Click on the link Edit security groups. In the column Source select My IP. If you intend to access the instance from a different IP address then you should
After you are done, click on Preview and Launch.
You may want to add storage space to your instance. Click on Edit storage. The column Size (GiB) contains the number 8. Change it to at least \(20\) and click on Preview and Launch.
Click on Launch.
In the case that you have not created a public/private keypair, you need to follow the instructions below
You will be asked to select an existing key pair or create a new one. If you do not have existing key pairs you need to create a new one. You can give a name to the key pair. If you lack an inspiration at the moment, choose key_pair_for_aws_p3 as the name for the key pair.
Click on Download Key Pair. The name of the file that will be downloaded is key_pair_for_aws_p3.pem. You should copy this file to a local folder on your computer. For example folder /Users/myName/opencl_tutorial. Open the terminal window and enter the folder /Users/myName/opencl_tutorial by typing
You should change the permissions on the file so it is accessible only to you. To do this, type
When you want to execute the SSH command that logs you into the instance, make sure your terminal process starts from the folder /Users/myName/opencl_tutorial.
It is very likely that you will need to submit a request for the increase in the instance limit. If the following message appears:
You have requested more instances (1) than your current instance limit of 0 allows for the specified instance type. Please visit http://aws.amazon.com/contact-us/ec2-request to request an adjustment to this limit.then you will need to contact amazon customer support and submit a request to launch one P3.2xlarge instance. It may take 2-3 days for the request to be approved.
Click on Instances in EC2 console. You should see that you have 1 running instance. Click on this link. In order to log in to the instance we need to find out the SSH command. The proper SSH command must contain the public DNS and the entire command is obtained by clicking on the link Connect. The pop-up window named Connect To Your Instance will provide an example of the correct SSH command. It should look something like:
Copy the appropriate command from the pop-up window and paste it to your terminal session. After this you may close the pop-up window. When asked about whether you are sure that you want to continue, you should write yes and press enter.
Execute the following two commands from the terminal:
Execute the following commands to upgrade the packages:
Execute the clean utility.
Since the operating system we are running is the server version of Ubuntu 18.04 it comes without graphical user interface, and specifically without Direct Rendering Manager (DRM). Since DRM module is needed by NVIDIA drivers, we have to install it with the command
If you end up upgrading the kernel, you may need to re-run this command. Refer to Caffe on EC2 Ubuntu 14.04 Cuda 7 for further explanation.
If you want to have OpenCL and/or CUDA, you must install CUDA first. The newest version is installed with the command
Run the following command
You will receive the following output:
The following commands install OpenCL
In order to verify that the OpenCL installation was successful we will compile and run one openCL program. You first need to download the archive that contains the source code.
After the download is complete, you need to unpack the archive using
To compile and run the sample program, type the following
Your openCL installation is successful if the file output01.txt is created according to the requirements of our Example 1 from the document Graphic cards and OpenCL