T UTORIAL L ESSON Tools
description
Transcript of T UTORIAL L ESSON Tools
TUTORIAL LESSONTools
Institute of Parallel and Distributed System (iPads)Shanghai Jiao Tong University
Rong [email protected]
OUTLINE
Parallel Processing Institute, Fudan University 2
Pre-requisiteSVNToolchain
Pre-requisiteSVN Toolchain
Parallel Processing Institute, Fudan University 3
VERSION CONTROL
APT (Advanced Package Tools) A management system for software
packages Package resource list for APT:
/etc/apt/sources.list
4
$ cat /etc/apt/source.list ... deb http://ftp.sjtu.edu.cn/debian/ squeeze main dbe-src http://ftp.sjtu.edu.cn/debian/ squeeze main type URI of source dist comp URI type: http, ftp, cdrom, file, ssh ...Institute of Parallel and Distributed System (iPads),
SJTU
VERSION CONTROL
APT (Advanced Package Tools) apt-get: command-line tool
update e.g. >apt-get update install e.g. >apt-get install htop remove e.g. >apt-get remove htop upgrade e.g. >apt-get upgrade htop
apt-cache: cache manipulator search e.g. >apt-cache search htop showpkg e.g. >apt-cache showpkg htop
5Institute of Parallel and Distributed System (iPads), SJTU
VERSION CONTROL
APT (Advanced Package Tools) example: install vim
>su root user >apt-get update update apt list >apt-cache search vim search in cache
>apt-get install vim install vim >man vim manual of vim
6
$ apt-cache search vim ... vim – Vi IMproved – enhanced vi editor vim-doc - Vi IMproved – HTML documentation ...Institute of Parallel and Distributed System (iPads),
SJTU
Pre-requisiteSVN Toolchain
Parallel Processing Institute, Fudan University 7
VERSION CONTROL
SVN (SubVersioN) Maintain current and historical
versions of files
Parallel Processing Institute, Fudan University 8
SVN1
SVN1
SVN1
22
2 1
2
1
2
11
22
2
VERSION CONTROL
SVN (SubVersioN) Install on Debian
Update e.g. >apt-get update Search e.g. >apt-cache search svn Install e.g. >apt-get install subversion
Uninstall e.g. >apt-get remove subversion
Parallel Processing Institute, Fudan University 9
VERSION CONTROL
SVN (SubVersioN) Client Command
checkoute.g. >svn co svn://10.132.143.1/truck truck --username=rong
update e.g. >svn update commit e.g. >svn ci a.c –message=“..” add file e.g. >svn add b.c
>svn ci b.c –message=“..” del file e.g. >svn del b.c
>svn ci b.c –message=“..”
Parallel Processing Institute, Fudan University 10
VERSION CONTROL
SVN (SubVersioN) Client Command
show status e.g. >svn status –q diff file e.g. >svn diff b.txt resolve conflict e.g. >vi a.c //manually remove conflict >svn resolved a.c
*svn resource link: http://subversion.tigris.org/ Parallel Processing Institute, Fudan University 11
Pre-requisiteSVNToolchain
C Language Compiling, Gcc Make
12
Why we choose C ? “ The limits of my language are the limits of my
world ” Tranctatus Logico-Philosophicus 5.6 1918
Our Requirements Realize Computer More Control Program Implement not Large but Practical Software Good Support in Multi-fields
Lisp
Script
Shell
Java
To C or Not to C
Parallel Processing Institute, Fudan University 13
Assembler
CBest Choice
HISTORY
Birth of C Language Thompson & Ritchie, 1969 ~ 1971 Based on B language
(BCPL, Basic Common Programming language) Rewrite Unix in C, 1973
ANSI (American National Standards Institute) C89 and C99
BOOK: The C Programming Language http://www.china-pub.com/computers/common/info.asp?id=14975Parallel Processing Institute, Fudan University 14
Pre-requisiteSVNToolchain
C Language Compiling, Gcc Make
15
GNU
What is GNU ? GNU is Not Unix, 1983
Richard M. Stallman (culture legend) Goal: absolutely FREE operating system The GNU Manifesto, 1985 Free Software Foundation (FSF)
Emacs, GCC, tar, … GPL, General Public License
Virus infectivity
Parallel Processing Institute, Fudan University 16
COMPILER
GNU Compiler Collection Preprocessor, Assembler, Linker,
Loader, … Support : C, C++, Java, Fortran, Ada,
…
Install on Debiane.g. >apt-get remove build-essential
Parallel Processing Institute, Fudan University 17
COMPILING
Parallel Processing Institute, Fudan University 18
Source Codes
[*.c, *.h]
C Program Preprocessor
Source Codes[*.c]
C ProgramCompiler
Assembly Codes[*.s]
AssemblerLinker/Loader
GNU Compiler Collection
E
co
S
Binary Codes[*.out]
Binary Codes[*.o]
COMPILING
C Files Compilation Example C Files: test.h test.c e.g.
>gcc -E test.c > test-pp.c (test-pp.c)>gcc -S test.c (test.s)>gcc -c test.c (test.o)>gcc -o test test.c (test)
Parallel Processing Institute, Fudan University 19
Pre-requisiteSVNToolchain
C Language Compiling, Gcc Make
20
MAKE
Make Automatically building executable
programs and libraries from source codeaccording to files called “Makefile”
GNU make
BOOK: ”Managing Projects with GNU Make”
http://www.china-pub.com/computers/common/info.asp?id=25525
Parallel Processing Institute, Fudan University 21
MAKEFILE
“Makefile” Specify how to derive the target
program from each of its dependencies
Context The relationship among source files The command used to compile source files
Tools for auto building Makefile makedepend, Imake, autoconf, automake
Parallel Processing Institute, Fudan University 22
Tips: disadvantage of make tab and whitespace are different
EXAMPLE
Parallel Processing Institute, Fudan University 23
>lsgen_log.c gen_sort.c>makegcc –Wall -I. -O3 gen_log.c -o gen_loggcc –Wall -I. -O3 gen_sort.c -o gen_sort>make cleanrm gen_log gen_sort>make gen_sortgcc –Wall -I. -O3 gen_sort.c -o gen_sort
CC := gccOPT := -O3CFLAGS := -Wall -I. $(OPT)
BINS := gen_log gen_sort
all: $(BINS)
%.o: %.c$(CC) -c -o $@ $^ $(CFLAGS)
clean:rm $(BINS) Makefile
Parallel Processing Institute, Fudan University 24
Thanks