Multicore Programming Handout 1: Installing GCC Cilk Plus

Similar documents
Multicore programming in CilkPlus

Exercise 1: Basic Tools

Simulating Multi-Core RISC-V Systems in gem5

MAGPIE Installation Guide (version 1.0)

CS CS9535: An Overview of Parallel Computing

The Cilk part is a small set of linguistic extensions to C/C++ to support fork-join parallelism. (The Plus part supports vector parallelism.

OpenRISC Toolchain Installation Guide. Young Won Lim 6/17/16

Cilk Plus: Multicore extensions for C and C++

Introduction to Supercomputing

Plan. Introduction to Multicore Programming. Plan. University of Western Ontario, London, Ontario (Canada) Multi-core processor CPU Coherence

Zephyr Kernel Installation & Setup Manual

Itron Riva Dev Software Development Getting Started Guide

Using Subversion for Source Code Control

Software Development I

An Overview of Parallel Computing

A simple tutorial on generating PTX assembler out of Ada source code using LLVM NVPTX backend

Cilk Plus GETTING STARTED

Project 1 Setup. Some relevant details are the output of: 1. uname -a 2. cat /etc/*release 3. whereis java 4. java -version 5.

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

TrinityCore Documentation

DEVELOPMENT GUIDE VAB-630. Android BSP v

Introduction to Supercomputing

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry

Parallel Programming

Common Configuration Management Tasks: How to Do Them with Subversion

Revision control systems (RCS) and. Subversion

P6: Trial Build of a ROM Nikhil George. 1. Introduction. Overview of the build task. Cite the build/ wiki articles you read.

Introduction to Linux

CS108, Stanford Handout #37. Source Control CVS

WES 237A Project Part 1 Guide

CSE 351. Introduction & Course Tools

Contents Coding standard Debugging tool Text editor Version control system

Intro to Linux & Command Line

TDDC88 Lab 4 Software Configuration Management

Linux Strace tool user guide

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

CMPT 300. Operating Systems. Brief Intro to UNIX and C

Introduction to Git and Github Repositories

Linux and Git Boot Camp

Manual Java Update Mac Developer Package

sensor-documentation Documentation

MetaFork: A Compilation Framework for Concurrency Platforms Targeting Multicores

Moore s Law. Multicore Programming. Vendor Solution. Power Density. Parallelism and Performance MIT Lecture 11 1.

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Setting up an SDK for Secondo

Home Page. Title Page. Contents. Page 1 of 17. Version Control. Go Back. Ken Bloom. Full Screen. Linux User Group of Davis March 1, Close.

DEVELOPMENT GUIDE VAB-630. Linux BSP v

Introduction to Pintos. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Version control. what is version control? setting up Git simple command-line usage Git basics

The Implementation of Cilk-5 Multithreaded Language

manifold Documentation

Computer Science 62 Lab 8

Implementing DPDK based Application Container Framework with SPP YASUFUMI OGAWA, NTT

Embedded Systems Programming

Recitation #1 Boot Camp. August 30th, 2016

Shell Project Part 1 (140 points)

Concepts in. Programming. The Multicore- Software Challenge. MIT Professional Education 6.02s Lecture 1 June 8 9, 2009

ISA 564, Laboratory I: Buffer Overflows

Source pack installa0on of OpenFOAM. 4.0 into RHL. Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Part A: Setup your kernel development environment

New Contributor Tutorial and Best Practices

CSC111 Computer Science II

SDK. About the Cisco SDK. Installing the SDK. Procedure. This chapter contains the following sections:

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

VirtualSense User Guide 1

TEMU installation and user manual

CSC 2700: Scientific Computing

February 2 nd Jean Parpaillon

Version Control. Kyungbaek Kim. Chonnam National University School of Electronics and Computer Engineering. Original slides from James Brucker

University of Colorado at Colorado Springs CS4500/ Fall 2018 Operating Systems Project 1 - System Calls and Processes

How to install the UpScale SDK compilation framework for the Kalray MPPA Workstation

CSE 390 Lecture 9. Version control and Subversion (svn)

Race Condition Vulnerability Lab

Coding in C at Home. Part 2 Computational Physics. April 21, 2016

Software Tools Subversion

Version Control. CSC207 Fall 2014

Version Control Systems (VCS)

git-pr Release dev2+ng5b0396a

PetaLinux SDK Installation Guide

Introduction to Linux

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Installing the Plugin project

Revision Control. An Introduction Using Git 1/15

Revision Control and GIT

CENG393 Computer Networks Labwork 1

Nexus Application Development - SDK

git the SCM system Jan-Simon Möller training.linuxfoundation.org

2 Initialize a git repository on your machine, add a README file, commit and push

Laboratorio di Programmazione. Prof. Marco Bertini

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

Debugging and Version control

Plan. Introduction to Multicore Programming. Plan. University of Western Ontario, London, Ontario (Canada) Marc Moreno Maza CS CS 9624

Software Development With Emacs: The Edit-Compile-Debug Cycle

Subversion Repository Layout

OSELAS.Support OSELAS.Training OSELAS.Development OSELAS.Services

Lab 1c: Collision detection

2 Installing the Software

Docker task in HPC Pack

2 Setting up the RDMA Framework for Development

Transcription:

Multicore Programming Handout 1: Installing GCC Cilk Plus Leo Ferres Department of Computer Science Universidad de Concepción Email: lferres@inf.udec.cl February 19, 2013 1 Introduction For our lab work, we will need, among other tools, Intel Cilk Plus. Cilk Plus is an extension to the C and C++ programming languages that supports data and task multi-threaded parallel computing. We will see the theory behind Cilk Plus in class. This handout 1 only tells you how to install and test Cilk Plus on your own computer 2. Cilk Plus comes in the Intel Compiler suite (icc) and in the GNU Compiler Collection (included in gcc 4.7 as a patch, and in the release branch for gcc 4.8). This guide is about installing gcc 4.8. gcc 4.7 also comes with some useful GNU Extensions, particularly the atomic builtins 3 that we will surely find occasion to use. Our labs will also involve the use of a 64-bit computer for some of the problem sets. Although this document will guide you through the installation of Cilk Plus for both 32- and 64-bit computers, the emphasis and support will be for the latter. Finally, we will target Linux systems. We have not tested Cilk Plus on Windows. And we probably just won t bother. 2 64-Bit Computer Obviously, to install a 64-bit version of the software, you need both: 64-bit compatible hardware, and a 64-bit instance of the Linux operating system. If executing the command $ grep -m1 -e " lm " /proc/cpuinfo returns non-empty (that is, it returns some string where lm is present), that means you have compliant 64-bit hardware (by the way, lm means long mode ). Finally, if $ uname -m returns something like x86_64, then that means that you re also running a 64-bit Linux OS and that you re all set regarding OS and hardware. In what remains, we will be assuming you have a working gcc installation to bootstrap the new gcc. If not, just sudo apt-get install build-essential. 1 Borrowing heavily from http://groups.csail.mit.edu/sct/wiki/index.php?title=cilk_plus_installation_guide, by Tao B. Schardl at MIT CSAIL 2 Cilk Plus is also installed on the computers in the Software Engineering lab 3 http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-builtins.html 1

2.1 Required libraries The next thing you need to do is install the requirements for your new version of gcc. These are gmp (The GNU Multiple Precision Arithmetic Library), mpfr (GNU Multiple Precision Floating-Point Reliably) and mpc (GNU Multiple Precision Complex Library). Although it is possible to install this from source, it is suggested that you simply install from the repositories (if you have a relatively new version of your OS distribution). In the case of Ubuntu, just do $ sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev in that order. Otherwise, you can still install from source: 4. Notice that the installation has to be performed in the given order: gmp mpfr mpc. Download the latest versions of gmp from http://gmplib.org/, mpfr from http://www.mpfr.org/ and of mpc from http://multiprecision.org/. Configure, build and install mpc by executing the following commands: [mpc] $ sudo mkdir -p /opt/gmp-ver $ tar -jxvf gmp-ver.tar.bz2 $ cd gmp-ver $./configure --prefix=/opt/gmp-ver check Then configure, build and install mpfr following similar commands: [mpfr] $ sudo mkdir -p /opt/mpfr-ver $ tar -jxvf mpfr-ver.tar.bz2 $ cd mpfr-ver $./configure --prefix=/opt/mpfr-ver --with-gmp=/opt/gmp-ver check and finally do the same for mpc [mpc] $ sudo mkdir -p /opt/mpc-ver $ tar -zxvf mpc-ver.tar.gz $ cd mpc-ver $./configure --prefix=/opt/mpc-ver --with-gmp=/opt/gmp-ver --with-mpfr=/opt/mpfr-ver check where ver corresponds to the latest versions of the libraries that you have downloaded. Notice that if you need to install everything from source, you may need to provide the following set of dependencies 5 : $ sudo apt-get install build-essential gcc-multilib flex bison libgmp-dev libmpfr-dev \ mpc libmpc-dev libppl0.11-dev libcloog-ppl-dev zlib1g zlib1g-dev libc6-dev* m4 libgmp3-dev 4 This has been borrowed from http://software.intel.com/en-us/articles/how-to-build-gcc-cilkplus-brance-in-64bit-ubuntu-1204 5 Thanks to Luis Palomo for bringing this to my attention. 2

2.2 GCC Check out the latest gcc version from the svn repositories. All GCC development is done in SVN. The Git repo is a read-only mirror of the SVN repo. Current work happens on the subversion trunk. Certain larger projects happen in a branch (Cilk Plus is a branch) and are then merged to trunk. $ svn checkout svn://gcc.gnu.org/svn/gcc/branches/cilkplus gcc-cilk-src Next, Create two new directories, gcc-cilk-obj and gcc-cilk, in the same directory containing gcc-cilk-src. $ mkdir gcc-cilk-obj gcc-cilk Now configure, build and install gcc: [gcc] $ cd gcc-cilk-obj $../gcc-cilk-src/configure --prefix=/absolute/path/to/gcc-cilk --disable-multilib \ --enable-languages=c IMPORTANT NOTE: If you have installed the required libraries from source, then you will have to let the configure script know where they reside. Thus, the configure command would look like $ configure --prefix=/absolute/path/to/gcc-cilk --with-gmp=/opt/gmp-ver \ --with-mpfr=/opt/mpfr-ver --with-mpc=/opt/mpc-ver --disable-multilib --enable-languages=c The new GCC binary is /path/to/gcc-cilk/bin/gcc. Now you have to set up the environment to use your new installation: [environment script] export PATH=path/to/gcc-cilk/bin:$PATH export LD_LIBRARY_PATH=path/to/gcc-cilk/lib export LIBRARY_PATH=path/to/gcc-cilk/lib Save this in, say cilk.sh, and then whenever you want to run in this environment, first do $ source cilk.sh 2.3 Cilkutils There are two interesting utilities that Intel makes available for use with Cilk Plus: cilkscreen (a data race detector) and cilkview a parallel/scalability measuring tool. To install these tools as well download the latest version from: http://software.intel.com/en-us/articles/download-intel-cilk-plus-software-development-kit. [cilkutil] $ tar vxzf cilkutils.tgz And that s all there is to the installation. The only thing that remains to be done is to add the path to the cilkutil/bin directory export PATH=/path/to/cilkutil/bin:$PATH to your cilk.sh environment script. Now you should be able to run both utilities. 3

2.4 Test the installation To test your installation, you may copy the following code into a text editor: #include <stdio.h> #include <cilk/cilk.h> #include <cilk/cilk_api.h> int fib(int n) { int a,b; if (n < 2) return n; a= cilk_spawn fib(n-1); b= fib(n-2); cilk_sync; return a+b; } int main(int argc, char *argv[]) { printf ("%d\n",fib(40)); return 0; } To compile this program: $ gcc fib.c -o fib -fcilkplus -lcilkrts To set maximum number of worker threads for the Cilk Plus runtime: export CILK_NWORKERS=N To fix error using cilkview: The Operating System configuration prevents Pin from using the default (parent) injection mode : $ sudo bash $ echo 0 > /proc/sys/kernel/yama/ptrace_scope Run cilkview: $ cilkview -trials all 4 ~/fib 3 32-Bit Computer 4 Troubleshooting *NOT IMPLEMENTED YET* *I DON T HAVE A 32-BIT COMPUTER TO TEST THIS* 4

5 Revisions Date Comment Owner 2012-12-29-17:20 Initial version of doc Leo 2013-01-17-15:00 Running experiments on Keira José 5