-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc_common
207 lines (168 loc) · 7.16 KB
/
bashrc_common
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
#!/bin/bash
# This set of commands gets called by all big environments
# Structure reintroduced: 05/06/2022
#
# state what's going on
echo $bufferstring
echo "Executing $envdir/bashrc_common"
# start by clearing all aliases
#unalias -a
# Make prompt show current working directory
# But only if bashrc_common hasn't been sourced already
if ! [ sourced_common_already ]; then
PS1='\w$ '
fi
# Extra appendages to PATH to allow
# programs to be installed locally
export PATH=$PATH:$HOME/bin
export PATH=$PATH:$HOME/usr/bin
#####################
#DIRECTORY STRUCTURES
#####################
# Python startup file
export PYTHONSTARTUP=$HOME/environment/python_startup.py
# Note: on Pleaides, there is also /etc/pythonstart, should I worry about this?
# Main folders
export doc=$HOME/Documents
export down=$HOME/Downloads
export desk=$HOME/Desktop
# universal Desktop subdirs (mostly on Mac)
export notes=$desk/Research_Notes
export pubrev=$desk/Publication_Review
export thesis=$desk/Thesis
export pres=$desk/Presentations
export cv=$desk/CV
export papers=$desk/Paper_Library
export pub=$desk/Publications
export tachletter=$pub/Tacho_Letter
export tachletterplots=$pub/Tacho_Letter_Plots_Part2
export tachapj=$pub/Tacho_ApJ
export tachapjplots=$pub/Tacho_ApJ_Plots
export prop=$desk/Proposals
export solartw=$desk/Solar_Thermal_Wind
export proprsr=$doc/Proposal_to_Recruit_Support_Retain_UrMs_APS
export fin=$doc/Financial
# Rayleigh environent
export ra=$HOME/rayleigh
export racode=$ra/code
export rapp=$racode/post_processing
export raRyan=$HOME/rayleigh_Ryan
export racodeRyan=$raRyan/code
export rappRyan=$racodeRyan/post_processing
export rau=$ra/utils
export raco=$rau/compute # /usr/bin/co is a command
export rapl=$rau/plot # /usr/bin/plot is a command
export raleg=$rau/zz_legacy # /usr/bin/plot is a command
export idref=$raco/hydro_ideal_reference_state
# Pleiades directory shortcuts
# Rayleigh simulation root directories on Pleiades
export nb=/nobackup/lmatilsk
export nbnick=/nobackup/nfeather
export tach=$nb/00_Tacho_Letter
export boulder=$nb/00_Boulder_Survey
export check=$nb/00_Rayleigh_Checkpoints
export postdoc=$nb/00_Summer_Postdoc
export casem=$tach/case_M
export caseh=$tach/case_H
# LCD hard-disk shortcuts
export alt=/altair/loma3853
export pol=/pollux/loma3853
export cast=/castor/loma3853 #/usr/bin/cas is a program on Freyr
export sarg=/sargas/loma3853 # /usr/sbin/sargas is a program on Freyr
export miz=/mizar/loma3853
export postdoclcd=$alt/00_Summer_Postdoc-fresh
# LCD ssh shortcuts
export hyp=hyperion
export fre=freyr
export bac=bacchus
export tel=tellus
export hyd=hydra
export hyd2=hydra2
export scy=scylla
# other command aliases
alias fn='find `pwd` -name ' # fn for "full name"
alias gt='gnome-terminal'
# Get disk usage
get_du() {
du -hsc * >> $(date +%F)_du
}
get_du_app() {
du -hsc --apparent-size * >> $(date +%F)_du_app
}
# Source global definitions
if [ -f /etc/bashrc ]; then
echo $bufferstring
echo "Executing /etc/bashrc"
. /etc/bashrc
fi
# always ssh with display privileges
alias ssh='ssh -X'
alias less='less -MN' # make less show line numbers and filename in status bar
# sym links
alias linkra='ln -s $racode/bin/rayleigh.opt'
alias linkdbg='ln -s $racode/bin/rayleigh.dbg'
alias linkmain='rm rayleigh.*; ln -s $racode/bin/main/rayleigh.* .'
alias linkmods='rm rayleigh.*; ln -s $racode/bin/allmods/rayleigh.* .'
alias linkcustom='rm rayleigh.*; ln -s $racode/bin/custom/rayleigh.* .'
alias linkperfcond='rm rayleigh.*; ln -s $racode/bin/perfcond/rayleigh.* .'
alias linkmulti='rm rayleigh.*; ln -s $racode/bin/multi/rayleigh.* .'
alias linkrome='rm rayleigh.*; ln -s /home4/nfeather/software/Rayleigh-Rome-2.28/bin/* .'
alias linknobinrz='rm rayleigh.*; ln -s $racode/bin/noBinRZ/rayleigh.* .'
alias linktraceback='rm rayleigh.*; ln -s $racode/bin/traceback/rayleigh.* .'
# post processing
alias runra='mpiexec -np 16 ./rayleigh.opt -nprow 4 -npcol 4'
alias runra1="./rayleigh.opt -nprow 1 -npcol 1"
# Configure rayleigh with .muck extension
alias configmuck='EXT=".muck" ./configure'
# Tar up some sample output (G_Avgs, Shell_Avgs, AZ_Avgs,
# Equatorial_Slices, Meridional_Slices, Shell_Slices, Shell_Spectra)
# as well as main_input, reference, transport, and grid_info for
# a given Rayleigh run directory
alias make_sample='tar -cvfh datasample.tar $(find AZ_Avgs/ | sort | tail -n 3) $(find Equatorial_Slices/ | sort | tail -n 3) $(find G_Avgs/ | sort | tail -n 3) $(find Meridional_Slices/ | sort | tail -n 3) $(find Shell_Avgs/ | sort | tail -n 3) $(find Shell_Slices/ | sort | tail -n 3) $(find Shell_Spectra/ | sort | tail -n 3) main_input equation_coefficients grid_info jobinfo.txt'
alias make_sample_data='tar -cvf datasample.tar $(find AZ_Avgs/ | sort | tail -n 3) $(find Equatorial_Slices/ | sort | tail -n 3) $(find G_Avgs/ | sort | tail -n 3) $(find Meridional_Slices/ | sort | tail -n 3) $(find Shell_Avgs/ | sort | tail -n 3) $(find Shell_Slices/ | sort | tail -n 3) $(find Shell_Spectra/ | sort | tail -n 3) main_input equation_coefficients grid_info jobinfo.txt data/'
alias make_sample_data_and_plots='tar -cvfh datasample.tar $(find AZ_Avgs/ | sort | tail -n 3) $(find Equatorial_Slices/ | sort | tail -n 3) $(find G_Avgs/ | sort | tail -n 3) $(find Meridional_Slices/ | sort | tail -n 3) $(find Shell_Avgs/ | sort | tail -n 3) $(find Shell_Slices/ | sort | tail -n 3) $(find Shell_Spectra/ | sort | tail -n 3) main_input equation_coefficients grid_info jobinfo.txt data/ plots/'
# Rayleigh routines
# parallel
# set default nproc based on hostname
host=`hostname`
#if [[ "$host" == *"$ldanst"* ]] || [[ "$host" == *"$nodest"* ]]; then
if [[ "$host" == "lfe"* ]] || [[ "$host" == "pfe"* ]]; then
nproc=1 # process in serial on the lfes and pfes
elif [[ "$host" == "lorensMac"* ]] || [[ "$host" == "cu-genvpn"* ]] || [[ "$host" == *"eduroam"* ]]; then
nproc=2
else
nproc=`nproc --all` # by default, use max number of processes
fi
# ppc for "python parallel call"
#export ppc="mpiexec -n $nproc --oversubscribe python -u"
export ppc="mpiexec -n $nproc python -u"
source $HOME/environment/bashrc_ra_routines
setnproc() {
nproc=$1
#export ppc="mpiexec -n $nproc --oversubscribe python -u"
export ppc="mpiexec -n $nproc python -u"
source $HOME/environment/bashrc_ra_routines
}
# count lines in a directory
# usage: countlines directory/ \*.[extension]
# NOTE: must include "\" before "*" so the wildcard doesn't get expanded
# when passed to the function ("\*" passes the asterisk verbatim in $2)
# Example:
# countlines compute/ \*py [note final slash is irrelevant; could use "compute"]
countlines() {
find $1 -name "$2" -type f | xargs wc -l
}
countfiles() {
find $1 -type f | wc -l
}
# sequentialize images in directory
alias sequence="python $raco/sequentialize_images.py"
# ffmpeg shortcut for making movies form img????.png files
alias ffm="ffmpeg3 -framerate 30 -i img%04d.png -qscale 5 movie.mp4"
# BASH SHORTCUTS
alias rmsslice="bash $rau/bash/rm_sslice.sh"
alias rmtexaux="rm *aux *bbl *blg *log *out *synctex.gz"
alias mvbashrc="mv ~/.bashrc ~/.bashrc-bak; mv ~/.bash_profile ~/.bash_profile-bak"
alias mvbashrcbak="mv ~/.bashrc-bak ~/.bashrc; mv ~/.bash_profile-bak ~/.bash_profile"
# say now we've sourced common
sourced_common_already=1