srun --ntasks=32 --ntasks-per-node=16 --time=00:30:00 --partition=express --pty bash
Sharing Snippets
Tips, tricks, and codes that I use to make my time on a computer more efficient.
Monday, February 29, 2016
Running interactive job with SLURM
Tuesday, December 15, 2015
Profiling Code on Mac
- With the gnu compile suite, compile your code with the -g flag (this isn't necessary but provides a better profiling experience and you get timing down to individual lines of code)
- Open Instruments
- Select Time Profiler
- At the top by the red circle and pause button, select Choose target and select your code. Provide a working directory and inputs as desired/needed.
- Click the red circle to begin profiling.
- At the bottom you should see the Call Tree filing up
- Double click on any item in the Call Tree to get more information
Wednesday, May 7, 2014
Compiling VisIt on Cluster
./build_visit2_12_3 --hdf5 --szip --silo --parallel --qt5 --console --prefix /home/msu/mowkes/opt/visit2_7_2
The build_visit script is available from https://wci.llnl.gov/codes/visit/source.html. Additional options are provided by running ./build_visit -h or visiting http://www.visitusers.org/index.php?title=Build_visit_overview
Monday, December 30, 2013
Improving workflow: Zotero & Latex
I use Zotero as my reference manager. I've tried others including the popular Mendeley program but find Zotero's import feature the easiest to use and Zotero meets my needs well.
There are a couple of add-ons that I recently added to Zotero to improve my workflow when adding and using references in Latex documents. The first keeps the bibtex file automatically updated whenever changes are made to your Zotero library. To do this install Zotero automatic export from rokdd.de/permanent:zotero-autoexporting
The second allows for cite-keys (e.g. \cite{smith_fluids_1987}) to be either copied and pasted or dragged and dropped directly into your favorite text editor. To do this I followed directions from this forum by Kramer. The add-on works by adding an additional export format to Zotero.
Copy the code from http://pastebin.com/GXmCJevn and save it in a file called BibtexCiteKeyOnly.js within the translators folder in your zotero. If you don't know where your zotero folder is you can find it by going to Zotero Preferences, Advanced, and clicking on Show Data Directory. Once you restart Zotero (or Firefox) enable the export mode by going to Zotero Preferences, Export, and choosing BibTeX-CITEP. You should now be able to drag a reference (or multiple references) into your text editor and get the citekey. Or you can copy the citekey using Cmd+Shift+C and paste it using Cmd+V.
Thursday, April 11, 2013
Start iPython notebook with inline plotting
ipython notebook --pylab inline
Friday, April 5, 2013
Mount filesystem using ssh
mkdir mountpoint
sshfs -o follow_symlinks hostname: mountpoint/
where hostname is what you use to ssh into the remote computer (e.g. name@computer.gov)
Saturday, March 30, 2013
Compliing and using LLNL Silo on Mac OS X and linking Fortran program
./configure --prefix=/opt/hdf5
make
make install
Download szip, uncompress and then install using
./configure --prefix=/opt/szip
make
make install
Download (silo), uncompress, then install using
./configure --enable-fortran --with-hdf5=/opt/hdf5/include/,/opt/hdf5/lib --with-szlib=/opt/szip/ --prefix=/opt/silo/ --disable-silex
make
make install
You should find the silo libraries in /opt/silo/lib. To make sure you have the fortran routines you can run in /opt/silo/lib
nm libsiloh5.a | grep dbcreate
which should show
00000000000039f0 T _dbcreate_ <==== this shows you have the fortran routines
0000000000019078 S _dbcreate_.eh
To compile a program that uses silo.h run a command similar to
gfortran -I /opt/silo/include/ -L /opt/silo/lib/ -L /opt/hdf5/lib/ -L /opt/szip/lib/ -o fbasic fbasic.f -lsiloh5 -lhdf5 -lsz -lz -lstdc++
that compiles fbasic.f, which is an example program provided by LLNL (see below)
fbasic.f
c-----------------------------------------------------------------------------
c
c Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
c Produced at the Lawrence Livermore National Laboratory
c LLNL-CODE-400142
c All rights reserved.
c
c This file is part of VisIt. For details, see https://visit.llnl.gov/. The
c full copyright notice is contained in the file COPYRIGHT located at the root
c of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
c
c Redistribution and use in source and binary forms, with or without
c modification, are permitted provided that the following conditions are met:
c
c - Redistributions of source code must retain the above copyright notice,
c this list of conditions and the disclaimer below.
c - Redistributions in binary form must reproduce the above copyright notice,
c this list of conditions and the disclaimer (as noted below) in the
c documentation and/or other materials provided with the distribution.
c - Neither the name of the LLNS/LLNL nor the names of its contributors may
c be used to endorse or promote products derived from this software without
c specific prior written permission.
c
c THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
c AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
c ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
c LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
c DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
c SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
c CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
c DAMAGE.
c
c-----------------------------------------------------------------------------
program main
implicit none
include "silo.inc"
integer dbfile, ierr
c The 11 and 22 arguments represent the lengths of strings
ierr = dbcreate("fbasic.silo", 11, DB_CLOBBER, DB_LOCAL,
. "Comment about the data", 22, DB_HDF5, dbfile)
if(dbfile.eq.-1) then
write (6,*) 'Could not create Silo file!\n'
goto 10000
endif
c Add other Silo calls here.
c Close the Silo file.
ierr = dbclose(dbfile)
10000 stop
end