computing refresher (day 1) - stanford universitytym1/refresher/materials/computing_slides.pdf ·...

61
Computing Refresher (Day 1) Tim Moon ICME Refreshers September 19, 2016

Upload: lylien

Post on 01-Jul-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ComputingRefresher(Day1)TimMoonICMERefreshersSeptember19,2016

Page 2: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Introduction

Page 3: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

AboutMe•  Third-yearICMEPhD•  Researchinterests:•  High-performancecompuFng•  Numericallinearalgebra

•  Coursewebsite:hJps://stanford.edu/~tym1/refreshers•  Personalwebsite:hJps://stanford.edu/~tym1•  Email:[email protected]

Page 4: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Goals•  AccessStanford’scompuFngresources•  NavigatewiththeUnixcommandline•  EdittextfileswithVim•  UseMATLABasacalculator

Page 5: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

AdditionalResources•  hJps://uit.stanford.edu/service/sharedcompuFng/loggingin(Stanford’stutorialtologintoFarmshare)

•  hJps://linuxjourney.com(verygoodonlinecourseonLinux)•  hJps://danielmiessler.com/study/vim/(tutorialtobecomeaVimguru)

•  hJp://tnerual.eriogerg.free.fr/vimqrc.pdf(Vimcheatsheet)•  hJp://vim-adventures.com(silly,Legend-of-Zelda-styleVimtutorial)

•  hJp://stanford.edu/class/cme192/(ICMEMATLABcourse)

Page 6: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

WhatisUnix?

Page 7: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

FarmShare•  SharedcomputersopentoStanfordstudents•  corn:generalpurpose•  rye:GPUs•  cardinal:long-term,low-intensityjobs•  barley:high-intensityjobs(usingjobmanager)

•  FilesstoredonAndrewFileSystem(AFS)•  ManagefilesathJps://afs.stanford.edu•  WebhosFngwithWWWdirectory

•  Availableso`ware:•  R,abinit,acml,allinea,ampl,amplgurobi,ansys,biopython,bowFe2,caffe,

celltool,cplex,cuda,cudasamples,cudnn,cufflinks,farmvnc,fiji,gams,gaussian,gurobi,hisat2,intel,java,lemon,lifelines,maple,mathemaFca,matlab,meep,meta,openfoam,parallel,pyroseJa,r,relion,roseJa,rstudio,sagemath,sas,seaborn,sentaurus,sicstus,spectra,sratoolkit,statamp,statase,staJransfer,terraform,tophat,torch,xmipp

Page 8: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

SSH•  “SecureShell”•  Standardmethodtologintoaremotecomputer•  GraphicaluserinterfacewithX11•  XWindowSystem,version11

Page 9: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

LoggingintoFarmShare•  Linux•  OpenTerminalandtype:

ssh -X <SUNetID>@corn.stanford.edu

•  Mac•  InstallXquartz(hJps://www.xquartz.org)•  OpenTerminal(ApplicaFons/UFliFes/Terminal)andtype:

ssh -X <SUNetID>@corn.stanford.edu

•  Windows•  InstallXming(hJps://sourceforge.net/projects/xming/)•  DownloadandopenPuTTY(hJp://www.puJy.org)

•  Set“HostName(orIPAddress)”to“corn.stanford.edu”(inSession)•  Select“EnableX11forwarding”(inConnecFon/SSH/X11)

•  UseyourSUNetIDasyourusernameandfollowthestepsfortwo-factorlogin

Page 10: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

CommandLineEssentials

Page 11: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

PracticeFiles•  Downloadfilesbytyping:

git clone https://github.com/timmoon10/icme_computing_refresher_2016

cd icme_computing_refresher_2016

Page 12: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

GettingStarted

•  AbortcommandsbypressingCtrl-c

Command Purposeecho <arg> Printargumentstodisplayexit Exitshell

Page 13: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Directories

•  RelaFvepathvs.absolutepath•  Pathshortcuts•  .(currentdirectory)•  ..(parentdirectory)•  ~(homedirectory)

Command Purpose UsefulOp2onsls <dir> Listcontentsindirectory -l,-apwd Printcurrentdirectorycd <dir> Changedirectorymkdir<dir> Makedirectoryrmdir<dir> Removedirectory

Page 14: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ReadingFilesCommand Purpose Useful

Op2onstouch <file> Createemptyfilecat <file> Printfilehead <file> Printfirstfewlines -n <lines>tail <file> Printlastfewlines -n <lines>less <file> Readfilein“less”

•  UseVimnavigaFoninless•  lessisbeJerthanmore

Page 15: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ManipulatingFilesCommand Purpose UsefulOp2onscp <old> <new> Copyfile -r,-imv <old> <new> Movefile -i

rm <file> Removefile -r,-f,-i

•  Becareful,Unixdoesnotforgive•  Wildcards•  *(anynumberofcharacters)•  ?(exactlyonecharacter)

Page 16: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Help

•  Manycommandscanalsoprintahelppage•  Put“-h”or“--help”asacommand-lineargument

•  Googleisyourfriend

Command Purposeman <command> Manualpage

Page 17: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

AdvancedUnixTopics

Page 18: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

UsefulCommandsCommand Purpose UsefulOp2onshistory Printpreviouscommandswc <file> Countwords -w,-l,-m,-csort <file> Sorttextlines -r,-n

Page 19: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

grep

•  Youcanusearegularexpression(regex)•  UsefulforsearchingthroughmulFplefiles

Command Purpose UsefulOp2onsgrep <string> <file> Searchforstringinfile -i,-r

Page 20: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

RedirectionandPiping•  RedirecFon(>)putsstandardoutputinfile•  Use >>toappendtofile•  ls > file_list.txt

•  Pipe(|)givesoutputtoanotherprogram•  Unixphilosophyusesmodularprograms•  ls | echo

Page 21: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ProjectTrees•  Commonstructure:•  README:helpfile•  Makefile:Makefileformake•  src:sourcefiledirectory•  doc:documentaFondirectory•  include:headerfiledirectory•  ext:directoryforexternalprojects•  bin:directoryforcompiledexecutables•  lib:directoryforcompiledlibraries•  build:directoryforintermediatebuildfiles

Page 22: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Make•  ManyprogramsrequirecompilaFonfromsourcecode•  MayalsorequireconfiguraFon,installingdependencies,andinstallaFon

•  Makeisacommontoolforbuildingprojects•  LooksatMakefileincurrentdirectory•  ManyprojectsuseCMake,whichgeneratesMakefiles

•  Usage:•  Changetoprojectdirectoryandtype“make”•  “make clean”iso`enusedtoresetdirectory•  MayrequireconfiguraFonwith“./configure”•  MayrequireinstallaFonwith“make install”

