02. Working on remote host
ssh username@185.6.174.98 -p2131 (Loongson server)
- get login/password from lecturer
- create empty git repo on github
git-clone repo-url
cd repo
- edit-compile-run:
mcedit prog.c
#include <stdio.h> int main(int argc, char *argv) { printf("Hello, %d\n", 100500); return 0; }
cc prog.c -o prog
./prog
- Using commandline
arrow keys (esp up key ) DEl/BS to edit
- Home/End keys
- maginc Tab key!
- Using PATH
echo $PATH
mkdir /home/username/bin (see this on $PATH)
cp prog /home/username/bin (or cc prog.c -o /home/username/bin/prog)
prog
- Delay slot
cc -O0 prog.c -S -o prog.s
cat prog.s, see nops after every jump
cc -O1 prog.c -S -o prog1.s
cat prog1.s, see
jr $31 addiu $sp,$sp,32
instead of
addiu $sp,$sp,32 jr $31 nop
- Get machine type. Performed both on localhost and on loongson server (in two windows)
uname -a
lscpu
free
- Unified performance: BogoMIPS
H/W
Connect to server from home!
If using windows, you may need SSH. It's better to install Git for windows and run linux-like console from "Git bash" menu
Compile an ru any program on server