-
Notifications
You must be signed in to change notification settings - Fork 3
/
Linux_tip.txt
384 lines (304 loc) · 9.55 KB
/
Linux_tip.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# mic0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/mic:~/mic/lib
export PATH=$PATH:~/mic/bin
# VNC server setting
vncserver -geometry 1425x865
vncserver -geometry 1920x1200
New desktop is ws.server.com:29
## copy the frontend name:number
# at interactive queue session
# 1. vncserver -geometry 1425x865
# 2. then run vnc enterprise from windows
# how to kill vnc
$ vncserver -kill :37
display# can be found at ~/.vnc/
#
#
## intel vtune
# compile with -g -debug
module load DE/intel_openmpi/13.0
source /usr/nic/DE/intel/13.0/vtune_amplifier_xe_2013/amplxe-vars.sh
#amplxe-gui
# to debug division by zero, use -fpe0 for fflags at ifort
# gprof
# compile and link with -pg (-p for ifort)
# a.out -> gmon.out comes
# gprof ./a.out > out.txt
#
#
#gdb with pipe
# gdb a.out
# /run < pipe_name
#
# to setup break point,
# b main.f90:122
# loading core file
gdb a.out core.dump
> bt full
> frame #
> list
> info locals
> up #
> down #
#
# # abaqus cae/viewer on interactive queue
abaqus cae -mesa
abaqus viewer -mesa
# abaqus plugin
Just copy directory to /usr/nic/apps/abaqus/6.14-5/code/python2.7/lib/abaqus_plugins/
# matlab gui on interactive queue
# make java.opts and add line: -Dsun.java2d.pmoffscreen=false
MATLAB stand alone
>> mcrinstaller shows the location of zip file. Unzip and run install. Then
./main_function_jeonb/for_testing/run_main_function_jeonb.sh ~/sw_local/MATLAB_Runtime/v85
# This might not be required: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/jeonb/sw_local/MATLAB_Runtime/v85/runtime/glnxa64:/home/jeonb/sw_local/MATLAB_Runtime/v85/bin/glnxa64:/home/jeonb/sw_local/MATLAB_Runtime/v85/sys/os/glnxa64
#
#
# gdb with mpi
# mpirun -n 2 xterm -e gdb ./pericorn_mpi < input.txt
#
#### OpenMP
#in a coupled loop calculations,
# schedule(guided,20) yields 3% faster than schedule(static)
# xmgrace install
./configure --prefix=/home/jeonb/sw_local CC=icc FC=ifort
294 make
296 make all
297 make install
# xmgr symbol
# \cE\C for angstrom
# \x\c1 for plusminus
# \x\c4 for cross product Strain energy(\x\c4\C\010\S-3\NJ)
# \cW\C for cross product
### intel phi
module load DE/intel_openmpi/13.0
source /usr/nic/DE/intel/13.0/bin/compilervars.sh intel64
/usr/bin/micsmc for monitoring
module load DE/intel_openmpi/14.1
source /usr/nic/DE/intel/14.1/composerxe/bin/compilervars.sh intel64
export LD_LIBRARY_PATH=/home/jeonb/TEMP/intel/mic_lib:/home/jeonb/TEMP/intel/mkl_mic
### spooles library install
#1. SPOOLES.2.2/Tree/src/makeGlobalLib , drawTree.c -> draw.c
#2. make lib
# making animated gif using jmol
write frames {*} "all.jpg"
# convert -delay 50 -loop 0 all*.jpg animated.gif
#
# jmol color change
# in script, color hydrogen blue, set background white
# convert all images to different format
# mogrify -format png *.bmp
mogrify -resize 50% -path . -format png /work/jeonb/*.bmp
# ansys
# runwb2 for workbench
# launcher140 for struct
# ansys150 -g yes
#
#
# gnuplot
# range of data file
# splot '<head -2083 out_.dat' u 1:2:4
# data operation
# splot "tmp.dat" u 1:2:($8*cos($6*3.14/90.))
gnuplot> plot "snap0000200.xyz" u 2:3:5 pal pt 5
gnuplot> plot "snap0000200.xyz" u 2:3:5 pal ps 10
# dump function data into txt
> set table "sin.dat"
> plot sin(x)
> unset table
# plotting csv file
set datafile separator ","
#
# allinea ddt
> ddt -start -n 2 ./a.out
# change words in many files
# sed -i 's/old_world/new_word/g' *.f90
# topology of cpu id
# lstopo
# fortran loop
# do i=1,n
# do j=1,m
# a(i,j) = f(i,j)
# end do
# end do
#
# change into
# do j=1,m
# do i=1,n
# a(i,j) = f(i,j)
# end do
# end do
# memory leak check using valgrind for mpi
mpirun -n 2 valgrind --error-limit=no -q ./a.out
#fort openmp
# valgrind --tool=drd --error-limit=no a.out
# emacs change font size
shift + mouse button 1, then menu pops up
# to change line break into ","
# edit -> replace Regexp -> ctrl-q ctrl-j enter ","
# vi change words
# :%s/aaa/bbg/g
#
# cut by column
# awk '{print $1 " " $2 " " $3}' aaa.dat > new.dat
#
# add words in the first column
# awk '{print "/work/jeonb/IMAGE/"$0}' train_map.txt > tmp.txt
#
#
# NaN at fortran
use ieee_arithmetic
if (ieee_is_nan(heatfs(i))) stop
# utility
facter uptime, facter operatingsystem, htop, bmon, cat /proc/pid/cmdline, nfsiostat 5 /home
# exclusive grep
grep aaa input.dat |grep -v bbb
# combinatio of sed and awk
# sed -i 's/_MIN/'"$(awk '{print $2}' min.dat)"'/g' syy.py
#
# sum of column data
cat aaa.dat |awk '{sum+=$4} END {print sum}'
# sample every 1000 line
awk 'NR%1000==1' aaa.inp
# average
grep wall log* | awk -F ' ' '{sum+=$5} END {print "AVG=",sum/NR}'
# print hostname in mpi
INTEGER(GN):: ierr, iprov, resultlen
CHARACTER*(MPI_MAX_PROCESSOR_NAME):: name
call MPI_INIT_THREAD(MPI_THREAD_FUNNELED, iprov, ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, mpivar%gid, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, mpivar%Nproc, ierr)
call MPI_GET_PROCESSOR_NAME(name, resultlen, ierr)
print *, mpivar%gid, name
# ffmpeg
$ ffmpeg -r 5 -b 1800 -i tail%04d.jpg test.mp4
$ ffmpeg -i test.mp4 -vcodec msmpeg4v2 -acodec pcm_s16le output.avi
$ ffplay test.mp4
ffmpeg -r 3 -b 1800 -i f%04d.jpg f_toughened.avi
ffmpeg -r 3 -b 1800 -i tail_parab%04d.jpg -vcodec msmpeg4v3 aaa.avi
# check installed sw
#repoquery --list tkinter
# using file content as command line argument
# cp "$(< pwd.txt)"/tmp.out aaa.out
# pbs node check
# pbsnodes -l
# qstat -s => verbose qstat
# qstat -n1 => shows which nodes are used
# qstat -n1 -t => shows which nodes are used including job array
# qdel -W force id => brute force delete
# qalter xxxx -l walltime=10:00:00 -> change wall time
# gitlab command
# git add *.f90; git commit -m "comment on this "; git push
# when download: git clone git@gitservercom:someone/someproject.git
# To download; git init; git clone remote git@.... ; git fetch; git checkout -b branch_name
# git add *.R ; git commit -m "message"; git push origin HEAD:branch_name
# Enforce
git fetch --all
git reset --hard origin/master
git add Makefile dynamics.f90
git commit -m "call setPDparms by the allocation status of PDnov"
git push origin HEAD:by_jeonb
# kill processes of range
# kill -9 `ps -ef |grep keyword1 |grep keyword2 |grep -v grep |awk '{print $2}'`
# trace application
# strace -rtv a.out
#
#
# system monitoring tool
# $ vmstat 10 10 ; for virtual memory
# ibstat ; for infiniband
# ibdev2netdev
# pbsnodes -l
# smem -u (shows who uses mem/swap, sudo is recommended)
# java memory test - 1GB stack test - http://stackoverflow.com/questions/11597563/how-to-set-jvm-to-have-more-1gb-stack-size
java -Xss2g -Xmx100g Test
# hybrid in openmpi
#
# $ export OMP_NUM_THREADS=2
# $mpirun -n 6 --bind-to socket ../../PDama_MPI
#
# or
#
# $ export OMP_NUM_THREADS=2
# $mpirun -n 6 --map-by socket:pe=2 ../../PDama_MPI (not recommneded)
#
# in ava 2017
# mpirun --map-by socket:pe=NOMP ./PDama_MPI
# Actual MPI ranks = N. cpus per socket/NOMP
# To find realname from username
# getent passwd
#
#
# License server
# ssh cvcv5fl21
# /usr/local/apps/comsol/license/glnxa64
# get walltime consumed
/usr/bin/time -p colt aaa.py
# Module swap
# module swap pbs pbs_apollo
#
# xauth issue in sudo
$ xauth list $DISPLAY
$ some.server.org:17 MIT-MAGIC-COOKIE-1 aabc92c96519f29....
$ sudo su -
{152}#xauth add some.server.org:17 MIT-MAGIC-COOKIE-1 aabc92c96519f29....
# when pbs job submission fails
qstat -f -x jobid
tracejob -n 5 jobid (PBS id)
tail -1000 /var/spool/PBS/mom_logs/20160505
# col/lines in the terminal
$ tput cols $ tput lines
# current vnc resolution
$ xrandr --current
# when DCVD is not running
# $ dcv on
# Lustre stripe control
# $ lfs getstripe ./aaa.h5 # check the stripe size and count of the file
# $ lfs setstripe -s 4m -c 8 . # set the current path as 4M stripe size and 8 stripe count
# Linux check directory size
du -h --max-depth=1
# bash looop
for i in `seq 1 32` ; do echo 'hello' >> lists; done
# json parsor
jq '.' aaa.json # print all
jq 'keys' aaa.json # print keys
jq '.id' aaa.json # print value of key = id
jq '.[] | .stuff["info-spec"]' xample.json # when xample.json is surrounded by []
jq '.[].stuff["info-spec"]' xample.json # when xample.json is surrounded by []
jq '.id' aaa.json # when aaa.json is surrounded by {}
jq '.data.dr[][]|select(.tag |contains("SEQ_STATE"))' N612-H6D4.json # nested json
## redirection of time result
(time python3 keras_mnist.py) |& tee 1gpu.log
# how to check centos version
cat /etc/centos-release
hostnamectl
# move files by their numbers in filename
mv ../../train/dog/dog.{10000..12500}.jpg .
# rename files with numbers
find . -name '*.gif' | gawk 'BEGIN{ a=1 }{ printf "mv \"%s\" t%04d.gif\n", $0, a++ }' | bash
# delete *.o files only
find . -type f -name '*.o' -exec rm {} +
# when wget doesn't work well, use quote mark around http address
# count number of files per minute
find . -maxdepth 1 -printf '%CY%Cm%Cd.%CH%CM\n' |sort |uniq -c
# change folder access as 755
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
#To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
## find installed packages
rpm -qa |grep emacs # find emacs packages
rpm -ql emacs-filesystem-24.3-19.el7_3.noarch # find the location
# when the window in gnome is larger than screen
1) click the window
2) alt+F7
3) move the mouse then the window will be resized.
# finding the list of symbols from library or object file
nm abc.so |grep _ZNSt6vectorIiSaIiEEC1Ev
- If U is found, only called.
- If T is fouind, it is defined.
# demangle symbols
c++filt _ZNSt6vectorIiSaIiEEC1Ev
# dump ostream from buffer when application crashes
- when cout or ostream buffered texts are not shown when crashed
- stdbuf -o0 ./a.out
- -o0 means no buffer, printing immediately