tag:blogger.com,1999:blog-77538724940318780662024-03-08T05:15:49.908-07:00Scientific Computing AnswersKelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-7753872494031878066.post-26690085158726927382013-11-21T17:12:00.001-07:002013-11-21T17:12:31.920-07:00Test<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-gutQQJ1hBKs/Uo6ZcUKuKcI/AAAAAAAAEUI/QsV31Rysg1s/s1600/DSC_2001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://2.bp.blogspot.com/-gutQQJ1hBKs/Uo6ZcUKuKcI/AAAAAAAAEUI/QsV31Rysg1s/s320/DSC_2001.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-1DGo7ibZ88Q/Uo6ZfT6NhUI/AAAAAAAAEUY/RJExIPONRlo/s1600/DSC_2002.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-1DGo7ibZ88Q/Uo6ZfT6NhUI/AAAAAAAAEUY/RJExIPONRlo/s320/DSC_2002.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-6Jg-dsf9Ia8/Uo6Zeta3ZgI/AAAAAAAAEUU/wfSx3UwS3Wg/s1600/DSC_2003.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-6Jg-dsf9Ia8/Uo6Zeta3ZgI/AAAAAAAAEUU/wfSx3UwS3Wg/s320/DSC_2003.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-0xQpELDUXeE/Uo6ZieIiz7I/AAAAAAAAEUo/sB3clh4Voqc/s1600/DSC_2004.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-0xQpELDUXeE/Uo6ZieIiz7I/AAAAAAAAEUo/sB3clh4Voqc/s320/DSC_2004.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-WpUy5pgzHjU/Uo6ZiLFOkxI/AAAAAAAAEUk/Bo5is-Eml0M/s1600/DSC_2005.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-WpUy5pgzHjU/Uo6ZiLFOkxI/AAAAAAAAEUk/Bo5is-Eml0M/s320/DSC_2005.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-MUsa19bx3wQ/Uo6ZuwRL6-I/AAAAAAAAEVU/rkSWk5xTc1g/s1600/DSC_2010.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-MUsa19bx3wQ/Uo6ZuwRL6-I/AAAAAAAAEVU/rkSWk5xTc1g/s320/DSC_2010.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-tTVUPwHlAoo/Uo6Zupu4_nI/AAAAAAAAEVM/K6WkHRwPdbA/s1600/DSC_2009.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-tTVUPwHlAoo/Uo6Zupu4_nI/AAAAAAAAEVM/K6WkHRwPdbA/s320/DSC_2009.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-kztQBmETqu4/Uo6ZomCgM2I/AAAAAAAAEU8/rS5rnBhrCp0/s1600/DSC_2008.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-kztQBmETqu4/Uo6ZomCgM2I/AAAAAAAAEU8/rS5rnBhrCp0/s320/DSC_2008.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-XZ0euKRKDsI/Uo6ZpayxtJI/AAAAAAAAEVA/RsDZiFFnET8/s1600/DSC_2007.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-XZ0euKRKDsI/Uo6ZpayxtJI/AAAAAAAAEVA/RsDZiFFnET8/s320/DSC_2007.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-eWqA9d2RZ6U/Uo6ZodM1_vI/AAAAAAAAEU4/IFvstLS8tto/s1600/DSC_2006.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://2.bp.blogspot.com/-eWqA9d2RZ6U/Uo6ZodM1_vI/AAAAAAAAEU4/IFvstLS8tto/s320/DSC_2006.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-8m-Sex9z2lg/Uo6ZvcSA_cI/AAAAAAAAEVY/aOP6LhrTp7M/s1600/DSC_2011.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-8m-Sex9z2lg/Uo6ZvcSA_cI/AAAAAAAAEVY/aOP6LhrTp7M/s320/DSC_2011.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-nc_-6CY-SKk/Uo6Z0MDAL0I/AAAAAAAAEVo/KxjZjVf2frs/s1600/DSC_2012.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://2.bp.blogspot.com/-nc_-6CY-SKk/Uo6Z0MDAL0I/AAAAAAAAEVo/KxjZjVf2frs/s320/DSC_2012.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-IvhAiQ2stXU/Uo6Z6PNXGaI/AAAAAAAAEV8/-dK6NxUV-oU/s1600/DSC_2015.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://4.bp.blogspot.com/-IvhAiQ2stXU/Uo6Z6PNXGaI/AAAAAAAAEV8/-dK6NxUV-oU/s320/DSC_2015.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-fErpCVrlMqE/Uo6Z9mf8K-I/AAAAAAAAEWI/04mSGZuwWik/s1600/DSC_2016.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-fErpCVrlMqE/Uo6Z9mf8K-I/AAAAAAAAEWI/04mSGZuwWik/s320/DSC_2016.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-EcSmaKdViwU/Uo6Z6jbmYrI/AAAAAAAAEWA/FpSpaio1dwQ/s1600/DSC_2017.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://3.bp.blogspot.com/-EcSmaKdViwU/Uo6Z6jbmYrI/AAAAAAAAEWA/FpSpaio1dwQ/s320/DSC_2017.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-fzX-vGhmOG0/Uo6aGRJjAYI/AAAAAAAAEWw/TDowFJUFToI/s1600/DSC_2022.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://3.bp.blogspot.com/-fzX-vGhmOG0/Uo6aGRJjAYI/AAAAAAAAEWw/TDowFJUFToI/s320/DSC_2022.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-QyqehrpQwOM/Uo6aDTsj7wI/AAAAAAAAEWk/JoNYz-V1tuE/s1600/DSC_2021.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-QyqehrpQwOM/Uo6aDTsj7wI/AAAAAAAAEWk/JoNYz-V1tuE/s320/DSC_2021.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-0uBc-o4_eCc/Uo6aD9FOFCI/AAAAAAAAEWo/GODkVrh-VD4/s1600/DSC_2020.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://2.bp.blogspot.com/-0uBc-o4_eCc/Uo6aD9FOFCI/AAAAAAAAEWo/GODkVrh-VD4/s320/DSC_2020.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-E80xHQehusM/Uo6Z_EvjEjI/AAAAAAAAEWU/0DvMFtc7wqU/s1600/DSC_2019.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-E80xHQehusM/Uo6Z_EvjEjI/AAAAAAAAEWU/0DvMFtc7wqU/s320/DSC_2019.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-CAOdFl4-ULw/Uo6Z_tvx-gI/AAAAAAAAEWY/b46_SJB4poc/s1600/DSC_2018.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://4.bp.blogspot.com/-CAOdFl4-ULw/Uo6Z_tvx-gI/AAAAAAAAEWY/b46_SJB4poc/s320/DSC_2018.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-oMhuKjiwtwI/Uo6aHW9zNgI/AAAAAAAAEW4/48v7u8k6qqM/s1600/DSC_2023.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://3.bp.blogspot.com/-oMhuKjiwtwI/Uo6aHW9zNgI/AAAAAAAAEW4/48v7u8k6qqM/s320/DSC_2023.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-tk3WCJZPhr8/Uo6aKgrpW2I/AAAAAAAAEXA/809QEU6bZq4/s1600/DSC_2024.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-tk3WCJZPhr8/Uo6aKgrpW2I/AAAAAAAAEXA/809QEU6bZq4/s320/DSC_2024.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-HlPre29V3GM/Uo6aMzgPaiI/AAAAAAAAEXQ/WGYgwcXS6Vs/s1600/DSC_2025.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-HlPre29V3GM/Uo6aMzgPaiI/AAAAAAAAEXQ/WGYgwcXS6Vs/s320/DSC_2025.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-s5QLtLNFDdg/Uo6aL-UiAlI/AAAAAAAAEXM/443la6TNC7g/s1600/DSC_2026.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-s5QLtLNFDdg/Uo6aL-UiAlI/AAAAAAAAEXM/443la6TNC7g/s320/DSC_2026.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-XWZzyiACRG4/Uo6aQxsgBjI/AAAAAAAAEXY/RSbp6Z9ECeI/s1600/DSC_2027.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-XWZzyiACRG4/Uo6aQxsgBjI/AAAAAAAAEXY/RSbp6Z9ECeI/s320/DSC_2027.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-quQHXACP8V4/Uo6aZF6sOrI/AAAAAAAAEX4/qchUSPMzFiM/s1600/DSC_2031.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://4.bp.blogspot.com/-quQHXACP8V4/Uo6aZF6sOrI/AAAAAAAAEX4/qchUSPMzFiM/s320/DSC_2031.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-kEjxhzxCHbs/Uo6aXglKyCI/AAAAAAAAEX0/__VYd9FjNd8/s1600/DSC_2030.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-kEjxhzxCHbs/Uo6aXglKyCI/AAAAAAAAEX0/__VYd9FjNd8/s320/DSC_2030.jpeg" width="212" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-j01zecm2J4A/Uo6aSwKNzGI/AAAAAAAAEXg/Mi_ebHcfhRY/s1600/DSC_2029.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://1.bp.blogspot.com/-j01zecm2J4A/Uo6aSwKNzGI/AAAAAAAAEXg/Mi_ebHcfhRY/s320/DSC_2029.jpeg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/--1BgOugsloA/Uo6aWRRa2cI/AAAAAAAAEXs/vVtPtAwXevw/s1600/DSC_2028.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://2.bp.blogspot.com/--1BgOugsloA/Uo6aWRRa2cI/AAAAAAAAEXs/vVtPtAwXevw/s320/DSC_2028.jpeg" width="320" /></a></div>
<br />Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-59122330600830118922009-06-26T16:31:00.004-06:002009-06-26T17:13:54.104-06:00Software Version Control<a href= "http://betterexplained.com/articles/a-visual-guide-to-version-control/">A Visual Guide to Version Control</a><br /><br /><br /><a href= "http://www.ericsink.com/scm/source_control.html">Eric's Source Control HOWTO</a><br /><br /><a href= "http://svnbook.red-bean.com/">Version Control with Subversion</a>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-83929256953399908202009-06-19T13:55:00.003-06:002009-06-19T14:11:15.044-06:00End of Moore's Law?In a 1965 paper, Intel co-founder Gordon Moore described the observed trend that the density of transistors on a computer chip had been doubling every two years. Since then, this notion that every two years, technological advances will double the density of transistors on a chip, became known as Moore's Law. It was always acknowledged that quantum mechanics would eventually provide a limit to these technological advances, but as it turns out, the cost of manufacturing may bring a halt to Moore's law before technical limitations. Michael Feldman, over at HPCWire, predicts that we may see the effective end to <a href= "http://www.hpcwire.com/blogs/The-End-of-Moores-Law-in-Five-Years-48287682.html" >Moore's law in the next five years</a>.<br /><br />Moore observed that the cost per transistor decreased in concert with the shrinking geometries. <br /><br /><blockquote>... it has been apparent for some time that the Moore's Law curve is running counter to the escalating costs of semiconductor manufacturing, which are rising exponentially as process technology shrinks. This is the result of the increased cost of R&D, testing, and the construction of semiconductor fabrication facilities.</blockquote><br /><br />And it is really this aspect of the model that is breaking. Eventually you will be unable to sell enough chips to recoup even the capital expenditures.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-48407633009724615242009-05-07T11:06:00.025-06:002009-05-07T11:59:35.842-06:00Unix redirection<span style="font-family:arial;">The shell and many Unix commands take their input from </span><i style="font-family: arial;">standard input</i><span style="font-family:arial;"> (</span><code style="font-family: arial;">stdin</code><span style="font-family:arial;">), write output to </span><i style="font-family: arial;">standard output</i><span style="font-family:arial;"> (</span><code style="font-family: arial;">stdout</code><span style="font-family:arial;">), and write error output to </span><i style="font-family: arial;">standard error</i><span style="font-family:arial;"> (</span><code style="font-family: arial;">stderr</code><span style="font-family:arial;">). By default, standard input is connected to the terminal keyboard and standard output and error to the terminal screen.</span><br /><br /><span style="font-family:arial;">The redirection of I/O, for example to a file, is accomplished by specifying the destination on the command line using a redirection </span><i style="font-family: arial;">metacharacter</i><span style="font-family:arial;"> followed by the desired destination.</span><br /><br /><table style="font-family: arial;"><tr><th>Character</th><th>Action</th></tr><br /><tr><td><code>></code></td><td>Redirect standard output</td></tr><tr><td><code>>&</code></td><td>Redirect standard output and standard error</td></tr><tr><td><code><</code></td><td>Redirect standard input</td></tr><tr><td><code>>!</code></td><td>Redirect standard output; overwrite file if it exists</td></tr><tr><td><code>>&!</code></td><td>Redirect standard output and standard error; overwrite file if it exists</td></tr><br /><tr><td><code>|</code></td><td>Redirect standard output to another command (pipe)</td></tr><tr><td><code>>></code></td><td> Append standard output</td></tr><tr><td><code>>>&</code></td><td>Append standard output and standard error</td></tr></table><br /><span style="font-family:arial;">The general form of a command with standard input and output redirection is:</span><br /><br /><div style="text-align: center; font-family: arial;"><i>% command -[options] [arguments] <> output file </i></div><br /><span style="font-family:arial;">If you are using </span><b style="font-family: arial;">CSH/TCSH</b><span style="font-family:arial;"> and do not have the </span><b style="font-family: arial;">noclobber</b><span style="font-family:arial;"> environment variable set, using </span><i style="font-family: arial;"> > </i> and <i style="font-family: arial;"> >& </i><span style="font-family:arial;"> to redirect output will overwrite any existing file of that name. Setting </span><b style="font-family: arial;">noclobber</b> prevents this. Using <i style="font-family: arial;"> >! </i><span style="font-family:arial;"> and </span><i style="font-family: arial;"> >&! </i><span style="font-family:arial;"> always forces the file to be overwritten. Use </span><i style="font-family: arial;"> >> </i><span style="font-family:arial;"> and </span><i style="font-family: arial;"> >>& </i><span style="font-family:arial;"> to append output to existing files.</span><br /><br /><span style="font-family:arial;">Redirection may fail under some circumstances: 1) if you have the variable </span><b style="font-family: arial;">noclobber</b><span style="font-family:arial;"> set and you attempt to redirect output to an existing file without forcing an overwrite, 2) if you redirect output to a file you don't have write access to, and 3) if you redirect output to a directory.</span><br /><br /><span style="font-family:arial;">Lastly, have you ever wanted to capture the output of a command to a file, but also send it to the screen? The command <i>tee</i> can do just that.<br /><br /><div style="text-align: center; font-style: italic;">./compile |& tee filename<br /></div><br /><br />redirects both <code>stdout</code> and <code>stderr</code> to the file <i>filename</i>.<br />Its further discussed in this <a href="http://scientificcomputinganswers.blogspot.com/2009/05/using-tee-for-redirexction.html">post</a></span><br /><br /><br /><span style="font-family:arial;">Additional Example:</span><br /><br /><div style="text-align: center; font-family: arial;"><i>% who > names </i></div><br /><span style="font-family:arial;">Redirects standard output to a file named names.</span><br /><br /><div style="text-align: center; font-family: arial;"><i>% (pwd; ls -l) > out </i></div><br /><span style="font-family:arial;">Redirects output of both commands to a file named out.</span><br /><br /><div style="text-align: center; font-family: arial;"><i><br />% pwd; ls -l > out </i></div><br /><span style="font-family:arial;">Redirects output of ls command only to a file named out</span><br /><br /><span style="font-family:arial;">Input redirection can be useful, for example, if you have written a </span><b style="font-family: arial;">FORTRAN</b><span style="font-family:arial;"> program which expects input from the terminal but you want it to read from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout:</span><br /><br /><div style="text-align: center; font-family: arial;"><i>% myprog <> myout </i></div><br /><span style="font-family:arial;">You can suppress redirected output and/or errors by sending it to the null device, /dev/null. The example shows redirection of both output and errors:</span><br /><br /><div style="text-align: center; font-family: arial;"><i>% who >& /dev/null </i></div><br /><span style="font-family:arial;">To redirect standard error and output to different files, you can use grouping:</span><br /><br /><div style="text-align: center; font-family: arial;"><i>% (cat myfile > myout) >& myerror </i></div><br /><br /><span style="font-family:arial;">For the original article on redirection, on which this article is heavily based, and more information about how it differs for the Bourne Shell Family, see this </span><a style="font-family: arial;" href="http://www.mathinfo.u-picardie.fr/asch/f/MeCS/courseware/users/help/general/unix/redirection.html"> link</a>.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-48341107973286942792009-05-03T10:39:00.000-06:002009-05-07T12:00:00.651-06:00Using tee for redirexction<span style="font-family:arial;">Have you ever wanted to capture the output of a command to a file, but also send it to the screen? The command <i>tee</i> can do just that. Suppose you have a script that builds your application called <i>compile</i> and it sends pages of output to your screen, so you want to capture it to a file so that can employ UNIX's ability to search for patterns. You can achieve this using the UNIX commands<br /><br /><div style="text-align: center;"><span style="font-style: italic;">./compile >& filename</span></div><br /><br />where the redirection symbols <a href="http://www.mathinfo.u-picardie.fr/asch/f/MeCS/courseware/users/help/general/unix/redirection.html"> >&</a> direct both the <i>standard output</i> (<code>stdout</code>) and write error output to <i>standard error</i> (<code>stderr</code>) to the file named <i>filename</i>. Sometimes you also want to see the output on the screen at the same time. This is where the Unix command <a href="http://linux.about.com/library/cmd/blcmdl1_tee.htm"><i>tee</i></a> comes in. For example the Unix commands<br /><br /><div style="text-align: center; font-style: italic;">./compile |& tee filename<br /></div><br /><br />redirects both <code>stdout</code> and <code>stderr</code> to the file <i>filename</i>.<br /></span>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-29745803746309128822009-04-10T13:56:00.013-06:002009-04-28T11:44:59.542-06:00R Statistical software<a style="font-family: arial;" href="http://en.wikipedia.org/wiki/R_%28programming_language%29">R is a statistical computing scripting language</a><span style="font-family:arial;"> not dissimilar to Matlab or Python.</span><br /><span style="font-family:arial;">R is a GNU project implementation of the S programming language with lexical scoping semantics inspired by Scheme. The R language has become a de facto standard among statisticians for the development of statistical software.</span><br /><br /><span style=";font-family:arial;font-size:130%;" ><span style="font-weight: bold;">Resources:</span></span><br /><ul style="font-family: arial;"><li>The <a href="http://www.r-project.org/">R project website</a>.</li><li><a href="http://scicomp.evergreen.edu/students/software-tutorials/r-tutorials-and-readings%3EPage%20of%20tutorial%20links.%3C/a%3E%3Cbr%3E%3C/li%3E%3Cli%3E%3Ca%20href=" org="" ajayshah="" kb="" r="" html="">R by example</a> - a quick guide to doing things in R.</li><li><a href="http://zoonek2.free.fr/UNIX/48_R/02.html#17">Programming in R</a>.<br /></li><li>A series of <a href="http://www.youtube.com/watch?v=mL27TAJGlWc">R tutorials on YouTube</a></li><li><a href="http://zoonek2.free.fr/UNIX/48_R/all.html">Statistics with R</a> are some personal notes on using R.</li><li><a href="http://cran.r-project.org/web/packages/">R packages/libraries archive</a>.</li><li><a href="http://www.apsnet.org/education/advancedplantpath/topics/Rmodules/doc0/">R Tutorial for Epidemiology.</a></li><li><a href="http://socserv.mcmaster.ca/jfox/Courses/UCLA/index.html"></a><a href="http://socserv.mcmaster.ca/jfox/Courses/UCLA/index.html">Some R resources and examples.</a></li><li><a href= "http://www.personality-project.org/R/">Using R for psychological research.</a></li><li><a href="http://www.stat.auckland.ac.nz/%7Epaul/RGraphics/rgraphics.html">Graphics in R</a><br /></li></ul>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-8334648498923130272009-04-03T17:26:00.000-06:002009-04-03T17:45:31.205-06:00Mother May I?<span style="font-family:arial;">Unix uses the concept of permissions and ownership to determine who can access a file or directory. Each file or folder is considered to be owned by a user and a group (typically group to which the user belongs). There are a set of permissions associated with each file or folder that determines what actions on that file or folder are allowed for a particular user. There are three types of permissions:<br /><ul><li><span style="font-weight: bold;">r</span> - read, allows you to read the contents of a file<br /></li><li><span style="font-weight: bold;">w</span> - write, allows you to write to a file or delete it<br /></li><li><span style="font-weight: bold;">x</span> - execute, allows you to run a file as a script, or <span style="font-weight: bold;">cd</span> to a directory.<br /></li></ul>and three groups to set permissions on:<br /><ul><li>User or Owner is the person who created the file<br /></li><li>Group is the group that the owner belongs to<br /></li><li>Other is everyone else in the world.</li></ul>You can see the ownership and permissions for a file or folder by using the <span style="font-weight: bold;">ls</span> command with the <span style="font-weight: bold;">-l </span>option. For example, if <span style="font-weight: bold; font-style: italic;">readme</span> is a file in the current folder:<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">ls -l readme</span></span><br /></div><span style="font-family:arial;">might give the results:<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">-rw-r--r-- 1 bob staff 0 Jun 17 23:30 readme</span></span><br /><br /></div><span style="font-family:arial;">This shows that the file <span style="font-weight: bold; font-style: italic;">readme</span> is owned by user <span style="font-weight: bold; font-style: italic;">bob</span> and group <span style="font-weight: bold; font-style: italic;">staff</span>. The permissions are shown by the sequence of ten characters at the start of that line: <span style="font-weight: bold; font-style: italic;">-rw-r--r--</span>. The first character is a <span style="font-weight: bold; font-style: italic;">-</span> for a file. Alternatively if it were a <span style="font-weight: bold; font-style: italic;">d</span> it would indicate a directory. The next three characters (<span style="font-weight: bold; font-style: italic;">rw-</span>) indicate the permissions for the owner of the file (<span style="font-weight: bold; font-style: italic;">bob</span>). The next three characters (<span style="font-weight: bold; font-style: italic;">r--</span>) indicate the permissions for a user who is not the owner of the file, but who is in the group (<span style="font-style: italic; font-weight: bold;">staff</span>) that owns the file. The last three characters (<span style="font-style: italic; font-weight: bold;">r--</span>) indicate the permissions for everyone else.<br /><br />You can remove a <span style="font-weight: bold;">read-only</span> file from a directory only if you have write permission for that folder (-rw-r--r--). Typically directories must have execute permission if you want people to have read permission.<br /><br /><br /><span style="font-weight: bold;font-size:130%;" >Changing permissions<br /><br /></span>To change the permissions on a file or folder, use the <span style="font-weight: bold;">chmod</span> command. </span><span style="font-family:arial;">For details, see <span style="font-weight: bold;">man chmod</span>. T</span><span style="font-family:arial;">he easiest way to change permissions is to use the <span style="font-weight: bold;">symbolic modes</span> where the permission changes are specified by add <span style="font-weight: bold;">+</span>, remove <span style="font-weight: bold;">-,</span> or set <span style="font-weight: bold;">=</span> permissions. Use <span style="font-weight: bold;">u</span> to indicate that the change applies to the user permissions, <span style="font-weight: bold;">g</span> to indicate that it applies to the group permissions, and <span style="font-weight: bold;">o</span> for anyone else.<br /><br />To change the permissions on the file <span style="font-weight: bold;">readme</span> to allow the world to have write permission:<br /><br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-style: italic; font-weight: bold;">chmod o+w readme</span></span><br /></div><span style="font-family:arial;"><br />If the file isn't owned by the user, preface the command with <span style="font-weight: bold;">sudo</span> and supply a superuser password:<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">sudo chmod g+w readme<br /><br /></span></span></div><span style="font-family:arial;">To add executable permission to the file </span><span style="font-family:arial;">(e.g. because it is a script)</span><span style="font-family:arial;"> for the owner of the file and for users in the group that owns the file use:<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-style: italic; font-weight: bold;">chmod ug+x readme</span></span><br /></div><span style="font-family:arial;"><br />To remove the read and write permissions for the group and the world:<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-style: italic; font-weight: bold;">chmod go-rw readme</span></span><br /></div><span style="font-family:arial;"><br />Use the the set <span style="font-weight: bold;">=</span> operation to set the permissions to an exact configuration - without regard to what the permissions are currently. To set the file to be readable and writable by the owner, but only readable by group and "other":<br /></span><div style="text-align: center;"><span style="font-style: italic; font-weight: bold;font-family:arial;" >chmod u=rw,go=r readme</span><br /></div><span style="font-family:arial;"><br />Things work similarly for directory permissions. Often you want to change the permissions of a directory and all its contents. Do this with the <span style="font-weight: bold;">-R</span> option to <span style="font-weight: bold;">chmod</span>.<br /><br />To change a directory and all its contents to be writable by the owner and group use:<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">chmod -R ug+w Folder</span></span><br /></div><span style="font-family:arial;"><br />Likewise, the flag <span style="font-weight: bold;">X</span> (uppercase) can be combined with the <span style="font-weight: bold;">-R</span> option to ensure that a folder and all of its sub-folders have execute permission, but not the files. Typically execute permission is not desirable for files unless they are applications or scripts.<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">chmod -R ugo+X Folder</span> </span><br /></div><span style="font-family:arial;"><br /><br /></span>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-11879037873690634752009-04-02T15:55:00.001-06:002009-04-02T17:17:15.739-06:00Fundamental Unix Commands<span style=";font-family:arial;font-size:130%;" ><span style="font-weight: bold;">Overview of the Apple OS X BSD UNIX implementation</span></span><br /><br /><span style="font-weight: bold;font-family:arial;font-size:130%;" >Opening a terminal</span><br /><br /><span style="font-family:arial;">To access the UNIX subsystems in OS X you need to open the terminal application. The terminal is located in the <span style="font-style: italic;">Utilities</span> folder under applications.</span><br /><br /><span style="font-weight: bold;font-family:arial;font-size:130%;" >Navigating in the terminal</span><span style="font-family:arial;"><br /><ul><li>The horizontal arrow ←→ keys move the cursor left and right </li><li>The vertical arrow ↑↓ keys page through the command history. </li><li>Use the mouse to select text (by highlighting) and ⌘c and ⌘v to cut and paste text </li><li>Delete deletes text behind the cursor the ⌦ key deletes text after the cursor. </li></ul><span style="font-weight: bold;font-size:130%;" >Nomenclature </span></span><span style="font-family:arial;"><br /><br />There are numerous concise ways to specify directory information.<br /></span><div style="text-align: left;"><ul><li><span style="font-family:arial;">. indicates your current directory </span></li><li><span style="font-family:arial;">.. indicates the directory right above you on the tree, or parent to the current directory.</span></li><li><span style="font-family:arial;">~ indicates the users own home directory </span></li><li><span style="font-family:arial;">~smith indicates the user <span style="font-style: italic; font-weight: bold;">Smith's</span> own home directory </span></li><li><span style="font-family:arial;">/ the root directory, or top of the tree. </span></li></ul></div><span style="font-family:arial;"><br /><span style="font-size:130%;"><span style="font-weight: bold;">Basic Unix Commands</span></span><br /><br /><span style="font-weight: bold;">CP</span>: cp copies a file from a source name to a target name.<br /><div style="text-align: center;"><span style="font-style: italic; font-weight: bold;"><br />cp [modifiers] <source>/<filename> <target>/<filename> </target></source></span><br /></div><br />Some common modifiers for copy are:<br /><span style="font-weight: bold;">-r</span> for recursive (used to copy whole directories)<br /><span style="font-weight: bold;">-f</span> force (don’t ask me if I want to do it just do it)<br /><span style="font-weight: bold;">-P</span> preserve permissions<br /><br />For example<br /></span><div style="text-align: center;"><span style="font-style: italic; font-weight: bold;font-family:arial;" >cp /usr/share/tcsh/examples/login ~/login</span><br /><br /></div><span style="font-family:arial;">copies the default <span style="font-weight: bold;">login</span> file for the <span style="font-weight: bold;">tcsh</span> shell located in the <span style="font-style: italic; font-weight: bold;">/usr/share/tcsh/examples</span> to your home directory. See the <a href="http://scientificcomputinganswers.blogspot.com/2009/03/customizing-your-log-in-shell.html">article on shells</a> for more information on the login file.<br /><br /><span style="font-weight: bold;">MV</span>: mv moves a file from one directory to another, or from one name to another, or a combination of both. It often confuses new users that renaming in Unix is the same as moving.<br /></span><div style="text-align: center;"><span style="font-weight: bold; font-style: italic;font-family:arial;" ><br />mv [modifiers] <source>/<filename> <target>/<file> </target></source></span><br /></div><span style="font-family:arial;"><br />Some common modifiers for move are:<br /><span style="font-weight: bold;">-r</span> for recursive (used to copy whole directories)<br /><span style="font-weight: bold;">-f</span> force (don’t ask me if I want to do it just do it)<br /><span style="font-weight: bold;">-P</span> preserve permissions<br /><br /></span><span style="font-family:arial;">For example<br /></span> <div style="text-align: center;"><span style="font-style: italic; font-weight: bold;font-family:arial;" >mv login .login<br /><br /></span></div> <span style="font-family:arial;">just renames the file login to .login.<br /><br /></span><span style="font-family:arial;"><span style="font-weight: bold;">RM</span>: rm removes a file or with the -r modifier, a directory.<br /></span><div style="text-align: center;"><span style="font-weight: bold; font-style: italic;font-family:arial;" ><br />rm [modifiers] <source>/<filename/directory> <target> </target></source></span><br /></div><span style="font-family:arial;"><br />Some common modifiers for move are:<br /><span style="font-weight: bold;">-r</span> for recursive (used to delete whole directories)<br /><span style="font-weight: bold;">-f</span> suppresses confirmation prompts asking if you really want to delete read-only files.<br /><br /></span><span style="font-family:arial;">For example<br /></span> <div style="text-align: center;"><span style="font-style: italic; font-weight: bold;font-family:arial;" >rm -rf /usr/local/bin<br /><br /></span></div> <span style="font-family:arial;">removes the directory<span style="font-weight: bold; font-style: italic;"> bin</span>, in <span style="font-weight: bold; font-style: italic;">/usr/local</span>, if you have permission to do so. Note this is NOT something that is a good idea to try.<br /><br /></span><span style="font-family:arial;"><span style="font-weight: bold;">CD</span>: cd changes the current working directory.<br /></span><div style="text-align: center;"><span style="font-weight: bold;font-family:arial;" ><span style="font-style: italic;">cd <directory change="" to=""></directory></span> </span><br /></div><span style="font-family:arial;"><br /><span style="font-weight: bold;">PWD</span>: pwd displays the current working directory.<br /><br /><span style="font-weight: bold;">MKDIR</span>: mkdir creates a new directory</span><span style="font-family:arial;">. Some common modifiers for <span style="font-weight: bold;">mkdir</span> are:<br /><span style="font-weight: bold;">-p</span> used to create a whole hierarchy of folders in one step.</span><span style="font-family:arial;"><br /><br />For example<br /></span><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">mkdir -p work/version1/code<br /></span></span><div style="text-align: left;"><span style="font-family:arial;"><span><br />creates the directory <span style="font-weight: bold; font-style: italic;">code</span> inside of the directory <span style="font-weight: bold; font-style: italic;">version1</span>, which is inside a directory <span style="font-weight: bold; font-style: italic;">work</span>. And <span style="font-weight: bold; font-style: italic;">work</span> is created in the current working directory.<br /><br /></span></span></div></div><span style="font-family:arial;"><span style="font-weight: bold;">LS</span>: ls displays the contents of a specified directory. By default it displays the current directory.<br /><div style="text-align: center;"><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">ls [modifiers]<br /></span></span><div style="text-align: left;">or<br /></div><span style="font-family:arial;"><span style="font-weight: bold; font-style: italic;">ls</span> </span><span style="font-style: italic; font-weight: bold;">[modifiers] </span><source style="font-style: italic; font-weight: bold;">/<filename/directory></source></div><span style="font-family:arial;"><br />Some common modifiers for ls are:<br /><span style="font-weight: bold;">-l</span> provides a long listing of the file information.<br /><span style="font-weight: bold;">-lt</span> provides a long listing but now sorted in chronological order<br /><span style="font-weight: bold;">-a</span> lists all files, including hidden <span style="font-style: italic; font-weight: bold;">dot</span> files.<br /><span style="font-weight: bold;">-d</span> lists the directory itself (the default behavior lists the contents of the directory instead).<br /><br /></span><span style="font-family:arial;">For example<br /></span> <div style="text-align: center;"><span style="font-style: italic; font-weight: bold;font-family:arial;" >ls -t /usr/share/tcsh/examples<br /><br /></span></div> <span style="font-family:arial;">lists the contents of the directory </span><span style="font-style: italic; font-weight: bold;font-family:arial;" >/usr/share/tcsh/examples </span><span style="font-family:arial;">in the chronological order in which they were created.<br /><br />Last of all, is the command that helps you find out more about any command. This is the man command.<br /><br /><span style="font-weight: bold;">MAN</span>: man accesses the built in manual pages. For example to find all the modifier options for <span style="font-weight: bold;">ls</span>, type:<br /><div style="text-align: center;"><span style="font-weight: bold; font-style: italic;">man ls</span><br /><br /></div>to find the name of a command which does something specific use the <span style="font-weight: bold;">-k</span> modifier.<br /><br /><div style="text-align: center;"><span style="font-weight: bold; font-style: italic;">man -k password</span><br /><br /></div>lists all the commands which deal with passwords. Alternatively use the command <span style="font-weight: bold;">apropos </span> which searches through the header lines of the man pages for whatever keyword you supply, and lists the man pages containing it. For example,<br /><br /><div style="text-align: center;"><span style="font-weight: bold; font-style: italic;">apropos copy</span><br /></div><br />produces a list of all the man pages that contain copy in their header lines.<br /><br />This is just the begining, there is more Unix to come, but this will get you started.<br /></span><br /></span>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-3165666547553584362009-03-30T13:24:00.003-06:002009-03-30T13:29:01.033-06:00Issues programming on multicore architecturesIt turns out many existing distributed memory parallel algorithms are poorly designed for parallel execution on multicore processors, because they have simply been optimized for the wrong design parameters.<br /><br /><blockquote>In the past we have been striving for algorithms to maximize parallelism and at the same time minimize the communication between the threads. For multicore processors, however, the cost of thread communication is relatively cheap as long as the communicated data resides in a cache shared by the threads. Also, the amount of parallelism that can be explored by a multicore processor is limited by its number of cores multiplied by the number of threads running on each core. Instead, a third parameter is gaining importance for parallel multicore applications: the memory usage.<br /></blockquote><br /><br /><br /><a href= "http://www.hpcwire.com/features/Finding-the-Door-in-the-Memory-Wall-Part-2-41712417.html">Read more here</a>.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-19610341212059751292009-03-24T13:06:00.002-06:002009-03-30T13:19:12.510-06:00Customizing your log in shell<span style="font-size:130%;"><span style="font-weight: bold;">Shell resource files:</span></span><br />Every time you log in, the <span style="font-weight: bold;">UNIX</span> shell searches your home directory for shell resource files to execute. These files, prefixed with a period, customize the <span style="font-weight: bold;">UNIX</span> session. Each shell has its own unique set of resource files. We'll discuss those for <span style="font-weight: bold;">C-shell</span>, the <span style="font-weight: bold;">Korn</span> shell, and the <span style="font-weight: bold;">bash</span> shell.<br /><br /><span style="font-weight: bold;">CSH/TCSH</span>:<br />For the <span style="font-weight: bold;">csh/tcsh</span> shell, the two initialization files are the the the <span style="font-style: italic; color: rgb(0, 153, 0); font-weight: bold;">.cshrc</span> (pronounced `dot-see-shirk') file, (alternatively tcsh accepts the either a <span style="font-style: italic; color: rgb(0, 153, 0); font-weight: bold;">.cshrc</span> or <span style="font-style: italic; color: rgb(0, 153, 0); font-weight: bold;">.tcshrc</span> file), and the (pronounced `dot-login') file. The <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.cshrc</span> file is executed every time a new C shell is started. The <span style="font-style: italic; color: rgb(0, 153, 0); font-weight: bold;">.login</span><span style="color: rgb(0, 153, 0);"> </span>is executed after the <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.cshrc</span> file only when you initially log in. Generally, so that every new copy of the C shell will be able to use them, any alias and set commands should be placed in the file. Although it is also permissible to create a separate third file for aliases called <span style="font-weight: bold; font-style: italic; color: rgb(0, 153, 0);">.aliases</span>. the <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.aliases</span> file must be defined and executed as part of the <span style="font-weight: bold; font-style: italic; color: rgb(0, 153, 0);">.cshrc/.tcshrc</span> file, just like the <span style="font-weight: bold; font-style: italic; color: rgb(0, 153, 0);">.env</span> file on the Korn shell. In this case it is necessary to Environment variables are typically set in the <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.login</span> file, as well as library and manual paths, and terminal settings. In many cases, this division isn't clear cut.<br /><br /><span style="font-weight: bold;">KORN:</span><br />On login the <span style="font-weight: bold;">ksh</span> shell executes a profile file called <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.profile</span>. The <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.profile</span> is used to set environment variables and shell options. Aliases can also be put in the Profile file, but it's considered good practice to put them in a separate environment file called .env. The environment file is defined and executed as part of the <b style="font-style: italic; color: rgb(0, 153, 0);">.profile</b>. This is different from how the C-shell resource files are handled. An <a href="http://www.uic.edu/depts/accc/software/unixgeneral/unixcust.html#doit">example of a korn shell</a> shows that its syntax is based on that of the <span style="font-weight: bold;">Bourne</span> shell.<br /><br /><span style="font-weight: bold;">BASH:</span><br />On login the <span style="font-weight: bold;">bash</span> shell executes a resource file called <span style="font-style: italic; font-weight: bold; color: rgb(0, 153, 0);">.bashrc</span> that is responsible for all the shell customization. An <a href="http://tldp.org/LDP/abs/html/sample-bashrc.html">example of a bash shell</a> shows that its syntax is similar to the <span style="font-weight: bold;">Bourne</span> and <span style="font-weight: bold;">Korn</span> shells.<br /><br /><span style="font-weight: bold;">Critical Aliases:</span><br />In my mind, the three most important aliases are for the <span style="font-weight: bold;">mv, cp</span>, and <span style="font-weight: bold;">rm</span> commands. The default behavior of the <span style="font-weight: bold;">mv</span> and <span style="font-weight: bold;">cp</span> commands over writes any existing file without warning. The default behavior of the <span style="font-weight: bold;">rm</span> command removes a file without warning. In UNIX once a file is removed, there is no easy or gauranteed way to get it back. The flag <span style="font-weight: bold;">-i</span> forces the <span style="font-weight: bold;">mv, cp</span>, and <span style="font-weight: bold;">rm</span> commands to ask for comformation before completing. I always add these aliases to any new account, because it can save you from making a careless mistake that wipes out important work.<br /><div style="text-align: center;"><br /><div style="text-align: left;">In csh/tcsh shells, the syntax is:<br /><br /></div><div style="text-align: left;"><span style="font-weight: bold;">alias mv '/usr/bin/mv -i '</span><br /><span style="font-weight: bold;">alias cp '/usr/bin/cp -i '</span><br /><span style="font-weight: bold;">alias rm '/usr/bin/rm -i '</span> </div></div><span style="font-weight: bold;"><br /></span>Otherwise the syntax is:<br /><br /><div style="text-align: left;"><span style="font-weight: bold;">alias mv='/usr/bin/mv -i '</span><br /><span style="font-weight: bold;">alias cp='/usr/bin/cp -i '</span><br /><span style="font-weight: bold;">alias rm='/usr/bin/rm -i '</span> </div> <span style="font-weight: bold;"><br /></span><br /><span style="font-weight: bold;">Useful Aliases:</span><br />Some other useful aliases are:<span style="font-weight: bold;"><br /><br />alias c 'clear' </span><span>shorthand a command.<br /><span style="font-weight: bold;">alias h 'history</span><br /></span><span style="font-weight: bold;"><span style="font-weight: bold;">alias ls 'ls -F'</span></span> change the default behavior of a command.<br /><span style="font-weight: bold;">alias cd 'cd \!*; ls'</span> show the contents of a directory when you go to it.<br /><span style="font-weight: bold;">alias exit 'logout'</span> add new names to existing commands<br /><span style="font-weight: bold;">alias print 'enscript -G2rc -dprintername'</span> this one prints a text file as 2 columns.<br /><br />In addition with the <span style="font-weight: bold;">Bash</span> useful functions came be defined, such as this one which automatically picks the correct way to extract an archive.<br /><br /><span><pre class="PROGRAMLISTING">function extract() # Handy Extract Program.<br />{<br /> if [ -f $1 ] ; then<br /> case $1 in<br /> *.tar.bz2) tar xvjf $1 ;;<br /> *.tar.gz) tar xvzf $1 ;;<br /> *.bz2) bunzip2 $1 ;;<br /> *.rar) unrar x $1 ;;<br /> *.gz) gunzip $1 ;;<br /> *.tar) tar xvf $1 ;;<br /> *.tbz2) tar xvjf $1 ;;<br /> *.tgz) tar xvzf $1 ;;<br /> *.zip) unzip $1 ;;<br /> *.Z) uncompress $1 ;;<br /> *.7z) 7z x $1 ;;<br /> *) echo "'$1' cannot be extracted" ;; <br /> esac else echo "'$1' is not a valid file" fi } </pre></span><br /><br />If you know of any others, send them to me and I'll add them to the list.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-73314817832927815622009-03-23T10:59:00.015-06:002009-03-23T14:50:09.457-06:00Customizing your work environment: ShellsOne of the chief advantages the <span style="font-weight: bold;">UNIX</span> OS, is that it provides the user with a high level of customization. This is why one of my pet peeves are system administrators who refuse to set up machines with anything other than the default settings. Productivity is largely a factor of having a setup that works. One person's optimal work environment is not necessarily an other's. As a software developer I don't use the Window's OS because I find it clumsy and non-intuitive, but I know plenty of managers who find it the exact opposite. To each their own.<br /><br /><span style="font-weight: bold;font-size:130%;" >Changing your shell:</span><br /><br />Lets start with how to change your log in shell and then discuss why you might want to. From any command line prompt you can just type the name of the shell you want, e.g. <span style="font-weight: bold;">csh, tcsh, korn, bash</span>, etc. But this only gets you into the shell temporally. Next time you log back in you are back to the same shell.<br /><br />If you don't know, you can find out which shell you're currently using, by typing at the UNIX prompt:<br /><br /><span style="font-weight: bold;">echo $SHELL</span><br /><br />To change the shell so that it remains changed when log back in use the chsh command. See this link for examples of <a href="http://kb.iu.edu/data/benf.html">how the chsh command differs on various platforms</a>. Unfortunately, the bad news is that this this doesn't always work ,depending on how the system was set up. You may need to resort to bribing your system administrator. May suggest junk food or beer!<br /><br /><span style="font-weight: bold;font-size:130%;" >Shells:</span><br /><br />As a user, the first thing you interact with is the system shell. The <span style="font-weight: bold;">UNIX</span> world contains a menagerie of system shells.<br /><br />In the beginning was the Bourne shell (<span style="font-weight: bold; font-style: italic;">/bin/sh</span>). The Bourne shell, written by S. R. Bourne, is built around a powerful syntactical language, with all the features that needed to produce structured programs. It has strong provisions for controlling input and output, and expression matching facilities. Its main disadvantage is that it was designed with nearly no concessions to the interactive user<br /><br />Next came a complete redesign called the C-shell (<span style="font-weight: bold; font-style: italic;">/bin/csh</span>). Designed at UC Berkeley, the C-shell was designed for interactive use. It used a new input language designed to resemble C and added several new concepts including job control and aliasing. Unfortunately, the new shell was too buggy to produce robust shell scripts, thus the community split between the Bourne shell for scripts and the C-shell for interactive use.<br /><br />The community eventually decided to fix the bugs in the C-shell, creating the T-shell (<span style="font-style: italic; font-weight: bold;">/bin/tcsh</span>). The tcsh shell added numerous additional features including command line editing, and command line completion. Unfortunately the tcsh shell never got widely distributed by the various UNIX system manufacturers.<br /><br />Around the same time David Korn, at AT&T, developed the Korn shell (<span style="font-style: italic; font-weight: bold;">/bin/ksh</span>) as an extension of the original Bourne shell, including many features that made the C shell good for interactive work. Unfortunately the Korn shell wasn't free, you had to pay AT&T for it.<br /><br />At about this time, the <span style="font-weight: bold;">GNU</span> project was underway and decided that they needed a free shell that took the best parts of the Bourne and Korn shells, as well as features from the C shell and other operating systems. This project became the bash shell (for "Bourne Again SHell"). The Bash shell was quickly adopted for <span style="font-weight: bold;">LINUX</span> (where it can be configured to perform just like the Bourne shell), and is the most popular of the free new generation shells.<br /><br />The final two shells are the Z-shell and RC. The Z-shell (<span style="font-weight: bold; font-style: italic;">zsh</span>) bears the most resemblance to the Korn shell. The <span style="font-weight: bold; font-style: italic;">zsh</span> shell features command line editing, spelling correction, word completion and a history mechanism. The <span style="font-weight: bold; font-style: italic;">rc</span> shell, by contrast, is a basic shell quite similar to <span style="font-weight: bold; font-style: italic;">sh</span>. The syntax of <span style="font-style: italic; font-weight: bold;">rc</span> contains more similarities to the C language than even <span style="font-weight: bold; font-style: italic;">csh</span>.<br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Where do you find these shells:</span></span><br /><br />Currently the Bourne shell dominates the <span style="font-weight: bold;">LINUX</span> world. Straight out of the box, Mac's Darwin also runs bash. The Korn shell seems to be common in the <span style="font-style: italic;">big iron</span> supercomputing world.<br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">References:</span></span><br /><br />For a general introduction to basic UNIX commands, see <a href="http://www.washington.edu/computing/unix/">here</a> or <a href="http://partmaps.org/era/unix/shell.html">here</a>.<br />For a bit more on the history of UNIX shells check <a href="http://www.faqs.org/faqs/unix-faq/shell/shell-differences/">here</a> or <a href="http://www.softlab.ntua.gr/facilities/documentation/unix/shelldiff.html">here</a>.<br />For a through <a href="http://www.uic.edu/depts/accc/software/unixgeneral/unixcust.html">discussion of the Korn shell</a> dot files.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-38274349698106534182009-03-19T13:23:00.000-06:002009-03-19T13:24:06.019-06:00How to link to any part of a video on youtubeYa, I know it is a stretch to say this has anything to do with <i>scientific computing</i>, but its still a pretty useful <a href="http://www.mattcutts.com/blog/link-to-youtube-minute-second/">hack</a>.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-73897321136381780682009-03-18T14:02:00.001-06:002009-03-20T15:20:49.524-06:00Creating & Using libraries in Scientific CodeFor the discussion here we're going to restrict ourselves to Unix/Linux computing environments.<br /><br />Suppose you have a program consisting of a collection source files. Typically scientific applications are constantly evolving, but parts of that code base, utilities, linear algebra solvers, IO routines, etc., may be static. This static code might be duplicated across numerous applications, and each application may have slightly differing versions. A simple way to control this static code is to create a library file out of it, and place it in a shared location.<br /><br /><span style="color: rgb(51, 51, 153);font-size:130%;" >Library Construction:</span><br />There are two types of libraries, <span style="font-weight: bold;">static</span> and <span style="font-weight: bold;">dynamic</span>, the latter also known as shareable. Both versions of these libraries are functionally equivalent. Lets look at each type.<br /><br /><span style="font-weight: bold; color: rgb(0, 0, 0);">Static Libraries</span><span style="color: rgb(0, 0, 0);">:</span><br />A static library is just an archive of object files, usually indicated by a .a suffix. Using the Unix <span style="font-weight: bold;">ar</span> command a collection of object files may be combined to create a library. The benefit of a static library is that it gets attached to the executable of the target application. The executable is self-contained meaning the library's presence is not required when running the program. Under some circumstances, the executable may run faster.<br /><br /><span style="font-weight: bold; color: rgb(0, 0, 0);">Dynamic Libraries</span><span style="color: rgb(0, 0, 0);">:</span><br />Dynamic libraries or shared libraries differ from static libraries in that the library is not part of the executable, but is linked at run time. Therefore dynamic libraries need to be present when the application is run. A dynamic library is typically indicated by the .so suffix. There main advantage of dynamic libraries are that since the executable does not include the library within it, the executable is significantly smaller. The Windows OS relies on dynamic libraries.<br /><br />Lets look at static libraries and leave dynamic libraries for later. Creating a static library is pretty simple.<br /><br /><ul style="color: rgb(0, 0, 0);"><li><span style="font-size:100%;">Compile the source objects</span></li></ul><br /> <span style="font-style: italic; font-weight: bold; color: rgb(204, 0, 0);"><span style="color: rgb(204, 102, 0);">$(FC) -c</span> <span style="color: rgb(153, 51, 153);"> ftest1.f90 ftest2.f90 ftest3.f90</span></span><br /><br />creating three object files <span style="font-style: italic; font-weight: bold; color: rgb(204, 0, 0);">ftest1.o ftest2.o ftest3.o</span>, and if the source contains any Modules, a series of module symbol files with the suffix .mod. Keep track of these because we will need them for the linking stage.<br /><br /><ul style="color: rgb(0, 0, 0);"><li><span style="font-size:100%;">Create an archive from the object files using the Unix archive <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ar"><span style="font-weight: bold;">ar</span></a> command.</span></li></ul><br /> <span style="font-weight: bold; color: rgb(204, 102, 0);">ar</span><span style="font-style: italic; font-weight: bold; color: rgb(204, 0, 0);"><span style="color: rgb(204, 102, 0);"> -cvq</span> <span style="color: rgb(0, 0, 153);"> libftest.a</span> ftest1.o ftest2.o ftest3.o</span><br /><br />which creates an archive named <span style="font-weight: bold; font-style: italic; color: rgb(0, 0, 153);">libftest.a</span><br /><br /><ul><li>Last step is to create and add a table of contents to te archive. This is done using the UNIX command ranlib. This last step differentiates between an archive of object files and an actual library.</li></ul><span style="font-weight: bold; color: rgb(204, 102, 0);"><span style="font-style: italic;">ranlib</span></span><span style="font-style: italic; font-weight: bold; color: rgb(204, 0, 0);"> <span style="color: rgb(0, 0, 153);"> libftest.a</span></span><br /><br />See that was pretty easy.<br /><br />Now you can see what's in the archive with the archive command<br /><br /> <span style="font-weight: bold; color: rgb(204, 102, 0);">ar -</span><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);"><span style="color: rgb(204, 102, 0);">t </span><span style="color: rgb(0, 0, 153);">libftest.a</span></span><br /><br />Running this produces the list:<br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);">ftest1.o </span><br /><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);">ftest2.o </span><br /><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);">ftest3.o</span><br /><br />A second Unix command <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?nm"><span style="font-weight: bold;">nm</span></a> lists all the symbols contained in each of the object files contained in the archive. For our purposes, symbols are associations with routines, common data, and modules in the source code.<br /><br /><span style="color: rgb(51, 51, 153);font-size:130%;" >Library Use:</span><br />The last step here is actual library use. The exact procedure varies somewhat between languages and compilers. So we will focus on the case of Fortran 90/95 code.<br /><br />Historically the compile and link and loads phase of creating an executable used separate commands. Modern Fortran compilers <span style="font-weight: bold;">$(FC)</span> combine all three steps in a single compiler call.<br /><blockquote><br />After the compiler compiles the source files, it uses the ld command to link the resulting .o files, any .o files that you specify as input files, and some of the .o and .a files in the product and system library directories. The compiler can then produce a single .o object file or a single executable output file from these object files.<br /></blockquote><br />If all the object files and libraries you need are local to the build, or are part of the library path environment variable, things should just build.<br /><br />Typically this isn't the case and you need to specify the location and name of the libraries. Suppose our previous library called<i style="font-style: italic; font-weight: bold;"> <span style="color: rgb(0, 0, 153);">libftest.a</span></i> is located in the <i style="font-weight: bold; color: rgb(0, 153, 0);">/mydirectory/mylibrary/lib</i>. This is done by adding two terms to the compile statement. The fisrt is the lowercase <i style="font-weight: bold;">-l</i><span style="font-weight: bold;"> </span>flag for the library name, and the second is the uppercase flag <i style="font-weight: bold;">-L</i><span style="font-weight: bold;"> </span>for the library path.<br /><br /><span style="font-weight: bold; color: rgb(204, 0, 0);"><span style="color: rgb(204, 102, 0);">$(FC)-o</span> <span style="color: rgb(0, 0, 0);">myprogram</span> myprogram.o -L<span style="color: rgb(0, 153, 0);">/mydirectory/mylibrary/lib</span> -l<span style="color: rgb(0, 0, 153);">ftest</span></span><br /><br />This creates an executable called <span style="font-weight: bold;">myprogram</span> resulting from the source file <span style="font-weight: bold; font-style: italic;">myprogram.f90</span> linked to the library <i style="font-weight: bold; color: rgb(0, 0, 153);">libftest.a</i> located in the directory <i style="font-weight: bold; color: rgb(0, 153, 0);">/mydirectory/mylibrary/lib</i>.<br /><br /><span style="font-weight: bold;">Note</span> two important things:<br /><ol style="color: rgb(255, 102, 0);"><li>There are no spaces between the flags and the entries.</li><li>The library name excludes the prefix <i>lib</i> and the suffix <i>.a</i></li></ol><br />Now you are not necessarily finished. If the library <i style="font-weight: bold; color: rgb(0, 0, 153);">libftest.a</i> contains Fortran modules, and those modules are declared within the source code <span style="font-style: italic; font-weight: bold;">myprogram.f90</span>, then you also need to specify the path to the <i style="font-weight: bold;">.mod</i> files created above during the compilation.<br /><br />Module files contain an associated symbol file that holds information needed by program units, subprograms, and interface bodies that <span style="font-weight: bold;">USE</span> that module. By default, it is assumed that these symbol files exist in the current directory. For libraries, this is typically not the case, and a path to these <span style="font-style: italic; font-weight: bold;">.mod</span> files must be specified.<br /><br />Typically compilers provide a method to specify the module path. The <i style="font-weight: bold;">-I</i><span style="font-weight: bold;"> </span>flag is intended for specifying the path to any include and/or module files. Some compilers provide a second flag <span style="font-style: italic; font-weight: bold;">-M </span>intended just for specifying the module files paths. The <i style="font-weight: bold;">-I</i> flag is the most common on across compilers. Some compilers, like <span style="color: rgb(0, 102, 0);">Absoft</span>, use -p instead, so check the compiler flag options for your compiler to be certain.<br /><br />The following example creates an executable called <i style="font-weight: bold;">myprogram</i>.<br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);"><span style="color: rgb(204, 102, 0);">$(FC)-o</span> <span style="color: rgb(0, 0, 0);">myprogram</span> myprogram.o -I<span style="color: rgb(0, 153, 0);">/mydirectory/mylibrary/mod </span>-L<span style="color: rgb(0, 153, 0);">/mydirectory/mylibrary/lib</span> -l<span style="color: rgb(0, 0, 153);">ftest</span></span><br /><br />The executable was created by linking the object file <i>myprogram.o</i> with the library <i>libftest.a</i> which lives in the directory <i><span style="font-weight: bold; color: rgb(0, 153, 0);">/mydirectory/mylibrary/lib</span> </i> and the corresponding module files which live <i style="font-weight: bold; color: rgb(0, 153, 0);">/mydirectory/mylibrary/mod</i>.<br /><br /><br />For further info see:<br /><br /><a href="http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html">YoLinux</a><br /><br /><a href="http://www.reading.ac.uk/CSC/Topic/Pgram/PgSWC+FP01/Workshop6/manuals/fortran/prog_guide/4_libraries.html">Fortran Programming guide: Libraries</a>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-90148485127168852992009-03-17T10:40:00.003-06:002009-03-20T10:10:00.801-06:00A brief introduction to building Fortran AppsWhile the <a href="http://en.wikipedia.org/wiki/Fortran">Fortran</a> programming language, developed by a team of computer scientists at IBM in the late 1950's, was the first high level language programming language, it has been largely superseded by C and C++ in fields of engineering, and Java and C# in commercial applications. The one place it retains significant use is in the research sciences where large amounts of legacy code is still in use and in computationally intensive tasks, such as weather and climate modeling, computational fluid dynamics, computational chemistry, computational economics, and computational physics.<br /><br />So lets talk about Fortran.<br /><br />The current language standard is up to 2003, although the majority of compilers only adhere to the 1990 or 1995 standards. The big break in the language occurred between the 1977 standard and what came after. The 1990+ standard was a significant modernization of the language which added vector operations, pointers, and derived types, among other changes, such as free-form source input and relaxed capitalization rules.<br /><br />Fortran source files can have a variety of possible suffixes (<span style="color: rgb(255, 0, 0);">.f<span style="color: rgb(0, 0, 0);">,</span> .F<span style="color: rgb(0, 0, 0);">,</span> .f77<span style="color: rgb(0, 0, 0);">,</span> .F77<span style="color: rgb(0, 0, 0);">,</span> .f95<span style="color: rgb(0, 0, 0);">,</span> .f90<span style="color: rgb(0, 0, 0);">,</span> .F90</span>, or <span style="color: rgb(255, 0, 0);">.F95</span>). The files with a capital suffix (<span style="color: rgb(255, 0, 0);">.F<span style="color: rgb(0, 0, 0);">,</span> F77<span style="color: rgb(0, 0, 0);">,</span> F95<span style="color: rgb(0, 0, 0);">, or</span> F90</span>) indicate that the source code should be preprocessed by the C preprocessor (<span style="color: rgb(0, 153, 0);">cpp</span>) before being compiled, otherwise the only difference between the suffixes is the adherence to a specific standard.<br /><br /><span style="font-weight: bold;font-size:130%;" >Compilation</span><br /><br />The source code compilation occurs in two steps<br /><br /><ol><li>First the source code is compiled using the Fortran compiler <span style="color: rgb(0, 153, 0);">$(FC)</span> to create the object files (<span style="color: rgb(255, 0, 0);">*.o</span>). These files consist of binary code and data for a source file.<br /></li><li>Next, the object files are linked. Linkers combine multiple object files along with along with any external objects such as libraries. The linking stage, called transparently by the compiler, calls the linker <span style="color: rgb(0, 153, 0);">ld</span> command.</li><li>Lastly, the loader , and loads everything into memory.</li></ol>With modern compilers, all of these steps happen implicitly when the user runs the compiler.<br /><br />The most basic build command looks like this:<br /><br /><span style="color: rgb(0, 153, 0);">$(FC)</span> <span style="color: rgb(255, 0, 0);">myprogram.f</span> <span style="font-weight: bold;"> -o</span> <span style="font-weight: bold; color: rgb(51, 51, 255);">myprogram.exe</span><br /><br />It builds the executable <span style="font-weight: bold; color: rgb(51, 51, 255);">myprogram.exe</span> from the source <span style="color: rgb(255, 0, 0);">myprogram.f</span>. The <span style="font-weight: bold;">-o</span> flag indicates the name of the executable. If omitted, the default name is <span style="font-weight: bold; color: rgb(51, 51, 255);">a.out</span>.<br /><br />Next, suppose you have a c code and want to link to the math library<span style="color: rgb(255, 102, 0);"> libm.a</span>. Because the math library is the library path variable you only need to indicate the name of the library with the lowercase <span style="font-weight: bold;">-l</span> flag such as<br /><br /><span style="color: rgb(0, 153, 0);">$(CC)</span> -o <span style="font-weight: bold; color: rgb(51, 51, 255);">myprogram.exe</span> <span style="font-weight: bold;">-l</span><span style="color: rgb(255, 102, 0);">m</span> <span style="color: rgb(255, 0, 0);">myprogram.c</span><br /><br />Note that the prefix <span style="color: rgb(204, 102, 0);">lib</span> and suffix <span style="color: rgb(204, 102, 0);">.a</span> are not included when the library is named. Also note that there are no spaces between the lowercase <span style="font-weight: bold;">-l</span> flag and the library name.<br /><br />Suppose now that the library is not part of the system libraries, such as the netcdf IO libraries. In this case it is necessary to tell the compiler where to find this library. This is done with the uppercase <span style="font-weight: bold;">-L</span> library path flag.<br /><br /><span style="color: rgb(0, 153, 0);">$(FC)</span> <span style="font-weight: bold;">-o <span style="color: rgb(51, 51, 255);">myprogram.exe</span></span> <span style="color: rgb(255, 0, 0);">myprogram.F</span> <span style="font-weight: bold;">-L</span><span style="color: rgb(255, 102, 0);">/mylibrarypath/lib</span> <span style="font-weight: bold;">-l</span><span style="color: rgb(255, 102, 0);">netcdf</span><br /><br />Because the name of the source code is followed by capital <span style="color: rgb(255, 0, 0);">.F</span> suffix, the source code was preprocessed using CPP processor before compiling.<br /><br />This build looks for the library <span style="color: rgb(255, 102, 0);">libnetcdf.a</span> in the directory <span style="color: rgb(255, 102, 0);">/mylibrarypath/lib</span>. If the linker finds the library, the build succeeds. If the linker cannot find the library, or the indicated library does not contain the library element or <span style="font-style: italic; font-weight: bold;">symbol</span> being called, the linker will give you a message roughly saying that you have <span style="font-style: italic; font-weight: bold;">unresolved</span> or <span style="font-style: italic; font-weight: bold;">undefined symbols</span>. (See the blog entry on linking and loading for more information on that).<br /><br />To compile a source file without creating the executable, thus only creating the object file, use the <span style="font-weight: bold;">-c</span> flag. Suppose there is a second file called <span style="color: rgb(255, 0, 0);">utility.f</span>, to just produce its object file use<br /><br /><span style="color: rgb(0, 153, 0);">$(FC)</span><span style="font-weight: bold;"> -c</span> <span style="color: rgb(255, 0, 0);">utility.f</span><br /><br />Now that we have the object file for <span style="color: rgb(255, 0, 0);">utility.f</span>, we can build the executable <span style="font-weight: bold; color: rgb(51, 51, 255);">myprogram.exe</span> by linking to <span style="color: rgb(255, 0, 0);"> utility.o</span> with the command<br /><br /><span style="color: rgb(0, 153, 0);">$(FC)</span> <span style="font-weight: bold;">-o</span> <span style="font-weight: bold; color: rgb(51, 51, 255);">myprogram.exe</span> <span style="color: rgb(255, 0, 0);"> myprogram.F</span> <span style="color: rgb(255, 0, 0);">utility.o</span> <span style="font-weight: bold;">-L</span><span style="color: rgb(255, 102, 0);">/mylibrarypath/lib</span> <span style="font-weight: bold;">-l</span><span style="color: rgb(255, 102, 0);">netcdf</span><br /><br />or if there are multiple files to link, use a wild card to represent the other object files.<br /><br /><span style="color: rgb(0, 153, 0);">$(FC)</span> <span style="font-weight: bold;">-o</span> <span style="font-weight: bold; color: rgb(51, 51, 255);">myprogram.exe</span> <span style="color: rgb(255, 0, 0);">myprogram.F</span> <span style="color: rgb(255, 0, 0);">*.o</span> -<span style="font-weight: bold;">L</span><span style="color: rgb(255, 102, 0);">/mylibrarypath/lib</span> <span style="font-weight: bold;">-l</span><span style="color: rgb(255, 102, 0);">netcdf</span>Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0tag:blogger.com,1999:blog-7753872494031878066.post-58774065075791566272009-03-15T16:41:00.000-06:002009-03-18T20:34:12.777-06:00New BlogHi,<br />this is a new blog for 2009. Its creation was motivated by a discussion I had with a colleague last week. He was helping me figure out why I was unable to link my main program to a library I had just created. And as he rattled off a series of things to try, I asked how he'd learned all this, since I've never seen a book discussing this particular topic. He answered that he'd just picked up these tips over time, and he's written them all down with the idea of writing a book when he has the free time. We both laughed at the concept of his having any free time with four kids at home and his being the lead on his project.<br /><br />So this blog is intended to be my attempt at something like that book that he'll never write. Its goal is to discuss topics related to computationally intensive computing, parallel programming, numerical algorithms, computer hardware, work flow tips, and visualization.<br /><br />I'm hoping along the way to get contributions from others. We'll see what happens.Kelly the little black doghttp://www.blogger.com/profile/15056007606676004685noreply@blogger.com0