Page 23: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

VersionControl•  CollaboraFvecodingcanbeapain•  Simultaneouschanges•  Findingwhereabugwasadded•  Seeingwhowrotewhat

•  Commonprograms:Git,Subversion,Perforce,Mercurial•  HighlyrecommendmakingaGitHubaccount

Page 24: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

GitCommand Purposegit clone <repo> Downloadrepositorygit pull Updatefromremotegit status Getrepositorystatusgit add <file> Preparetoaddfilegit rm <file> Removefilegit commit –m “<message>” Commitlocallygit push Submitchangestoremote

Page 25: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

SimpleGitWorkQlow

Makechangestocode

git pull

git add <file>

git commit -m “<message>”

git push

Page 26: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Tarballs

•  “Tapearchive”•  Compressionwithgzip•  .tar.gzor.tgzfileextension•  TrydownloadinganddecompressinghJps://stanford.edu/~tym1/refresher/materials/example_tarball.tgz

Command Purposewget <url> Downloadfiletar –czvf <tarfile> <files> Compresstotarballtar -xzvf <tarfile> Decompresstarball

Page 27: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ComputingRefresher(Day2)TimMoonICMERefreshersSeptember20,2016

Page 28: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

LoggingintoFarmShare•  Linux•  OpenTerminalandtype:

ssh -X <SUNetID>@corn.stanford.edu

