Welcome to University of Illinois ECE508 for Spring 2019. This page contains information about how to access and submit the labs.
Clone this repository to get the project folder.
git clone https://github.com/illinois-impact/gpu-algorithms-labs.git
Download the rai binary for your platform from URL. You will probably use it for development, and definitely use it for submission.
You should have received a .rai_profile
file by email.
Put that file in ~/.rai_profile
(Linux/macOS) or %HOME%/.rai_profile
(Windows).
Your .rai_profile
should look something like this (indented with tabs!)
profile:
firstname: <your-given-name>
lastname: <your-surname>
username: <your-username>
email: <your-institution-email>
access_key: <your-access-key>
secret_key: <your-secret-key>
affiliation: <your-affiliation>
Some more info is available on the Client Documentation Page.
On Windows, you'll need to open notepad and paste the profile output given. Then SaveAs
and type in %HOMEPATH%
.
Type in .rai_profile
as the name of the file and change the file type to all
.
The screenshot below shows what it should look like.
Several labs will be assigned over the course of the semester
- Device Query
- Scatter/Gather ( <- two-part lab!!!)
- Stencil - coming soon!
- Joint-tiled SGEMM - coming soon!
- Binning
- BFS - coming soon!
- Merge - coming soon!
The main code of each lab is in the main.cu
, which is the file you will be editing. Helper code that's specific to the lab is in the helper.hpp
file and the common code across the labs in the common
folder. You are free to add/delete/rename files but you need to make the appropriate changes to the CMakeLists.txt
file.
To run any lab you cd
into that directory, cd labs/device_query
for example, and run rai -p .
.
From a user's point a view when the client runs as if it was local.
Some more info is available on the Client Documentation Page.
NOTE: You may need to use the absolute path if submitting from windows.
Throughout the summer school you'll be developing the labs. The folowing information is common through all the labs and might be helpful while developing.
It might be useful to figure out the time of each code section to identify the bottleneck code.
In common/utils.hpp
a function called timer_start/timer_stop
which allows you to get the current time at a high resolution.
To measure the overhead of a function f(args...)
, the pattern to use is:
timer_start(/* msg */ "calling the f(args...) function");
f(args...);
timer_stop();
This will print the time as the code is running.
We provide some helper utility functions in the common/utils.hpp
file.
Each lab contains the code to compute the golden (true) solution of the lab. We use Catch2 to perform tests to verify the results are accurate within the error tollerance. You can read the Catch2 tutorial if you are interested in how this works.
Subsets of the test cases can be run by executing a subset of the tests. We recomend running the first lab with -h
option to understand what you can perform, but the rough idea is if you want to run a specific section (say [inputSize:1024]
) then you pass -c "[inputSize:1024]"
to the lab.
NOTE: The labs are configured to abort on the first error (using the -a
option in the rai_build.yml
file). You may need to change this to show the full list of errors.
To check and throw CUDA errors, use the THROW_IF_ERROR function. This throws an error when a CUDA error is detected which you can catch if you need special handling of the error.
THROW_IF_ERROR(cudaMalloc((void **)&deviceW, wByteCount));
Profiling can be performed using nvprof
. Place the following build commands in your rai-build.yml
file
- >-
nvprof --cpu-profiling on --export-profile timeline.nvprof --
./mybinary -i input1,input2 -o output
- >-
nvprof --cpu-profiling on --export-profile analysis.nvprof --analysis-metrics --
./mybinary -i input1,input2 -o output
You could change the input and test datasets. This will output two files timeline.nvprof
and analysis.nvprof
which can be viewed using the nvvp
tool (by performing a file>import
). You will have to install the nvvp viewer on your machine to view these files.
NOTE: nvvp
will only show performance metrics for GPU invocations, so it may not show any analysis when you only have serial code.
You will need to install the nvprof viewer for the CUDA website and the nvprof GUI can be run without CUDA on your machine.
All data files that are in the /build
folder are temporarily uploaded to a file storage server. This allows you to dump output files during execution and analyze them locally.
✱ The build folder has been uploaded to http://s3.amazonaws.com/files.rai-project.com/abc.tar.gz. The data will be present for only a short duration of time.
Within the rai_build.yml
environment, run cmake -DCMAKE_BUILD_TYPE=Debug /src
this will enable debugging mode. You may also want to pass the -g -pg -lineinfo
option to the compiler.
You can use the docker image and or install CMake within a CUDA envrionment. Then run cmake [lab]
and then make
. We do not using your own machine, and we will not be debugging your machine/installation setup.
Please use the Github issue manager to report any issues or suggestions.
Include the outputs of
rai version
as well as the output of
rai buildtime
In your bug report. You can also invoke the rai
command with verbose and debug outputs using
rai --verbose --debug
NCSA/UIUC © Abdul Dakkak