240 likes | 367 Views
Institute of Parallel and Distributed System (iPads) Shanghai Jiao Tong University Rong Chen rongchen @ sjtu.edu.cn. T UTORIAL L ESSON Tools. OUTLINE. Pre-requisite SVN Toolchain. Pre-requisite SVN Toolchain. VERSION CONTROL. APT ( A dvanced P ackage T ools)
E N D
Institute of Parallel and Distributed System (iPads) Shanghai Jiao Tong University Rong Chen rongchen@sjtu.edu.cn TUTORIAL LESSONTools
OUTLINE Pre-requisite SVN Toolchain Parallel Processing Institute, Fudan University
Pre-requisite SVN Toolchain Parallel Processing Institute, Fudan University
VERSION CONTROL • APT(Advanced Package Tools) • A management system for software packages • Package resource list for APT: • /etc/apt/sources.list $ 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 • showpkge.g. >apt-cache showpkghtop Institute 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 $ 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-requisite SVN Toolchain Parallel Processing Institute, Fudan University
VERSION CONTROL • SVN(SubVersioN) • Maintain current and historical versions of files SVN SVN SVN 1 1 2 2 1 1 1 1 1 2 2 2 2 2 2 Parallel Processing Institute, Fudan University
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
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
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
Pre-requisite SVN Toolchain • C Language Compiling, Gcc Make
To C or Not to C • Why we choose C ? “ The limits of my language are the limits of my world ”Tranctatus Logico-Philosophicus5.6 1918 • Our Requirements • Realize Computer • More Control Program • Implement not Large but Practical Software • Good Support in Multi-fields Best Choice Java Script Lisp Assembler C Shell Parallel Processing Institute, Fudan University
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=14975 Parallel Processing Institute, Fudan University
Pre-requisite SVN Toolchain C Language • Compiling, Gcc Make
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
COMPILER • GNU Compiler Collection • Preprocessor, Assembler, Linker, Loader, … • Support : C, C++, Java, Fortran, Ada, … • Install on Debian e.g. >apt-get remove build-essential Parallel Processing Institute, Fudan University
COMPILING Source Codes[*.c] C Program Preprocessor C ProgramCompiler Source Codes[*.c, *.h] E S Assembly Codes[*.s] GNU Compiler Collection Binary Codes[*.out] c o Binary Codes[*.o] Linker/Loader Assembler Parallel Processing Institute, Fudan University
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
Pre-requisite SVN Toolchain C Language Compiling, Gcc • Make
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
Tips: disadvantage of make • tab and whitespace are different 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
CC := gcc OPT := -O3 CFLAGS := -Wall -I. $(OPT) BINS := gen_log gen_sort all: $(BINS) %.o: %.c $(CC) -c -o $@ $^ $(CFLAGS) clean: rm $(BINS) Makefile EXAMPLE >ls gen_log.c gen_sort.c >make gcc –Wall -I. -O3 gen_log.c -o gen_log gcc –Wall -I. -O3 gen_sort.c -o gen_sort >make clean rm gen_log gen_sort >make gen_sort • gcc –Wall -I. -O3 gen_sort.c -o gen_sort Parallel Processing Institute, Fudan University
Thanks Parallel Processing Institute, Fudan University