•  Mac•  InstallXquartz(hJps://www.xquartz.org)•  OpenTerminal(ApplicaFons/UFliFes/Terminal)andtype:

ssh -X <SUNetID>@corn.stanford.edu

•  Windows•  InstallXming(hJps://sourceforge.net/projects/xming/)•  DownloadandopenPuTTY(hJp://www.puJy.org)

•  Set“HostName(orIPAddress)”to“corn.stanford.edu”(inSession)•  Select“EnableX11forwarding”(inConnecFon/SSH/X11)

•  UseyourSUNetIDasyourusernameandfollowthestepsfortwo-factorlogin

Page 29: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

PracticeFiles•  TryupdaFngtherepo:•  cd icme_computing_refresher_2016•  git pull

•  Ifyougetanerror,deletetherepoanddownloadagain:•  cd ~•  rm –rf icme_computing_refresher_2016•  git clone https://github.com/timmoon10/icme_computing_refresher_2016

Page 30: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Vim

Page 31: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

WhatisVim?•  “ViIMproved”•  viisasimilar,oldertexteditor

•  Mostpopularcommand-linetexteditor•  FoundonalmostallUnixsystems

•  ModalediFng•  Powerful,butsteeplearningcurve

•  Veryusefultoprintoutacheatsheet:•  hJp://tnerual.eriogerg.free.fr/vimqrc.pdf

•  StartVimbytyping:vim <file>

Page 32: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

OtherTextEditors•  Emacs•  SublimeText•  nano•  Notepad++

Page 33: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Navigation

•  DefaultVimmodeisNormalMode•  Navigatewitharrowkeysorhjklkeys

Command PurposeEsc ReturntoNormalModeh Le`j Downk Upl Right

Page 34: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

InsertMode

•  Thisiswhereyouactuallytype•  ReturntonormalmodewithEsc

Command Purposei EnterInsertModebeforecursor(“insert”)a EnterInsertModea`ercursor(“append”)

Page 35: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

SavingandExitingCommand Purpose:w <file> Savetofile(“write”):e <file> Openanotherfile(“edit”):q Quit(requiresnochanges):wq Saveandquit:q! Quitwithoutsaving

Page 36: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

SearchingCommand Purpose/<string> Forwardsearchforstring?<string> Backwardsearchforstringn NextsearchresultN Previoussearchresult

Page 37: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

VisualModeCommand Purposev EnterVisualMode(character-based)V EnterVisualMode(line-based)y CopyselecFon(“yank”)x Cut/deleteselecFonp Pastea`ercursorP Pastebeforecursor

•  VisualModeisusedtoselectregionsoftext•  NavigationissameasNormalMode

Page 38: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

MoreUsefulCommandsCommand Purpose0 Gotobeginningofline$ Gotoendoflinegg GotobeginningoffileG Gotoendoffile:<number> Gotospecificlinedd Deletelineu Undo. Repeatlastcommandorredoundo

Page 39: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ScreenSplittingCommand PurposeCtrl-w s SplitwindowCtrl-w n CreateemptywindowCtrl-w j MovetonextwindowCtrl-w k MovetopreviouswindowCtrl-w o Closeallbutcurrentwindow

•  EachwindowislikeanindependentsessionofVim

Page 40: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

MATLAB

Page 41: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

WhatisMATLAB?•  “MatrixLaboratory”•  Proprietaryso`warebyMathWorks•  VerygoodforexperimentaFon•  High-levelprogramminglanguage•  FastmatrixoperaFons•  Feature-rich

•  StarFngMATLABonFarmShare:module load matlabmatlab

•  Towriteascript,putmulFplecommandsina.mfile•  Torunmy_script.m,typemy_scriptinMATLAB

Page 42: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Alternatives•  Octave•  Python(withNumPyandSciPy)•  Julia•  R

Page 43: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Variables•  a = 4•  b = -5.3•  third_variable = a * b•  d = sin(a) + 1.1•  a > b•  Comparisons:<,<=,>,>=,==,~=

•  Suppressoutputwithsemicolon:•  f = 3.1 – 4.3 * i;

•  Specialvalues:pi,i,Inf,NaN•  FuncFons:sin,cos,exp,sqrt,round,floor,ceil

Page 44: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Matrices•  A = [1 2 3; 4 5 6]•  MathemaFcalresult:

•  B = exp(A)•  A + B•  [1; 2; 3]•  [4 5 6]

A = 1 2 34 5 6

⎣⎢

⎦⎥

Page 45: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

MatrixOperations•  A = [1 2; 3 4]•  B = [5 6; 7 8]•  [A; B]•  [A B]•  A * B(matrixmulFplicaFon)•  A \ B(matrixinverse)•  Entry-wiseoperaFons:.*or./or.\or.^

Page 46: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

UsefulFunctions•  zeros(2,3)•  ones(2,3)•  eye(2,3)•  rand(2,3) (uniformdistribuFon)•  randn(2,3) (normaldistribuFon)•  1:4•  5:-2:1•  linspace(2,4,5)

Page 47: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Indexing•  A = [1 2 3 4; 5 6 7 8; 9 10 11 12]•  A(2,3)•  A(1:2,2:4)•  A(1:2,2)•  A(2,2:end)•  A(1:2,:)•  A(:)•  A(3:5)

Page 48: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Plotting•  x = linspace(1,10,50);•  y = sin(x) + 1.1;•  z = sin(2*x) + 1.1;•  plot(x,y)•  plot(x,z)•  hold on•  close

Page 49: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Help•  help<function>•  doc <function>•  Google

Page 50: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Scripting•  JustputmulFplecommandsinafile•  .mfileextension

•  Runbytypingfilename,excluding.m•  OpenMATLAB’sfileeditorwith“edit <funcFon>”•  Commentwith%•  Controlstatements:if,else,elseif,while,for•  Closeblockwithend

Page 51: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Exercise•  Let’ssolvetheheatequaFon:

•  ForanapproximatesoluFonatthenthFmestep:

•  IniFalizeuasarandomcolumnvectorandusec=0.25•  ComputeuforseveralFmesteps.Plota`ereveryFmestep(uselinspace(0,1,5)forx-dimension).Whatishappening?

∂u∂t−∇2u = 0

un ≈ un−1 + cAun−1

A =

1 −1−1 2 −1

−1 2 −1−1 2 −1

−1 1

⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥

Page 52: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ComputingPotpourri

Page 53: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

VirtualPrivateNetwork•  FarmSharerequiresuserstobeinStanfordnetwork•  VPNclientscreatesecureconnecFontoStanfordnetwork•  Veryusefulwhenoff-campus

•  SeeStanford’sVPNtutorial•  hJps://uit.stanford.edu/service/vpn

Page 54: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

LaTeX•  LaTeXisadocumentpreparaFonsystem•  LiJleeffortfornice-lookingdocuments

•  Verygoodformathandtechnicaldocuments•  MakeslideshowswithBeamer•  LaTeXmarkuplanguage•  .texfileextension

•  ForaWYSIWYGeditor,tryLyX(hJps://www.lyx.org)

Page 55: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

Jupyter•  VeryniceenvironmentforJulia,Python,andR•  Showsupinwebbrowser•  Workbooksareconvenientwaytosharecodesnippets•  SeeinstallaFoninstrucFons:•  hJp://jupyter.readthedocs.io/en/latest/install.html

Page 56: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

LinksCommand Purposeln -s <target><link> Createsymboliclinktotarget

•  Symboliclinkpointstoatargetpath•  Leavingoutthe“-s”opFoncreatesahardlink•  Besttoavoidsincehardlinksarenotassafe

Page 57: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

FilePermissions•  “ls -l”showsfilepermissions•  Filetype•  Ownerpermissions(read,write,execute)•  Grouppermissions(read,write,execute)•  Otheruserpermissions(read,write,execute)

•  Changefilepermissionswithchmod <number> <file>

•  Numberhasthreedigits:owner,group,andotherusers•  Eachdigit(inbinary)givesread,write,executepermissions•  Commonnumbersare500(fortext)and700(forexecutables)

Page 58: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

BashScripting•  “BourneAgainShell”•  Writescriptsbypusngcommandsasifincommand-line•  Commentwith#•  Setvariableswith=•  MY_VARIABLE=<value>

•  Referencevariableswith$•  echo $MY_VARIABLE

•  Runwithsourceorbysesngfilepermissionstoexecute•  Commontoput“#!/bin/bash”infirstline

Page 59: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

SuperUser

•  Defaultstosuperuser•  Alsoknownasroot,administrator,supervisor

•  Usermustbeinsudoerlisttousesudo•  Commonforinstallingpackagesandconfiguringsystem•  Requiresmodifyingsystemfiles

Command Purposesu <users> Switchusersudo <command> Runcommandasanotheruser

Page 60: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

StanfordComputingResources•  FarmShare:compuFngclusterforstudents,faculty,staff•  ICMEclusters•  icme-sharedmem•  icme-hadoop1•  icme-mpi1•  icme-gpu•  VirtualdesktopsforICMEstudents•  ContactBrianTempero([email protected])foraccess

•  Sherlock:high-performancecompuFngcluster•  Forresearch,requiressponsorshipfromfacultymember

•  JobmanagementwithSLURM

Page 61: computing Refresher (day 1) - Stanford Universitytym1/refresher/materials/computing_slides.pdf · • Navigate with the Unix command line ... (hp:// ) ... • Very useful to print

ICMEComputingClasses•  Fullcourses:•  CME211-compuFngbasicswithPythonandC++•  CME212-scienFficcompuFngwithC++•  CME213-parallelcompuFng(mostlyGPUs)•  CME214-Fortran•  CME323-distributedcompuFngwithSpark•  CME342-theoreFcalparallelcompuFng

•  Shortcourses:•  CME192-MATLAB•  CME193-Python•  CME195-R•  CME292-AdvancedMATLAB