Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

bashrc_for_gmt 7.5 KB

You have to be logged in to leave a comment. Sign In
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
  1. #
  2. # .bashrc include file for simplifying GMT building and testing
  3. # from the bash command line for debug compiler settings
  4. # (dbuild directory), a release build (rbuild directory),
  5. # and XCode debugging (xbuild directory).
  6. #
  7. # Include in your .bashrc via source <path>/bashrc_for_gmt
  8. #
  9. # Examples:
  10. # Type "bnd" to pull the latest main, configure with cmake, and build
  11. # with debug settings, or "bnx" for the Xcode setup
  12. # Type "crb" to run all tests with the release build
  13. # Type "gmtfind 'pattern'" to find all files where 'pattern' occurs
  14. # Type "dlog" to open the latest test log
  15. # Type "vgd" to open all the failed test PNGs for build
  16. #
  17. # You must set these parameter to reflect your setup
  18. builder=ninja # If ninja is not installed (please do), set to make
  19. Bname="Ninja" # If ninja is not installed (please do), set to "Unix Makefiles"
  20. pngview=open # Program that can open and display PNG files
  21. pdfview=open # Program that can open and display PDF files
  22. ncores=4 # Number of cores for running tests
  23. MATLAB=/Applications/MATLAB_R2019a.app # Path to the Matlab app
  24. REPO_DIR=<path to the local GMT repository>
  25. DATA_DIR=<path to directory containing GSHHG and DCW>
  26. EDITOR=subl # Program that can open and display text files
  27. #--------------------------------------------------------------
  28. # These are needed to run admin/build-gmt-release.sh
  29. export GMT_REPO_DIR=${REPO_DIR}
  30. export GMT_GSHHG_SOURCE=${DATA_DIR}/gshhg-gmt-2.3.7
  31. export GMT_DCW_SOURCE=${DATA_DIR}/dcw-gmt-2.0.0
  32. # To run matlab without the GUI:
  33. alias matlab='$MATLAB/bin/matlab -nojvm'
  34. # function for processing find output and return list of unique files.
  35. function unique {
  36. awk -F: '{print $1}' | sort -u
  37. }
  38. # List source, docs, scripts and txt files where the argument to gmtfind appears as is in the file
  39. # e.g, gmtfind "Grid increment is"
  40. function gmtfind {
  41. find . -name '*.[ch]' -exec egrep -H "$*" {} \; | unique ;
  42. find . -name '*.in]' -exec egrep -H "$*" {} \; | unique ;
  43. find . -name '*.txt]' -exec egrep -H "$*" {} \; | unique ;
  44. find . -name '*.rst*' -exec egrep -H "$*" {} \; | unique ;
  45. find . -name '*.sh' -exec egrep -H "$*" {} \; | unique ;
  46. find . -name '*.bat' -exec egrep -H "$*" {} \; | unique ;
  47. }
  48. # Various GMT building aliases
  49. # To run cmake for GMT for various setups
  50. alias cmakegmtd='cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Debug ..' # Configure cmake for debug
  51. alias cmakegmtr='cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Release ..' # Configure cmake for release
  52. alias cmakegmtx='cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Debug -G Xcode ..' # Configure cmake for Xcode debug
  53. # To change folders, open logs, build docs
  54. alias gmt6='cd ${REPO_DIR}/src' # Cd to the GMT source directory
  55. alias gtop='cd ${REPO_DIR}' # Cd to the top of the dev tree
  56. alias dlog='pushd .; gtop; ${EDITOR} dbuild/Testing/Temporary/LastTest.log; popd' # Open the dbuild check error log
  57. alias rlog='pushd .; gtop; ${EDITOR} rbuild/Testing/Temporary/LastTest.log; popd' # Open the rbuild check error log
  58. alias bdoc='pushd .; gmt6; cd ../dbuild; ${builder} -j${ncores} docs_html install; popd'
  59. # To pull changes, rebuild existing build directories
  60. alias buildd='pushd .; gtop; git pull; cd dbuild; ${builder} -j${ncores} install; popd' # Pull changes and rebuild existing dbuild
  61. alias buildr='pushd .; gtop; git pull; cd rbuild; ${builder} -j${ncores} install; popd' # Pull changes and rebuild existing rbuild
  62. # To pull changes, delete and remake build directories
  63. alias buildnewd='pushd .; gtop; git pull; rm -rf dbuild; mkdir dbuild; cd dbuild; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Debug -G ${Bname} ..; ${builder} -j${ncores} install; popd' # Pull changes; delete and recreate build directory (debug)
  64. alias buildnewr='pushd .; gtop; git pull; rm -rf rbuild; mkdir rbuild; cd rbuild; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Release -G ${Bname} ..; ${builder} -j${ncores} install; popd' # Pull changes; delete and recreate build directory (release)
  65. alias buildnewx='pushd .; gtop; git pull; rm -rf xbuild; mkdir xbuild; cd xbuild; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Debug -G Xcode ..; xcodebuild; popd' # Pull changes; delete and recreate build directory (XCode)
  66. # To rebuild without pulling remote changes
  67. alias builddnopull='pushd .; gtop; cd dbuild; ${builder} -j${ncores} install; popd' # Rebuild existing dbuild
  68. alias buildnewdnopull='pushd .; gtop; rm -rf dbuild; mkdir dbuild; cd dbuild; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Debug -G ${Bname} ..; ${builder} -j${ncores} install; popd' # Delete and recreate build directory (debug)
  69. alias buildnewxnopull='pushd .; gtop; rm -rf xbuild; mkdir xbuild; cd xbuild; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Debug -G Xcode ..; xcodebuild; popd' # Delete and recreate build directory (XCode)
  70. # To run tests
  71. alias checkdbuild='pushd .; gtop; cd dbuild; ${builder} -j${ncores} check; popd' # Run the tests for dbuild
  72. alias checkrbuild='pushd .; gtop; cd rbuild; ${builder} -j${ncores} check; popd' # Run the tests for rbuild
  73. # If gcc-mp is installed you can do OpenMP builds
  74. alias buildnewr-mp='pushd .; gtop; git pull; rm -rf rbuild-mp; mkdir rbuild-mp; cd rbuild-mp; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Release -G ${Bname} -C ~/cache.cmake ..; ${builder} -j${ncores} install; popd'
  75. alias buildnewd-mp='pushd .; gtop; git pull; rm -rf dbuild-mp; mkdir dbuild-mp; cd dbuild-mp; cmake -DCMAKE_INSTALL_PREFIX=gmt6 -DCMAKE_BUILD_TYPE=Release -G ${Bname} -C ~/cache.cmake ..; ${builder} -j${ncores} install; popd'
  76. # Shorter aliases for the build aliases
  77. alias bd=buildd # Pull changes and rebuild existing dbuild
  78. alias br=buildr # Pull changes and rebuild existing rbuild
  79. alias bnd=buildnewd # Pull changes; delete and recreate dbuild
  80. alias bnr=buildnewr # Pull changes; delete and recreate rbuild
  81. alias bnx=buildnewx # Pull changes; delete and recreate xbuild
  82. alias bnd-mp=buildnewd-mp # Pull changes; delete and rebuild dbuild with OpenMP
  83. alias bnr-mp=buildnewr-mp # Pull changes; delete and rebuild rbuild with OpenMP
  84. alias cdb=checkdbuild # Run the tests for dbuild
  85. alias crb=checkrbuild # Run the tests for rbuild
  86. alias bmdc='buildnewd; checkdbuild' # build new master debug and run all tests
  87. alias bdnp=builddnopull # Rebuild existing dbuild
  88. alias bndnp=buildnewdnopull # delete and recreate dbuild
  89. alias bnxnp=buildnewxnopull # delete and recreate xbuild
  90. # See test results
  91. alias vpngdbuild='pushd .; gtop; cd dbuild; $pngview */*/*/*.png; $pngview */*/*/*/*.png; popd'
  92. alias vpdfdbuild='pushd .; gtop; cd dbuild; $pdfview */*/*/*.pdf; $pdfview */*/*/*/*.pdf; popd'
  93. alias vpngrbuild='pushd .; gtop; cd rbuild; $pngview */*/*/*.png; $pngview */*/*/*/*.png; popd'
  94. alias vpdfrbuild='pushd .; gtop; cd rbuild; $pdfview */*/*/*.pdf; $pdfview */*/*/*/*.pdf; popd'
  95. # Very short shortnamds for seeing test results
  96. alias vgd=vpngdbuild
  97. alias vpd=vpdfdbuild
  98. alias vgr=vpngrbuild
  99. alias vpr=vpdfrbuild
  100. # View large sets of failures one at the time with gap in time between launch:
  101. # View all release PNG failures one at the time with given sleep gap [3s]
  102. function view_png_failures_r {
  103. if [ "X$1" == "X" ]; then
  104. w=3
  105. else
  106. w=$1
  107. fi
  108. pushd .; gtop; cd rbuild;
  109. ls */*/*/*.png */*/*/*/*.png > /tmp/vpf
  110. while read png; do
  111. $pngview $png
  112. sleep $w
  113. done < /tmp/vpf
  114. rm -f /tmp/vpf
  115. popd
  116. }
  117. # View all release PDF failures one at the time with given sleep gap [3s]
  118. function view_pdf_failures_r {
  119. if [ "X$1" == "X" ]; then
  120. w=3
  121. else
  122. w=$1
  123. fi
  124. pushd .; gtop; cd rbuild;
  125. ls */*/*/*.pdf */*/*/*/*.pdf > /tmp/vpf
  126. while read pdf; do
  127. $pdfview $pdf
  128. sleep $w
  129. done < /tmp/vpf
  130. rm -f /tmp/vpf
  131. popd
  132. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...