-
Notifications
You must be signed in to change notification settings - Fork 2
Exercise 1 CSCStimer
The goal of this first exercise is to let you familiarize with the CSCS system environment and to understand how to measure the amount of time/cycles spent by some specific portions of code. To achieve this goal, you’re asked to download and compile a ready-made class providing a simple timer implementation.
First, log into todi.cscs.ch by using your CSCS account (provided at start of exercise). You can use
ssh –X [email protected]
and then
ssh –Y [email protected]
The option -Y works as –X, and enables X-windows protocol.
For this first exercise you don’t need to set any special module or to allocate resources. By this time, you should have downloaded the course material (see previous page) or copied to your home the contents of the “CscsTimer” directory (from the exercises section of the Autumn School portal). If not, this is most easily done by cloning the GPU_Libraries_2013 repository, which gets you all the course material at once. In your home directory on Todi:
module load git
git clone https://github.com/fomics/GPU_Libraries_2013.git
Now proceed to the CSCStimer directory:
cd GPU_Libraries_2013/Exercises/CscsTimer/CscsTimer
There are three main project files:
- cscs_timer.cpp and cscs_timer.h are a stand-alone static class for measuring time and CPU cycles
- main.cpp is an example on how to use the CscsTimer class
The code is Linux/Windows compatible and, just in case of, a Visual Studio 2012 solution is also provided. Compile and run the example. What is the CPU frequency? (Make an educated guess…) Have a look at the code (e.g., using gedit). Add a method for computing the Fibonacci sequence. Modify the code in order to measure the time required to compute each of the first N numbers of the Fibonacci sequence. Suggestion: don’t use anything bigger than N=44.