<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://fluid.colorado.edu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matthb2</id>
		<title>PHASTA Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://fluid.colorado.edu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matthb2"/>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php/Special:Contributions/Matthb2"/>
		<updated>2026-04-20T18:39:23Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Main_Page&amp;diff=848</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Main_Page&amp;diff=848"/>
				<updated>2020-09-02T21:55:04Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the Wiki for the [https://github.com/phasta/phasta PHASTA] project at the University of Colorado, Boulder. The information contained within is mostly systems documentation and usage information for software which may or may not be public yet, but feel free to look around. &lt;br /&gt;
&lt;br /&gt;
[[Special:AllPages|List Of All Pages]]&lt;br /&gt;
&lt;br /&gt;
[[Tutorial Video Overviews]]&lt;br /&gt;
&lt;br /&gt;
[[:Category:Software|Available Software]]&lt;br /&gt;
&lt;br /&gt;
[[:Category:Software Engineering|Software Engineering]]&lt;br /&gt;
&lt;br /&gt;
[[UNIX|Getting Started with UNIX]]&lt;br /&gt;
&lt;br /&gt;
[[:Category:Post-processing|Post-processing and Visualization]]&lt;br /&gt;
&lt;br /&gt;
[[Making_A_New_Wiki|Making A New Wiki Page]]&lt;br /&gt;
&lt;br /&gt;
[[:Special:Categories]]&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=TotalView&amp;diff=500</id>
		<title>TotalView</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=TotalView&amp;diff=500"/>
				<updated>2014-05-02T22:47:18Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We currently have an evaluation license of the TotalView graphical/parallel debugger. Please give it a try and let Ben know if you have any problems &lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
  soft add +totalview-8.13.0&lt;br /&gt;
  mpirun -tv -np 1 your_program&lt;br /&gt;
&lt;br /&gt;
==ReplayEngine/Reverse Debugging==&lt;br /&gt;
&lt;br /&gt;
  mpirun -mca mpool_rdma_rcache_size_limit 1 -x IBV_FORK_SAFE=1 -x LD_PRELOAD=/usr/local/toolworks/totalview.8.13.0-0/linux-x86-64/lib/undodb_infiniband_preload_x64.so -tv -np 1 your_program&lt;br /&gt;
&lt;br /&gt;
(see the TotalView user's guide for more information)&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
http://www.roguewave.com/support/product-documentation/totalview.aspx&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=TotalView&amp;diff=499</id>
		<title>TotalView</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=TotalView&amp;diff=499"/>
				<updated>2014-05-02T22:34:48Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: Created page with &amp;quot;We currently have an evaluation license of the TotalView graphical/parallel debugger. Please give it a try and let Ben know if you have any problems   ==Running==   soft add +tot...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We currently have an evaluation license of the TotalView graphical/parallel debugger. Please give it a try and let Ben know if you have any problems &lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
  soft add +totalview-8.13.0&lt;br /&gt;
  mpirun -tv -np 1 your_program&lt;br /&gt;
&lt;br /&gt;
==ReplayEngine/Reverse Debugging==&lt;br /&gt;
&lt;br /&gt;
  mpirun -mca mpool_rdma_rcache_size_limit 1 -x IBV_FORK_SAFE=1 -x LD_PRELOAD=/usr/local/toolworks/totalview.8.13.0-0/linux-x86-64/lib/undodb_infiniband_preload_x64.so -tv -np 1 your_program&lt;br /&gt;
&lt;br /&gt;
(see the TotalView user's guide for more information)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=498</id>
		<title>Mtrace</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=498"/>
				<updated>2014-05-01T22:28:02Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you suspect that you have a memory leak, it is possible to get libc to log heap allocations to a text file using the &amp;quot;mtrace&amp;quot; call. &lt;br /&gt;
&lt;br /&gt;
== Serial ==&lt;br /&gt;
&lt;br /&gt;
At it's simplest, to use mtrace you need to get your code to call the mtrace() function from the &amp;quot;mcheck.h&amp;quot; header as near to the beginning of execution as possible (or if you suspect you know where the leak is, right before the leak). &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int x, char** y) { mtrace(); return(0); }&lt;br /&gt;
&lt;br /&gt;
Then, prior to running your program, you must set the &amp;quot;MALLOC_TRACE&amp;quot; environment variable to the name of the file you'd like mtrace() to write it's information to.&lt;br /&gt;
&lt;br /&gt;
  export MALLOC_TRACE=memory_allocations.dat&lt;br /&gt;
  ./a.out&lt;br /&gt;
&lt;br /&gt;
Once you get the output, you can use the &amp;quot;mtrace&amp;quot; script to post process the results and try to tell you where any leaked memory was allocated&lt;br /&gt;
&lt;br /&gt;
  mtrace ./a.out ./memory_allocations.dat&lt;br /&gt;
&lt;br /&gt;
== Parallel ==&lt;br /&gt;
&lt;br /&gt;
Using mtrace() in parallel is similar to serial, but you need to ensure that each process gets a different value for MALLOC_TRACE&lt;br /&gt;
You may be able to do this by passing options to mpirun, but it's probably simpler to write some code to do this:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int argc, char** argv) &lt;br /&gt;
  {&lt;br /&gt;
     int rank;&lt;br /&gt;
     char* tracepath&lt;br /&gt;
     char* cwd = get_current_dir_name();&lt;br /&gt;
     MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
     MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
     asprintf(&amp;amp;tracepath, &amp;quot;%s/mtrace.dat.%d&amp;quot;, cwd, rank);&lt;br /&gt;
     setenv(&amp;quot;MALLOC_TRACE&amp;quot;, tracepath, 1);&lt;br /&gt;
     mtrace()&lt;br /&gt;
     /*....*/&lt;br /&gt;
     MPI_Finalize();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
With this code applied, you can then simply run your program normally and analyze the results as before:&lt;br /&gt;
&lt;br /&gt;
  mpirun -np 8 ./a.out&lt;br /&gt;
  mtrace ./a.out mtrace.dat.0&lt;br /&gt;
  mtrace ./a.out mtrace.dat.1&lt;br /&gt;
  #...&lt;br /&gt;
&lt;br /&gt;
In PHASTA, you should probably put this code in common/phasta.cc&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=484</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=484"/>
				<updated>2014-04-07T20:53:33Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:  '''WARNING: The Intel compilers on the viz nodes are outdated and broken. They are maintained only for use with MKL. If you need the Intel toolchain please talk to Ken and/or Ben'''&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the Clang toolchain for C and C++:&lt;br /&gt;
&lt;br /&gt;
  CC=clang CXX=clang++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake -- see below)&lt;br /&gt;
&lt;br /&gt;
Kitware has some documentation on cross compiling with CMake [[http://www.cmake.org/Wiki/CMake_Cross_Compiling here]].&lt;br /&gt;
&lt;br /&gt;
Also ensure that the MPI wrappers for the target platform are in your PATH (on mira: &amp;quot;soft add +mpiwrapper-xl&amp;quot;, q.ccni: &amp;quot;module load xl&amp;quot;) or specified explicitly in your toolchain file.&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling on IBM's BlueGene/Q ==&lt;br /&gt;
&lt;br /&gt;
Currently, CMake doesn't officially have explicit support for BlueGene/Q (BlueGene/P is supported). While you should be able to use a toolchain file expecting one of the generic system types, we've modified the BG/P platform files for /Q, based on the setup used on [[http://alcf.anl.gov ALCF's]] systems (should work with most /Q systems). To use them, you need to add two files [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-base.cmake 1]] [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-static.cmake 2]] to your CMake install. For a normal install, these files should be placed in $prefix/share/cmake-2.8/Modules/Platform/&lt;br /&gt;
&lt;br /&gt;
If you prefer, you can just directly install the &amp;quot;bgq&amp;quot; branch of [[https://github.com/matthb2/CMake/tree/bgq this repository]]&lt;br /&gt;
&lt;br /&gt;
  git clone https://github.com/matthb2/CMake.git&lt;br /&gt;
  git checkout -b bgq origin/bgq&lt;br /&gt;
  cd CMake&lt;br /&gt;
  ./configure --prefix=/some/path&lt;br /&gt;
  make&lt;br /&gt;
  make install&lt;br /&gt;
  export PATH=/some/path:$PATH&lt;br /&gt;
&lt;br /&gt;
You can then proceed as above, using [[https://raw.github.com/matthb2/CMakeToolchainFiles/master/BlueGene/Q/BGQ-XLMPI-toolchain.cmake this toolchain file]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Currently, the system software is changing very quickly. If you need a build of the proprietary library used for PHASTA's incompressible solver, please ask Ben or Michel (and tell them which Bluegene driver version you have)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
(gnu compilers)&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=460</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=460"/>
				<updated>2013-12-11T23:03:54Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Cross Compiling with CMake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the Clang toolchain for C and C++:&lt;br /&gt;
&lt;br /&gt;
  CC=clang CXX=clang++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake -- see below)&lt;br /&gt;
&lt;br /&gt;
Kitware has some documentation on cross compiling with CMake [[http://www.cmake.org/Wiki/CMake_Cross_Compiling here]].&lt;br /&gt;
&lt;br /&gt;
Also ensure that the MPI wrappers for the target platform are in your PATH (on mira: &amp;quot;soft add +mpiwrapper-xl&amp;quot;, q.ccni: &amp;quot;module load xl&amp;quot;) or specified explicitly in your toolchain file.&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling on IBM's BlueGene/Q ==&lt;br /&gt;
&lt;br /&gt;
Currently, CMake doesn't officially have explicit support for BlueGene/Q (BlueGene/P is supported). While you should be able to use a toolchain file expecting one of the generic system types, we've modified the BG/P platform files for /Q, based on the setup used on [[http://alcf.anl.gov ALCF's]] systems (should work with most /Q systems). To use them, you need to add two files [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-base.cmake 1]] [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-static.cmake 2]] to your CMake install. For a normal install, these files should be placed in $prefix/share/cmake-2.8/Modules/Platform/&lt;br /&gt;
&lt;br /&gt;
If you prefer, you can just directly install the &amp;quot;bgq&amp;quot; branch of [[https://github.com/matthb2/CMake/tree/bgq this repository]]&lt;br /&gt;
&lt;br /&gt;
  git clone https://github.com/matthb2/CMake.git&lt;br /&gt;
  git checkout -b bgq origin/bgq&lt;br /&gt;
  cd CMake&lt;br /&gt;
  ./configure --prefix=/some/path&lt;br /&gt;
  make&lt;br /&gt;
  make install&lt;br /&gt;
  export PATH=/some/path:$PATH&lt;br /&gt;
&lt;br /&gt;
You can then proceed as above, using [[https://raw.github.com/matthb2/CMakeToolchainFiles/master/BlueGene/Q/BGQ-XLMPI-toolchain.cmake this toolchain file]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Currently, the system software is changing very quickly. If you need a build of the proprietary library used for PHASTA's incompressible solver, please ask Ben or Michel (and tell them which Bluegene driver version you have)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
(gnu compilers)&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Address_Sanitizer&amp;diff=382</id>
		<title>Address Sanitizer</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Address_Sanitizer&amp;diff=382"/>
				<updated>2013-07-19T20:13:02Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software Engineering]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Address sanitizer is a compiler extension and runtime library used for debugging memory errors. It works by introducing extra &amp;quot;canary&amp;quot; regions around memory allocated by your program, and checks for accesses to those regions. This allows it to detect when your program accesses memory that has not been properly allocated. You can read more about how address sanitizer works [[https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm here]]&lt;br /&gt;
&lt;br /&gt;
== Use ==&lt;br /&gt;
Address sanitizer is available in newer versions of GCC (&amp;gt;= 4.8.0) and Clang (&amp;gt;=3.0?). On the Viz nodes, you'll want to use GCC.&lt;br /&gt;
&lt;br /&gt;
First, load GCC 4.8&lt;br /&gt;
&lt;br /&gt;
  soft add +gcc-4.8.1&lt;br /&gt;
&lt;br /&gt;
Then compile your code using appropriate flags. If you're using CMake, you'll want to set the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS variables (these are &amp;quot;advanced&amp;quot; - you'll need to press the &amp;quot;t&amp;quot; key in ccmake to see them)&lt;br /&gt;
&lt;br /&gt;
  gcc -fsanitize=address -O0 -fno-omit-frame-pointer -g test.c&lt;br /&gt;
&lt;br /&gt;
Next run your program normally. If it runs to completion, congratulations, it's likely you don't have any bad accesses. Otherwise, your program will crash and print a couple pages of information. You can use this output to find the problem (the &amp;quot;addr2line&amp;quot; command may be helpful). An easier way is to use gdb:&lt;br /&gt;
&lt;br /&gt;
In serial:&lt;br /&gt;
  gdb my_program&lt;br /&gt;
  break __asan_report_error&lt;br /&gt;
  run&lt;br /&gt;
&lt;br /&gt;
At which point, your program should stop and return you to a gdb prompt right after the bad access occurs. you can use the &lt;br /&gt;
  bt&lt;br /&gt;
command to see where the code stopped and debug as you normally would with gdb. &lt;br /&gt;
&lt;br /&gt;
In parallel, the procedure is basically the same, but you'll need to use multiple copies of gdb (or a parallel debugger if you're using a system on which one is available). See the [[Debugging]] page for more information on using gdb in parallel.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
[[https://code.google.com/p/address-sanitizer/wiki/Flags Additional Options]]&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=OpenACC&amp;diff=377</id>
		<title>OpenACC</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=OpenACC&amp;diff=377"/>
				<updated>2013-07-15T21:22:08Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: Created page with &amp;quot;OpenACC is is a compiler extension which allows you to annotate your code such that the compiler can generate GPU accelerated binaries. The PGI compiler available on the viz node...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OpenACC is is a compiler extension which allows you to annotate your code such that the compiler can generate GPU accelerated binaries. The PGI compiler available on the viz nodes supports OpenACC and can generate code for the viz node's GPUs. &lt;br /&gt;
&lt;br /&gt;
== Use ==&lt;br /&gt;
&lt;br /&gt;
Currently, CUDA requires &amp;lt;= gcc 4.6, so you'll need to&lt;br /&gt;
&lt;br /&gt;
  soft add +gcc-4.6&lt;br /&gt;
  soft add +pgi-64bit&lt;br /&gt;
&lt;br /&gt;
Then you can compile your annotated code &lt;br /&gt;
&lt;br /&gt;
  pgfortran -acc -Minfo=acc -o gputest test.f&lt;br /&gt;
  pgfortran -O3 -o cputest test.f&lt;br /&gt;
  time ./gputest&lt;br /&gt;
  time ./cputest&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Debugging&amp;diff=376</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Debugging&amp;diff=376"/>
				<updated>2013-07-15T20:40:46Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software Engineering]]&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
Debugging can be a very difficult skill to learn.  It requires patience, persistence and determination but it can certainly be aided by skills and tips gained from hard earned experience.  &lt;br /&gt;
&lt;br /&gt;
The goal of this wiki is to organize our groups experience with debugging in general and specific tips for debugging our software.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''General''' ==&lt;br /&gt;
&lt;br /&gt;
There are broadly three types of bugs that we encounter: 1) wrong results,  2) segmentation fault,  and 3) trapped unexpected behavior.  These are ordered in decreasing difficulty as will be clear shortly.&lt;br /&gt;
&lt;br /&gt;
''Wrong results:''  A lack of convergence or slow divergence of a problems that is expected or known to work with the given inputs  is not uncommon for code development but it is far and away the hardest bug to find.  The most effective strategy here is usually to compare against a working code that does not exhibit this behavior and be sure that all of the &amp;quot;deviations&amp;quot; from the known working code are expected.&lt;br /&gt;
&lt;br /&gt;
''Segmentation fault:''  Here, there is typically a corruption of memory such as an array going out of bounds,  Many of the debuggers mentioned below will stop at the location of the segmentation fault but be aware that this is not necessarily the location of the bug.  In many cases, memory corruption occurred in a non-fatal way at some early stage of the code and the place the code reports the segmentation fault is were the &amp;quot;dead body&amp;quot; is found and you must look at the corrupted array and look backward to see where it was modified which may lead to other arrays that were incorrectly modified etc.  This is especially true with indirect addressing arrays and memory pointers.  You should expect the compiling in debug mode will &amp;quot;move&amp;quot; the problem to a different location and, sadly in some situations, completely hide the problem (e.g., runs through successfully).  This is because when a code is compiled in debug mode, extra &amp;quot;padding&amp;quot; is put into the code to track the variables and you may be corrupting only this padding and not vital code.  '''''[http://fluid.colorado.edu/wiki/index.php/Valgrind Valgrind]''''' (someone provide a wiki tutorial on its use please) can be very effective in finding this type of bug.  This type of fault can also occur when you run out of memory for the machine you are running on.  Please use '''''top''''' while your job is running to check for this type of failure.&lt;br /&gt;
&lt;br /&gt;
''Trapped unexpected behavior:''  Here checks were placed in the code to stop or report some information when execution led to an unexpected result (e.g., a negative volume computation or a residual that is not a number).  In general we like to put these kind of things in our code to make debugging easier but there is always a tradeoff between the time it takes to instrument the code, the effect the checks have on performance, and the benefit to debugging.  One compromise that is often employed is to put these checks inside of a compiler flag so that they are compiled in ONLY when running in debug mode.  '''MAJOR TIP:  When a code crashes ALWAYS recompile it in debug mode and rerun it as you may then get more information about where the bug is (e.g., go from Seg Fault to Trapped unexpected behavior).'''&lt;br /&gt;
&lt;br /&gt;
== '''Choice of Debugger''' ==&lt;br /&gt;
&lt;br /&gt;
The first choice is what tool to debug with.  Your weapons range from graphical debuggers like '''''totalview''''' and '''''idb''''', to command line debuggers like '''''gdb''''', to print statements.  Different bugs/codes are handled best by different tools.&lt;br /&gt;
Launching and effectively getting help and/or running graphical debuggers are covered in separate wikis linked to the names in the list.  Here we only give a general overview of some experience (grow it!!) with each.&lt;br /&gt;
&lt;br /&gt;
''Graphical debuggers'' are best for marching through the code.  They can really help a new user learn the flow of the code and see various arrays being changed.  Any code that you want to have mastery of is worth spending time marching through the code in this way. Graphical debuggers are also effective at determining the location of bugs.&lt;br /&gt;
&lt;br /&gt;
''Command line debuggers''  link to gdb....some comments on when they are effective&lt;br /&gt;
&lt;br /&gt;
''Print  statements''  When you don't have effective access to the two above, inserting print statements can be an effective way of finding a bug.  It is more effective the more you know about your bug (e.g., when you know pretty close to where in the code the problem is and what variable is going bad).  Included in this category is writing out entire fields in a format that our post-processors can read so that you can look at the whole field in something like '''''paraview''''' that may give you a clue as to where the problem of the category &amp;quot;Wrong results&amp;quot; might be occurring.&lt;br /&gt;
&lt;br /&gt;
== '''Debugging Strategies''' ==&lt;br /&gt;
&lt;br /&gt;
''Recursive bisection:''  When you know where the code fails (or is producing wrong results) but don't have much of a clue where and why, this can be a good strategy.  What you need is some measure of correctness of some variable you can watch. Your strategy here is to first define the location in the code where it is believed to be correct and a second location where it is believed to be wrong. Then you bisect the code and check the middle location and determine if it is correct or wrong and then replace either the first or second location based on your answer (replace correct or wrong).  Keep applying this recursively and eventually you have a small section of code to find your bug in (e.g., one line).  This works extremely well for some bugs but it does have a few difficult assumptions that don't always hold true:  1) you know what is correct and wrong,  2) you know how to bisect your code (this can be hard before you actually know the code you are working with pretty well),  3) you are able to track a single variable through a function stack (not always possible) and/or know the code well enough to switch targets (and adjust measure of correctness).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''March (and compare):'' Marching in a debugger is tedious and many think it is boring but if you get your mind in the right place you can learn a lot about the code while you are marching (tell yourself you are not wasting time finding a bug but using the debugger to better learn the code).  As above, this strategy is more effective the better you know how to differentiate a correct result from and incorrect result on each &amp;quot;line&amp;quot; of the code, something that experience improves. This is where &amp;quot;compare&amp;quot; is a powerful tool for beginners (and everyone else).  Your ideal scenario is that you have a version of the code saved that was working when you started your development.  Before you start, make that working source code directory not writable ( chmod u-w * ).  You then make two directories with your inputs and  launch two versions of the debugger in each of these directories, one with the correct executable and one with the broken executable.  You then march through the code looking for differences.  Of course if you meet the requirements of Recursive bisection you can apply it to both codes and combine these strategies but when you don't, marching line by line and comparing results can often be effective (and you will in the process learn the code well AND likely develop the understanding of correctness required to use recursive bisection).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Specific tips for SCOREC/Simmetrix Meshing and MeshAdapt software and associated databases:'' &lt;br /&gt;
Because the mesh database is very rich and complex it can often be non-transparent to debugging.  To address this issues, functions have been created to help users debug.  If your debugging has identified a location and you  have successfully trapped the offending vertex, face, or region (typically you are iterating over one of these when some unexpected result occurs and is trapped), then you can call a function to get lots of information about that entity with&lt;br /&gt;
&lt;br /&gt;
 V_info(ivert)    // gives information about the the vertex  ivert&lt;br /&gt;
 F_info(iface)    // gives information about the the face  iface&lt;br /&gt;
 R_info(iregion)    // gives information about the the region  iregion&lt;br /&gt;
&lt;br /&gt;
These functions can either be compiled into the code and printed from traps that catch the unexpected behavior (and thereby help you understand the geometric location of the problem) or, with many debuggers, they can be called from the current command line to give you more information while stepping through the code.&lt;br /&gt;
&lt;br /&gt;
Once you find the offending geometric location, it is often possible to load the mesh (in cases where the mesher completed but some other program downstream of it fails) in paraview and draw  spheres at the location of the vertices, zoom to the vertices, cut the mesh with'' extract cells by region'' filter centered on the bad location and then see what is wrong (perhaps using a few different normal planes to get a clear view).  Often refining the mesh near this surface will improve element quality and fix the problem.&lt;br /&gt;
&lt;br /&gt;
ADD TO ME&lt;br /&gt;
&lt;br /&gt;
''Specific tips for PHASTA:'' &lt;br /&gt;
ADD TO ME&lt;br /&gt;
&lt;br /&gt;
== '''Debugging in parallel with GDB''' ==&lt;br /&gt;
&lt;br /&gt;
A useful command to debug a parallel job running with a low number of processes on the viz nodes at Colorado is the following:&lt;br /&gt;
&lt;br /&gt;
  mpirun -np &amp;lt;np&amp;gt; gnome-terminal --disable-factory -e 'gdb &amp;lt;exec name&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
This will open a terminal running gdb for every process of your application. You can then execute in every terminal the usual gdb commands.&lt;br /&gt;
&lt;br /&gt;
In particular, for PHASTA, you can also type in your terminal&lt;br /&gt;
 &lt;br /&gt;
  set catchDebugger=1&lt;br /&gt;
  mpirun -np &amp;lt;np&amp;gt; &amp;lt;phasta exec name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No need in this case to specify any additional arguments to the mpi command.  it will launch debug windows automatically for you. Every instance of PHASTA gets trapped in an infinite loop in common/phasta.cc (see routine catchDebugger()). To release PHASTA, you need for every process to pause the execution and then  &lt;br /&gt;
&lt;br /&gt;
  gdb&amp;gt; set debuggerPresent=1&lt;br /&gt;
&lt;br /&gt;
for every process/terminal.&lt;br /&gt;
&lt;br /&gt;
== Debugging Seg Faults == &lt;br /&gt;
Reading core files generated after a seg fault can be done with GDB using the command &lt;br /&gt;
&lt;br /&gt;
  gdb &amp;lt;phasta exec name&amp;gt; &amp;lt;path to core file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, there are a number of options including &amp;quot;disas&amp;quot; which shows the disassembly of the function where the seg fault occurred. Alternatively, it can be rather convenient to view the disassembly in vim or a vim like editor:&lt;br /&gt;
&lt;br /&gt;
  objdump -D &amp;lt;phasta exec name&amp;gt; | vim -&lt;br /&gt;
&lt;br /&gt;
== Other Useful Wiki Pages ==&lt;br /&gt;
[[Mtrace]] - Memory Leaks&lt;br /&gt;
&lt;br /&gt;
[[Address Sanitizer]] - Bad memory accesses&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=375</id>
		<title>Mtrace</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=375"/>
				<updated>2013-07-15T20:39:09Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you suspect that you have a memory leak, it is possible to get libc to log heap allocations to a text file using the &amp;quot;mtrace&amp;quot; call. &lt;br /&gt;
&lt;br /&gt;
== Serial ==&lt;br /&gt;
&lt;br /&gt;
At it's simplest, to use mtrace you need to get your code to call the mtrace() function from the &amp;quot;mcheck.h&amp;quot; header as near to the beginning of execution as possible (or if you suspect you know where the leak is, right before the leak). &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int x, char** y) { mtrace(); return(0); }&lt;br /&gt;
&lt;br /&gt;
Then, prior to running your program, you must set the &amp;quot;MALLOC_TRACE&amp;quot; environment variable to the name of the file you'd like mtrace() to write it's information to.&lt;br /&gt;
&lt;br /&gt;
  export MALLOC_TRACE=memory_allocations.dat&lt;br /&gt;
  ./a.out&lt;br /&gt;
&lt;br /&gt;
Once you get the output, you can use the &amp;quot;mtrace&amp;quot; script to post process the results and try to tell you where any leaked memory was allocated&lt;br /&gt;
&lt;br /&gt;
  mtrace ./a.out ./memory_allocations.dat&lt;br /&gt;
&lt;br /&gt;
== Parallel ==&lt;br /&gt;
&lt;br /&gt;
Using mtrace() in parallel is similar to serial, but you need to ensure that each process gets a different value for MALLOC_TRACE&lt;br /&gt;
You may be able to do this by passing options to mpirun, but it's probably simpler to write some code to do this:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int argc, char** argv) &lt;br /&gt;
  {&lt;br /&gt;
     int rank;&lt;br /&gt;
     char* tracepath&lt;br /&gt;
     char* cwd = get_current_dir_name();&lt;br /&gt;
     MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
     MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
     asprintf(&amp;amp;tracepath, &amp;quot;%s/mtrace.dat.%d&amp;quot;, cwd, rank);&lt;br /&gt;
     mtrace()&lt;br /&gt;
     /*....*/&lt;br /&gt;
     MPI_Finalize();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
With this code applied, you can then simply run your program normally and analyze the results as before:&lt;br /&gt;
&lt;br /&gt;
  mpirun -np 8 ./a.out&lt;br /&gt;
  mtrace ./a.out mtrace.dat.0&lt;br /&gt;
  mtrace ./a.out mtrace.dat.1&lt;br /&gt;
  #...&lt;br /&gt;
&lt;br /&gt;
In PHASTA, you should probably put this code in common/phasta.cc&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=374</id>
		<title>Mtrace</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=374"/>
				<updated>2013-07-15T20:38:20Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you suspect that you have a memory leak, it is possible to get libc to log heap allocations to a text file using the &amp;quot;mtrace&amp;quot; call. &lt;br /&gt;
&lt;br /&gt;
== Serial ==&lt;br /&gt;
&lt;br /&gt;
At it's simplest, to use mtrace you need to get your code to call the mtrace() function from the &amp;quot;mcheck.h&amp;quot; header as near to the beginning of execution as possible (or if you suspect you know where the leak is, right before the leak). &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int x, char** y) { mtrace(); return(0); }&lt;br /&gt;
&lt;br /&gt;
Then, prior to running your program, you must set the &amp;quot;MALLOC_TRACE&amp;quot; environment variable to the name of the file you'd like mtrace() to write it's information to.&lt;br /&gt;
&lt;br /&gt;
  export MALLOC_TRACE=memory_allocations.dat&lt;br /&gt;
  ./a.out&lt;br /&gt;
&lt;br /&gt;
Once you get the output, you can use the &amp;quot;mtrace&amp;quot; script to post process the results and try to tell you where any leaked memory was allocated&lt;br /&gt;
&lt;br /&gt;
  mtrace ./a.out ./memory_allocations.date&lt;br /&gt;
&lt;br /&gt;
== Parallel ==&lt;br /&gt;
&lt;br /&gt;
Using mtrace() in parallel is similar to serial, but you need to ensure that each process gets a different value for MALLOC_TRACE&lt;br /&gt;
You may be able to do this by passing options to mpirun, but it's probably simpler to write some code to do this:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int argc, char** argv) &lt;br /&gt;
  {&lt;br /&gt;
     int rank;&lt;br /&gt;
     char* tracepath&lt;br /&gt;
     char* cwd = get_current_dir_name();&lt;br /&gt;
     MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
     MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
     asprintf(&amp;amp;tracepath, &amp;quot;%s/mtrace.dat.%d&amp;quot;, cwd, rank);&lt;br /&gt;
     mtrace()&lt;br /&gt;
     /*....*/&lt;br /&gt;
     MPI_Finalize();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
With this code applied, you can then simply run your program normally and analyze the results as before:&lt;br /&gt;
&lt;br /&gt;
  mpirun -np 8 ./a.out&lt;br /&gt;
  mtrace ./a.out mtrace.dat.0&lt;br /&gt;
  mtrace ./a.out mtrace.dat.1&lt;br /&gt;
  #...&lt;br /&gt;
&lt;br /&gt;
In PHASTA, you should probably put this code in common/phasta.cc&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=373</id>
		<title>Mtrace</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=373"/>
				<updated>2013-07-15T20:34:21Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you suspect that you have a memory leak, it is possible to get libc to log heap allocations to a text file using the &amp;quot;mtrace&amp;quot; call. &lt;br /&gt;
&lt;br /&gt;
== Serial ==&lt;br /&gt;
&lt;br /&gt;
At it's simplest, to use mtrace you need to get your code to call the mtrace() function from the &amp;quot;mcheck.h&amp;quot; header as near to the beginning of execution as possible (or if you suspect you know where the leak is, right before the leak). &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int x, char** y) { mcheck(); return(0); }&lt;br /&gt;
&lt;br /&gt;
Then, prior to running your program, you must set the &amp;quot;MALLOC_TRACE&amp;quot; environment variable to the name of the file you'd like mtrace() to write it's information to.&lt;br /&gt;
&lt;br /&gt;
  export MALLOC_TRACE=memory_allocations.dat&lt;br /&gt;
  ./a.out&lt;br /&gt;
&lt;br /&gt;
Once you get the output, you can use the &amp;quot;mtrace&amp;quot; script to post process the results and try to tell you where any leaked memory was allocated&lt;br /&gt;
&lt;br /&gt;
  mtrace ./a.out ./memory_allocations.date&lt;br /&gt;
&lt;br /&gt;
== Parallel ==&lt;br /&gt;
&lt;br /&gt;
Using mtrace() in parallel is similar to serial, but you need to ensure that each process gets a different value for MALLOC_TRACE&lt;br /&gt;
You may be able to do this by passing options to mpirun, but it's probably simpler to write some code to do this:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int argc, char** argv) &lt;br /&gt;
  {&lt;br /&gt;
     int rank;&lt;br /&gt;
     char* tracepath&lt;br /&gt;
     char* cwd = get_current_dir_name();&lt;br /&gt;
     MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
     MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
     asprintf(&amp;amp;tracepath, &amp;quot;%s/mtrace.dat.%d&amp;quot;, cwd, rank);&lt;br /&gt;
     mtrace()&lt;br /&gt;
     /*....*/&lt;br /&gt;
     MPI_Finalize();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
With this code applied, you can then simply run your program normally and analyze the results as before:&lt;br /&gt;
&lt;br /&gt;
  mpirun -np 8 ./a.out&lt;br /&gt;
  mtrace ./a.out mtrace.dat.0&lt;br /&gt;
  mtrace ./a.out mtrace.dat.1&lt;br /&gt;
  #...&lt;br /&gt;
&lt;br /&gt;
In PHASTA, you should probably put this code in common/phasta.cc&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=372</id>
		<title>Mtrace</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Mtrace&amp;diff=372"/>
				<updated>2013-07-15T20:33:31Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: Created page with &amp;quot;If you suspect that you have a memory leak, it is possible to get libc to log heap allocations to a text file using the &amp;quot;mtrace&amp;quot; call.   == Serial ==  At it's simplest, to use mt...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you suspect that you have a memory leak, it is possible to get libc to log heap allocations to a text file using the &amp;quot;mtrace&amp;quot; call. &lt;br /&gt;
&lt;br /&gt;
== Serial ==&lt;br /&gt;
&lt;br /&gt;
At it's simplest, to use mtrace you need to get your code to call the mtrace() function from the &amp;quot;mcheck.h&amp;quot; header as near to the beginning of execution as possible (or if you suspect you know where the leak is, right before the leak). &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int x, char** y) { mcheck(); return(0); }&lt;br /&gt;
&lt;br /&gt;
Then, prior to running your program, you must set the &amp;quot;MALLOC_TRACE&amp;quot; environment variable to the name of the file you'd like mtrace() to write it's information to.&lt;br /&gt;
&lt;br /&gt;
  export MALLOC_TRACE=memory_allocations.dat&lt;br /&gt;
  ./a.out&lt;br /&gt;
&lt;br /&gt;
Once you get the output, you can use the &amp;quot;mtrace&amp;quot; script to post process the results and try to tell you where any leaked memory was allocated&lt;br /&gt;
&lt;br /&gt;
  mtrace ./a.out ./memory_allocations.date&lt;br /&gt;
&lt;br /&gt;
== Parallel ==&lt;br /&gt;
&lt;br /&gt;
Using mtrace() in parallel is similar to serial, but you need to ensure that each process gets a different value for MALLOC_TRACE&lt;br /&gt;
You may be able to do this by passing options to mpirun, but it's probably simpler to write some code to do this:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;mcheck.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
  #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  int main(int argc, char** argv) &lt;br /&gt;
  {&lt;br /&gt;
     int rank;&lt;br /&gt;
     char* tracepath&lt;br /&gt;
     char* cwd = get_current_dir_name();&lt;br /&gt;
     MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
     MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
     asprintf(&amp;amp;tracepath, &amp;quot;%s/mtrace.dat.%d&amp;quot;, cwd, rank);&lt;br /&gt;
     mtrace()&lt;br /&gt;
     /*....*/&lt;br /&gt;
     MPI_Finalize();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
With this code applied, you can then simply run your program normally and analyze the results as before:&lt;br /&gt;
&lt;br /&gt;
  mpirun -np 8 ./a.out&lt;br /&gt;
  mtrace ./a.out mtrace.dat.0&lt;br /&gt;
  mtrace ./a.out mtrace.dat.1&lt;br /&gt;
  #...&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=371</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=371"/>
				<updated>2013-07-15T20:06:50Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
Matlab is installed only on Viz001 and Viz002 (since we only have node-locked licenses). Several recent versions are installed in /opt/matlab. Currently, the full path to the latest version is:&lt;br /&gt;
&lt;br /&gt;
  /opt/matlab/R2013a/bin/matlab&lt;br /&gt;
&lt;br /&gt;
The licenses expire periodically, but can be renewed. If you need an older version and find that the license has expired, please email Benjamin.A.Matthews@Colorado.edu&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=370</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=370"/>
				<updated>2013-07-15T20:06:34Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
Matlab is installed only on Viz001 and Viz002 (since we only have node-locked licenses). Several recent versions are installed in /opt/MATLAB. Currently, the full path to the latest version is:&lt;br /&gt;
&lt;br /&gt;
  /opt/matlab/R2013a/bin/matlab&lt;br /&gt;
&lt;br /&gt;
The licenses expire periodically, but can be renewed. If you need an older version and find that the license has expired, please email Benjamin.A.Matthews@Colorado.edu&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Address_Sanitizer&amp;diff=369</id>
		<title>Address Sanitizer</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Address_Sanitizer&amp;diff=369"/>
				<updated>2013-07-15T19:59:47Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software Engineering]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Address sanitizer is a compiler extension and runtime library used for debugging memory errors. It works by introducing extra &amp;quot;canary&amp;quot; regions around memory allocated by your program, and checks for accesses to those regions. This allows it to detect when your program accesses memory that has not been properly allocated. You can read more about how address sanitizer works [[https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm here]]&lt;br /&gt;
&lt;br /&gt;
== Use ==&lt;br /&gt;
Address sanitizer is available in newer versions of GCC (&amp;gt;= 4.8.0) and Clang (&amp;gt;=3.0?). On the Viz nodes, you'll want to use GCC.&lt;br /&gt;
&lt;br /&gt;
First, load GCC 4.8&lt;br /&gt;
&lt;br /&gt;
  soft add +gcc-4.8.1&lt;br /&gt;
&lt;br /&gt;
Then compile your code using appropriate flags. If you're using CMake, you'll want to set the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS variables (these are &amp;quot;advanced&amp;quot; - you'll need to press the &amp;quot;t&amp;quot; key in ccmake to see them)&lt;br /&gt;
&lt;br /&gt;
  gcc -fsanitize=address -O0 -fno-omit-frame-pointer -g test.c&lt;br /&gt;
&lt;br /&gt;
Next run your program normally. If it runs to completion, congratulations, it's likely you don't have any bad accesses. Otherwise, your program will crash and print a couple pages of information. You can use this output to find the problem (the &amp;quot;addr2line&amp;quot; command may be helpful). An easier way is to use gdb:&lt;br /&gt;
&lt;br /&gt;
In serial:&lt;br /&gt;
  gdb my_program&lt;br /&gt;
  break __asan_report_error&lt;br /&gt;
  run&lt;br /&gt;
&lt;br /&gt;
At which point, your program should stop and return you to a gdb prompt right after the bad access occurs. you can use the &lt;br /&gt;
  bt&lt;br /&gt;
command to see where the code stopped and debug as you normally would with gdb. &lt;br /&gt;
&lt;br /&gt;
In parallel, the procedure is basically the same, but you'll need to use multiple copies of gdb (or a parallel debugger if you're using a system on which one is available). See the [[Debugging]] page for more information on using gdb in parallel.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Address_Sanitizer&amp;diff=368</id>
		<title>Address Sanitizer</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Address_Sanitizer&amp;diff=368"/>
				<updated>2013-07-15T19:59:00Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: Created page with &amp;quot;== Introduction == Address sanitizer is a compiler extension and runtime library used for debugging memory errors. It works by introducing extra &amp;quot;canary&amp;quot; regions around memory al...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Address sanitizer is a compiler extension and runtime library used for debugging memory errors. It works by introducing extra &amp;quot;canary&amp;quot; regions around memory allocated by your program, and checks for accesses to those regions. This allows it to detect when your program accesses memory that has not been properly allocated. You can read more about how address sanitizer works [[https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm here]]&lt;br /&gt;
&lt;br /&gt;
== Use ==&lt;br /&gt;
Address sanitizer is available in newer versions of GCC (&amp;gt;= 4.8.0) and Clang (&amp;gt;=3.0?). On the Viz nodes, you'll want to use GCC.&lt;br /&gt;
&lt;br /&gt;
First, load GCC 4.8&lt;br /&gt;
&lt;br /&gt;
  soft add +gcc-4.8.1&lt;br /&gt;
&lt;br /&gt;
Then compile your code using appropriate flags. If you're using CMake, you'll want to set the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS variables (these are &amp;quot;advanced&amp;quot; - you'll need to press the &amp;quot;t&amp;quot; key in ccmake to see them)&lt;br /&gt;
&lt;br /&gt;
  gcc -fsanitize=address -O0 -fno-omit-frame-pointer -g test.c&lt;br /&gt;
&lt;br /&gt;
Next run your program normally. If it runs to completion, congratulations, it's likely you don't have any bad accesses. Otherwise, your program will crash and print a couple pages of information. You can use this output to find the problem (the &amp;quot;addr2line&amp;quot; command may be helpful). An easier way is to use gdb:&lt;br /&gt;
&lt;br /&gt;
In serial:&lt;br /&gt;
  gdb my_program&lt;br /&gt;
  break __asan_report_error&lt;br /&gt;
  run&lt;br /&gt;
&lt;br /&gt;
At which point, your program should stop and return you to a gdb prompt right after the bad access occurs. you can use the &lt;br /&gt;
  bt&lt;br /&gt;
command to see where the code stopped and debug as you normally would with gdb. &lt;br /&gt;
&lt;br /&gt;
In parallel, the procedure is basically the same, but you'll need to use multiple copies of gdb (or a parallel debugger if you're using a system on which one is available). See the [[Debugging]] page for more information on using gdb in parallel.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Adding_CMAKE_To_PHASTA&amp;diff=329</id>
		<title>Adding CMAKE To PHASTA</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Adding_CMAKE_To_PHASTA&amp;diff=329"/>
				<updated>2013-07-02T03:45:10Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you'd like to use the new CMake based build system as described on the [[Compiling PHASTA With CMake]] page, but haven't merged your copy with [[https://redmine.scorec.rpi.edu/anonsvn/phasta SVN trunk]] recently, you can follow these steps to add CMake support to your fork. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, download the CMake build scripts:&lt;br /&gt;
&lt;br /&gt;
  git clone https://github.com/matthb2/phasta-buildsystem.git&lt;br /&gt;
  &lt;br /&gt;
Next, we'll re-arrange your checkout of PHASTA to remove any redundant directories&lt;br /&gt;
&lt;br /&gt;
  cd phasta&lt;br /&gt;
  mv phSolver tmp&lt;br /&gt;
  mv tmp/phSolver ./&lt;br /&gt;
  rmdir tmp&lt;br /&gt;
  #and so on with each directory that you have&lt;br /&gt;
&lt;br /&gt;
Once that's done, you'll need to copy all the CMakeLists.txt files into their respective directories:&lt;br /&gt;
  #starting from your phasta source directory:&lt;br /&gt;
  for i in `find ../phasta-buildsystem -name 'CMakeLists.txt' | sed 's:\.\.\/::g' | sed 's:CMakeLists.txt$::g' | sed 's:^phasta\-buildsystem\/::g'`; do cp ../phasta-buildsystem/$i/CMakeLists.txt ./$i/&lt;br /&gt;
&lt;br /&gt;
From this point, if you're on a fairly normal system, you can probably just build using CMake. That said, if you want your setup to be robust, it's a good idea to make some minor code changes in order to allow CMake to compute the necessary name mangling for the Fortran callable C functions. &lt;br /&gt;
&lt;br /&gt;
CMake will generate a header file called &amp;quot;FCMangle.h&amp;quot; which supplies some macros. The one we're interested in is called &lt;br /&gt;
  FortranCInterface_GLOBAL_()&lt;br /&gt;
This macro takes two arguments, both of which are the name of the global symbol that should be Fortran callable. The first argument should be all lowercase, and the second should be all uppercase. The macro returns the Fortran name of the symbol.&lt;br /&gt;
&lt;br /&gt;
For example, if I have a C function &amp;quot;foo()&amp;quot; that I want to call from Fortran, in my C header, I'd add these lines:&lt;br /&gt;
  #include &amp;lt;FCMangle.h&amp;gt;&lt;br /&gt;
  #define foo FortranCInterface_GLOBAL_(foo,FOO)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To take advantage of this in PHASTA, you'll find blocks of code that look like:&lt;br /&gt;
&lt;br /&gt;
  #ifdef ibm&lt;br /&gt;
  #define something&lt;br /&gt;
  #endif&lt;br /&gt;
  #ifdef aix&lt;br /&gt;
  #define something&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
Which should be replaced by calls to FortranCInterface_GLOBAL_. I've found that grepping for &amp;quot;ibm&amp;quot; catches most of these. If you fail to update any of these pieces of code, you'll see linker errors on certain platforms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that to avoid another second class of bug, we've also been removing the trailing underscores from any functions that have them. For example &amp;quot;readheader_()&amp;quot; becomes &amp;quot;readheader()&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a (slightly outdated) video showing this process on an arbitrary fork of PHASTA available [[http://fluid.colorado.edu/~matthb2/videos/phastatocmake/ here]]&lt;br /&gt;
&lt;br /&gt;
If you have any problems with this process, feel free to email [[mailto:Benjamin.A.MatthewsATcolorado.edu Ben]] and please share any lessons learned on this page.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Adding_CMAKE_To_PHASTA&amp;diff=328</id>
		<title>Adding CMAKE To PHASTA</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Adding_CMAKE_To_PHASTA&amp;diff=328"/>
				<updated>2013-07-02T03:44:08Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: Created page with &amp;quot;If you'd like to use the new CMake based build system as described on the Compiling PHASTA With CMake page, but haven't merged your copy with [[https://redmine.scorec.rpi.edu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you'd like to use the new CMake based build system as described on the [[Compiling PHASTA With CMake]] page, but haven't merged your copy with [[https://redmine.scorec.rpi.edu/anonsvn/phasta SVN trunk]] recently, you can follow these steps to add CMake support to your fork. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, download the CMake build scripts:&lt;br /&gt;
&lt;br /&gt;
  git clone https://github.com/matthb2/phasta-buildsystem.git&lt;br /&gt;
  &lt;br /&gt;
Next, we'll re-arrange your checkout of PHASTA to remove any redundant directories&lt;br /&gt;
&lt;br /&gt;
  cd phasta&lt;br /&gt;
  mv phSolver tmp&lt;br /&gt;
  mv tmp/phSolver ./&lt;br /&gt;
  rmdir tmp&lt;br /&gt;
  #and so on with each directory that you have&lt;br /&gt;
&lt;br /&gt;
Once that's done, you'll need to copy all the CMakeLists.txt files into their respective directories:&lt;br /&gt;
  #starting from your phasta source directory:&lt;br /&gt;
  for i in `find ../phasta-buildsystem -name 'CMakeLists.txt' | sed 's:\.\.\/::g' | sed 's:CMakeLists.txt$::g' | sed 's:^phasta\-buildsystem\/::g'`; do cp ../phasta-buildsystem/$i/CMakeLists.txt ./$i/&lt;br /&gt;
&lt;br /&gt;
From this point, if you're on a fairly normal system, you can probably just build using CMake. That said, if you want your setup to be robust, it's a good idea to make some minor code changes in order to allow CMake to compute the necessary name mangling for the Fortran callable C functions. &lt;br /&gt;
&lt;br /&gt;
CMake will generate a header file called &amp;quot;FCMangle.h&amp;quot; which supplies some macros. The one we're interested in is called &lt;br /&gt;
  FortranCInterface_GLOBAL_()&lt;br /&gt;
This macro takes two arguments, both of which are the name of the global symbol that should be Fortran callable. The first argument should be all lowercase, and the second should be all uppercase. The macro returns the Fortran name of the symbol.&lt;br /&gt;
&lt;br /&gt;
For example, if I have a C function &amp;quot;foo()&amp;quot; that I want to call from Fortran, in my C header, I'd add these lines:&lt;br /&gt;
  #include &amp;lt;FCMangle.h&amp;gt;&lt;br /&gt;
  #define foo FortranCInterface_GLOBAL_(foo,FOO)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To take advantage of this in PHASTA, you'll find blocks of code that look like:&lt;br /&gt;
&lt;br /&gt;
  #ifdef ibm&lt;br /&gt;
  #define something&lt;br /&gt;
  #endif&lt;br /&gt;
  #ifdef aix&lt;br /&gt;
  #define something&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
Which should be replaced by calls to FortranCInterface_GLOBAL_. I've found that grepping for &amp;quot;ibm&amp;quot; catches most of these. If you fail to update any of these pieces of code, you'll see linker errors on certain platforms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that to avoid another second class of bug, we've also been removing the trailing underscores from any functions that have them. For example &amp;quot;readheader_()&amp;quot; becomes &amp;quot;readheader()&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a (slightly outdated) video showing this process on an arbitrary fork of PHASTA available [[http://fluid.colorado.edu/~matthb2/videos/phastatocmake/ here]]&lt;br /&gt;
&lt;br /&gt;
If you have any problems with this process, feel free to email [[mailto:Benjamin.A.Matthews AT colorado.edu Ben]] and please share any lessons learned on this page.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=327</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=327"/>
				<updated>2013-07-02T03:02:15Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Cross Compiling on IBM's BlueGene/Q */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake -- see below)&lt;br /&gt;
&lt;br /&gt;
Kitware has some documentation on cross compiling with CMake [[http://www.cmake.org/Wiki/CMake_Cross_Compiling here]]. &lt;br /&gt;
&lt;br /&gt;
== Cross Compiling on IBM's BlueGene/Q ==&lt;br /&gt;
&lt;br /&gt;
Currently, CMake doesn't officially have explicit support for BlueGene/Q (BlueGene/P is supported). While you should be able to use a toolchain file expecting one of the generic system types, we've modified the BG/P platform files for /Q, based on the setup used on [[http://alcf.anl.gov ALCF's]] systems (should work with most /Q systems). To use them, you need to add two files [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-base.cmake 1]] [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-static.cmake 2]] to your CMake install. For a normal install, these files should be placed in $prefix/share/cmake-2.8/Modules/Platform/&lt;br /&gt;
&lt;br /&gt;
If you prefer, you can just directly install the &amp;quot;bgq&amp;quot; branch of [[https://github.com/matthb2/CMake/tree/bgq this repository]]&lt;br /&gt;
&lt;br /&gt;
  git clone https://github.com/matthb2/CMake.git&lt;br /&gt;
  git checkout -b bgq origin/bgq&lt;br /&gt;
  cd CMake&lt;br /&gt;
  ./configure --prefix=/some/path&lt;br /&gt;
  make&lt;br /&gt;
  make install&lt;br /&gt;
  export PATH=/some/path:$PATH&lt;br /&gt;
&lt;br /&gt;
You can then proceed as above, using [[https://raw.github.com/matthb2/CMakeToolchainFiles/master/BlueGene/Q/BGQ-XLMPI-toolchain.cmake this toolchain file]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Currently, the system software is changing very quickly. If you need a build of the proprietary library used for PHASTA's incompressible solver, please ask Ben or Michel (and tell them which Bluegene driver version you have)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
(gnu compilers)&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=326</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=326"/>
				<updated>2013-07-02T02:59:20Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Cross Compiling with CMake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake -- see below)&lt;br /&gt;
&lt;br /&gt;
Kitware has some documentation on cross compiling with CMake [[http://www.cmake.org/Wiki/CMake_Cross_Compiling here]]. &lt;br /&gt;
&lt;br /&gt;
== Cross Compiling on IBM's BlueGene/Q ==&lt;br /&gt;
&lt;br /&gt;
Currently, CMake doesn't officially have explicit support for BlueGene/Q (BlueGene/P is supported). While you should be able to use a toolchain file expecting one of the generic system types, we've modified the BG/P platform files for /Q, based on the setup used on [[http://alcf.anl.gov ALCF's]] systems (should work with most /Q systems). To use them, you need to add two files [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-base.cmake 1]] [[https://raw.github.com/matthb2/CMake/bgq/Modules/Platform/BlueGeneQ-static.cmake 2]] to your CMake install. For a normal install, these files should be placed in $prefix/share/cmake-2.8/Modules/Platform/&lt;br /&gt;
&lt;br /&gt;
If you prefer, you can just directly install the &amp;quot;bgq&amp;quot; branch of [[https://github.com/matthb2/CMake/tree/bgq this repository]]&lt;br /&gt;
&lt;br /&gt;
  git clone https://github.com/matthb2/CMake.git&lt;br /&gt;
  git checkout -b bgq origin/bgq&lt;br /&gt;
  cd CMake&lt;br /&gt;
  ./configure --prefix=/some/path&lt;br /&gt;
  make&lt;br /&gt;
  make install&lt;br /&gt;
  export PATH=/some/path:$PATH&lt;br /&gt;
&lt;br /&gt;
You can then proceed as above, using [[https://raw.github.com/matthb2/CMakeToolchainFiles/master/BlueGene/Q/BGQ-XLMPI-toolchain.cmake this toolchain file]&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
(gnu compilers)&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=316</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=316"/>
				<updated>2013-06-21T01:20:18Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* With gprof */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
(gnu compilers)&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=315</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=315"/>
				<updated>2013-06-21T01:20:01Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* With gprof */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
(gnu compilers)&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=314</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=314"/>
				<updated>2013-06-21T01:19:11Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
Some compilers which can perform inter-procedural analysis have a hard time with PHASTA. See the [[Compilers]] page for information on disabling this optimization if linking takes too long&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=313</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=313"/>
				<updated>2013-06-21T01:17:20Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* With gprof */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=312</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=312"/>
				<updated>2013-06-21T01:17:04Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;br /&gt;
&lt;br /&gt;
== With gprof == &lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_CXX_FLAGS=&amp;quot;-pg&amp;quot; -DCMAKE_Fortran_FLAGS=&amp;quot;-pg&amp;quot; ../phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=310</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=310"/>
				<updated>2013-06-21T01:04:15Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
on Janus, run &amp;quot;module load cmake&amp;quot; to get an appropriate version of CMake&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=309</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=309"/>
				<updated>2013-06-21T00:58:01Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
on the viz nodes, run &amp;quot;soft add +cmake&amp;quot; to get an appropriate version of CMake.&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CMake supports generating scripts for other build tools, for example Xcode, Eclipse and Ninja. See the &amp;quot;cmake&amp;quot; manpage for more information.&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=308</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=308"/>
				<updated>2013-06-21T00:54:20Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=307</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=307"/>
				<updated>2013-06-21T00:47:07Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[https://github.com/matthb2/CMakeToolchainFiles here]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq patched version]] of CMake)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=306</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=306"/>
				<updated>2013-06-21T00:46:02Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Cross Compiling with CMake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[ https://github.com/matthb2/CMakeToolchainFiles | here ]] (note that the BlueGene/Q toolchain files provided here expect a [[ https://github.com/matthb2/CMake/tree/bgq | patched version ]] of CMake)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=305</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=305"/>
				<updated>2013-06-21T00:45:20Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling with CMake ==&lt;br /&gt;
&lt;br /&gt;
CMake can cross compile PHASTA, for example on a BlueGene or Cray system. To do this, you simply need to provide an appropriate toolchain file specifying the path to the cross compilers and then build as normal.&lt;br /&gt;
&lt;br /&gt;
  ccmake -DCMAKE_TOOLCHAIN_FILE=some_file.cmake ../phasta&lt;br /&gt;
&lt;br /&gt;
There are some toolchain files for systems that we commonly use available [[ https://github.com/matthb2/CMakeToolchainFiles here ]] (note that the BlueGene/Q toolchain files provided here expect a [[https://github.com/matthb2/CMake/tree/bgq  patched version]] of CMake)&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=304</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=304"/>
				<updated>2013-06-21T00:39:15Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A fairly generic version of PHASTA, which includes this build system, can be found on the viz nodes in /users/matthb2/phasta-tocmake/phasta&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=303</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=303"/>
				<updated>2013-06-21T00:38:34Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The build options are in a (somewhat) human readable format in a file called &amp;quot;CMakeCache.txt&amp;quot; in the root of your build directory - this can be very useful if you need to figure out which options were used for a particular build. &lt;br /&gt;
&lt;br /&gt;
If you add a new file, you need to tell CMake that the source has changed (this is not usually necessary if you've simply edited an existing source file). You can do this as follows (from your build directory):&lt;br /&gt;
  touch CMakeCache.txt&lt;br /&gt;
&lt;br /&gt;
CMake uses the MPI wrappers to find your MPI install by default - mpicc and mpif90 must be in your PATH prior to running ccmake&lt;br /&gt;
&lt;br /&gt;
If you'd like to use CMake in a non-interactive fashion, you can use &amp;quot;cmake&amp;quot; instead of &amp;quot;ccmake&amp;quot; and specify and options on the command line by prepending them with &amp;quot;-D&amp;quot;. For example:&lt;br /&gt;
&lt;br /&gt;
  cmake -DCMAKE_BUILD_TYPE=Release -DPHASTA_INCOMPRESSIBLE=ON -DACUSOLVE_LIB=$HOME/libles.a ../phasta&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
The incompressible solver is disabled by default. You'll need to set the PHASTA_INCOMPRESSIBLE option to &amp;quot;ON&amp;quot; and specify the full path to the Acusolve library when prompted.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=302</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=302"/>
				<updated>2013-06-21T00:33:14Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;br /&gt;
&lt;br /&gt;
Once you've completed this process, you can simply run &amp;quot;make&amp;quot; to build the code. The executable will be in the &amp;quot;bin&amp;quot; sub-directory of your build directory. &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you run into trouble, it may be useful to see how the compiler is being invoked. You can do this by running:&lt;br /&gt;
&lt;br /&gt;
  make VERBOSE=1&lt;br /&gt;
&lt;br /&gt;
(after having already run cmake)&lt;br /&gt;
&lt;br /&gt;
To add additional compiler flags, use the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_Fortran_FLAGS fields when you configure&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=301</id>
		<title>PHASTA/Compiling PHASTA With CMake</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=PHASTA/Compiling_PHASTA_With_CMake&amp;diff=301"/>
				<updated>2013-06-21T00:04:36Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: Created page with &amp;quot;There is an unofficial, but popular version of the PHASTA solver which uses a http://cmake.org CMake based build system. Generally, an out-of-source build is used, meaning th...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is an unofficial, but popular version of the PHASTA solver which uses a [[http://cmake.org CMake]] based build system. Generally, an out-of-source build is used, meaning that you have a separate directory for your executables and intermediate files. &lt;br /&gt;
&lt;br /&gt;
Assuming you have your desired compiler and a current version of CMake (2.8.5 or newer) in your path, you must first create and change into an empty directory to store your build&lt;br /&gt;
&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
&lt;br /&gt;
You can then run cmake to create your makefile&lt;br /&gt;
&lt;br /&gt;
If you're using the Intel compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=icc CXX=icpc FC=ifort ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
If you're using the PGI compiler suite:&lt;br /&gt;
&lt;br /&gt;
  CC=pgcc CXX=pgCC FC=pgfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
IF you're using the GNU toolchain:&lt;br /&gt;
&lt;br /&gt;
  CC=gcc CXX=g++ FC=gfortran ccmake ../phasta&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a &amp;quot;GUI&amp;quot; of sorts. You can use the arrow keys to navigate. Press enter to edit the highlighted field, and then enter again to save your change. Press the &amp;quot;c&amp;quot; key to compute the options. Press &amp;quot;g&amp;quot; to write out the makefile and quit. You'll need to press &amp;quot;c&amp;quot; several times, and fill in any desired options before you can generate your makefile. &lt;br /&gt;
&lt;br /&gt;
You may want to set the &amp;quot;CMAKE_BUILD_TYPE&amp;quot; field to either &amp;quot;Release&amp;quot; or &amp;quot;Debug&amp;quot; to get an optimized build or a debugable build respectively.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UNIX&amp;diff=294</id>
		<title>UNIX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UNIX&amp;diff=294"/>
				<updated>2013-05-15T20:30:38Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of our systems (and general HPC resources) run some UNIX derivative. Much of the software is command line based, so it's worthwhile to learn the basics. &lt;br /&gt;
&lt;br /&gt;
There are tons of free resources on the web for getting started, for example this [[http://learncodethehardway.org/cli/book book]]. There should also be a &amp;quot;for dummies&amp;quot; book in the lab. &lt;br /&gt;
&lt;br /&gt;
As you find resources that are helpful, please update this page.&lt;br /&gt;
&lt;br /&gt;
== Connecting (SSH) ==&lt;br /&gt;
Windows:&lt;br /&gt;
[[http://www.chiark.greenend.org.uk/~sgtatham/putty PuTTY SSH Client]]&lt;br /&gt;
[[http://winscp.net/eng/index.php WinSCP file transfer tool]]&lt;br /&gt;
&lt;br /&gt;
MacOS and Linux users can use [[http://openssh.org/ OpennSSH]] on the command line (it generally comes with the OS).&lt;br /&gt;
&lt;br /&gt;
== Command Line Basics ==&lt;br /&gt;
[[http://code.google.com/edu/tools101/index.html Google's tutorial]]&lt;br /&gt;
&lt;br /&gt;
[[https://www.rc.colorado.edu/support/tutorials/linux Slides and Video from CU's Research Computing group]]&lt;br /&gt;
&lt;br /&gt;
[[http://www.nixsrv.com/llthw  &amp;quot;Learn Linux the Hard Way&amp;quot; (online book)]]&lt;br /&gt;
== Graphical Sessions (VNC) ==&lt;br /&gt;
See [[VNC]]&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=281</id>
		<title>VNC</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=281"/>
				<updated>2013-01-01T17:29:25Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;VNC is a tool which projects a GUI session over the network. If may be useful if you want to use GUI tools remotely when X forwarding performs poorly. &lt;br /&gt;
&lt;br /&gt;
'''Warning: This is still being tested and should NOT be considered stable (portal0 may be rebooted without warning)'''&lt;br /&gt;
'''Warning: The vnc password is transmitted in clear text over the network and should not be considered secure'''&lt;br /&gt;
&lt;br /&gt;
Portal0 is designated to host VNC sessions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can start a session as follows:&lt;br /&gt;
&lt;br /&gt;
  ssh jumpgate-phasta.colorado.edu&lt;br /&gt;
  ssh portal0&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  start_vnc.sh&lt;br /&gt;
&lt;br /&gt;
And follow the directions&lt;br /&gt;
 &lt;br /&gt;
(You may want to remember your password and port number so that you can reuse your session)&lt;br /&gt;
&lt;br /&gt;
When you are done, end your session by&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  stop_vnc.sh&lt;br /&gt;
&lt;br /&gt;
== OpenGL == &lt;br /&gt;
&lt;br /&gt;
Portal0 is equipped with a VirtualGL install which will allow you to use OpenGL programs (which do not use pthreads)&lt;br /&gt;
&lt;br /&gt;
Simply wrap your OpenGL program with the &amp;quot;vglrun&amp;quot; command&lt;br /&gt;
  vlgrun glxgears&lt;br /&gt;
&lt;br /&gt;
If you have access to another VirtualGL server you can connect to it first (Portal0 doesn't have a particularly fast graphics processor)&lt;br /&gt;
  vglconnect server&lt;br /&gt;
  vglrun glxgears&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that VGL uses a number of threads. If you have trouble with vglrun crashing with a message about Thread::Start() make sure you haven't set your stack size too large (remove any ulimit -s or ulimit -n calls from your shell start scripts)&lt;br /&gt;
&lt;br /&gt;
== Clients == &lt;br /&gt;
&lt;br /&gt;
Portal0 uses TurboVNC from the VirtualGL project, available from http://www.virtualgl.org/Downloads/TurboVNC&lt;br /&gt;
&lt;br /&gt;
Other VNC viewers will also work, such as TightVNC and RealVNC&lt;br /&gt;
&lt;br /&gt;
== Changing the VNC Password ==&lt;br /&gt;
&lt;br /&gt;
  /opt/tigervnc/bin/vncpasswd&lt;br /&gt;
&lt;br /&gt;
== View Only Mode == &lt;br /&gt;
&lt;br /&gt;
To share your desktop with another user in view only mode set a view only password &lt;br /&gt;
by running&lt;br /&gt;
  vncpasswd&lt;br /&gt;
&lt;br /&gt;
Have the other user connect in the same way you would but have them set their viewer to be in view only mode and use your view only password. Typically this is done as follows:&lt;br /&gt;
  vncviewer -viewonly&lt;br /&gt;
&lt;br /&gt;
== Windows == &lt;br /&gt;
The PuTTY SSH client can handle ssh tunneling on Windows based machines. You can download it here: http://www.chiark.greenend.org.uk/~sgtatham/putty/&lt;br /&gt;
&lt;br /&gt;
When you open putty, enter jumpgate-phasta.colorado.edu as in the Host Name box. Then click the + button next to SSH on the left pane (to expand the SSH tree node). Choose the Tunnels page. The start_vnc.sh script should tell you to run &amp;quot;ssh -L????:portal0:???? jumpgate-phasta.colorado.edu&amp;quot; on your machine. Enter the number between the -L and the first colon in the &amp;quot;Source port&amp;quot; box. Enter the rest in the Destination box (starting with portal0) and '''click the add button'''. Then click &amp;quot;Open&amp;quot; and login as normal. You will then be able to use a vncviewer as instructed by the script. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
The script says:&lt;br /&gt;
ssh -L5905:portal0:5900 jumpgate-phasta.colorado.edu&lt;br /&gt;
enter 5905 in the Source port box&lt;br /&gt;
enter portal0:5900 in the destination box.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try using this viewer utility&lt;br /&gt;
http://www.tightvnc.com/download/1.3.10/tightvnc-1.3.10_x86_viewer.zip&lt;br /&gt;
&lt;br /&gt;
== Web Based Viewer ==&lt;br /&gt;
&lt;br /&gt;
If you can't or don't want to install a VNC viewer you can use a Java based one. You will need a JVM and a Java browser plugin. You will also need the port that the start_vnc script assigned you to be free on your local computer&lt;br /&gt;
&lt;br /&gt;
Forward your session through jumpgate as before before, adding a second port, 580n. For example, if the script tells you to &lt;br /&gt;
&lt;br /&gt;
ssh -L5905:portal0:5902 jumpgate-phasta.colorado.edu you should&lt;br /&gt;
  ssh -L5902:portal0:5902 -L5802:portal0:5802 jumpgate-phasta.colorado.edu&lt;br /&gt;
Then point your browser to http://localhost:5802 and log in with the password specified by the script when prompted. (Replace 2 with the value specified by the script)&lt;br /&gt;
&lt;br /&gt;
== Changing the Size (Resolution) of an Existing Session ==&lt;br /&gt;
&lt;br /&gt;
You can usually use the &amp;quot;xrandr&amp;quot; tool to change the resolution of a running vnc session. First you'll need to know your session's display number (this should be the last digit or two of the port number). For example, if your VNC session is running on port 5902, then your screen number should be :2. For this example, we'll use screen 2. &lt;br /&gt;
&lt;br /&gt;
Once you know your screen number, you can see the list of supported modes as follows:&lt;br /&gt;
  xrandr -display :2&lt;br /&gt;
&lt;br /&gt;
Once you pick the one you want (generally the same size or smaller than the native resolution of your client), you can choose it by running a command like&lt;br /&gt;
  xrandr -s 1400x1050 -display :2&lt;br /&gt;
&lt;br /&gt;
(this example will set the resolution to 1400 pixels by 1050 pixels)&lt;br /&gt;
&lt;br /&gt;
You'll probably be disconnected at this point, but when you reconnect your screen size should be changed (hopefully without crashing your running programs). &lt;br /&gt;
&lt;br /&gt;
== Finding an Existing Session ==&lt;br /&gt;
SSH to portal0 and then run:&lt;br /&gt;
  /opt/vnc_script/findsession.sh&lt;br /&gt;
&lt;br /&gt;
Which will return the shortened port number of each of your currently running sessions.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting == &lt;br /&gt;
&lt;br /&gt;
If you have used vncserver (It doesn't matter which version) on a SCOREC machine before, you will need to clear your vnc settings for the script to work. You can do this by running rm -rf ~/.vnc&lt;br /&gt;
&lt;br /&gt;
stop_vnc.sh may display some errors; this is normal.&lt;br /&gt;
&lt;br /&gt;
If you have trouble deleting ~/.vnc send an email to Benjamin.A.Matthews@colorado.edu&lt;br /&gt;
&lt;br /&gt;
If any of these commands fail, you may need to source /etc/profile to get the necessary environment variables (this should be fixed soon)&lt;br /&gt;
&lt;br /&gt;
VirtualGL has trouble with some threaded programs. If your OpenGL program exhibits segmentation faults or other issues, this could be the problem. Check back for the solution later. &lt;br /&gt;
&lt;br /&gt;
If the given password is rejected you can run stop_vnc.sh and restart to get a new one. Occasionally the random password generator may generate passwords which VNC doesn't like.&lt;br /&gt;
&lt;br /&gt;
If VirtualGL complains about not being able to get a 24bit FB config either vglconnect to another VirtualGL enabled server or complain to Benjamin.A.Matthews@Colorado.edu&lt;br /&gt;
&lt;br /&gt;
If your VNC connection is very slow, you might want to try changing the compression and encoding options. See your vncviewer's documentation or try this&lt;br /&gt;
  vncviewer -encodings tight -quality 6 -compresslevel 6&lt;br /&gt;
If you have trouble with text distortion try adding &lt;br /&gt;
  -nojpeg&lt;br /&gt;
&lt;br /&gt;
If you're running OSX and see an error about Zlib, try changing your compression settings (maximum quality usually works) or use a different client. RealVNC and certain versions of ChickenOfTheVNC both exhibit this issue. The latest build of TigerVNC should work reliably, as does the Java based TightVNC client.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=Compilers&amp;diff=280</id>
		<title>Compilers</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=Compilers&amp;diff=280"/>
				<updated>2012-11-22T07:55:52Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Portland */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We have access to several different sets of compilers and libraries. Ideally your code should work with all of them, and you can test which produces the fastest executables. Some also have different debugging features.&lt;br /&gt;
&lt;br /&gt;
==GNU==&lt;br /&gt;
The GNU toolchain is the standard in the open source world and tends to be the most compatible (at least for C/C++ code). Several versions which ship with the operating system should be available by default and can be invoked as:&lt;br /&gt;
  gcc #C code&lt;br /&gt;
  g++ #C++ code&lt;br /&gt;
  gfortran #F77, F90&lt;br /&gt;
&lt;br /&gt;
To compile with debug support add at least&lt;br /&gt;
  -g&lt;br /&gt;
to your compile flags. Adding&lt;br /&gt;
  -g -O0 -fno-omit-frame-pointer -fbounds-check -ftrapv&lt;br /&gt;
&lt;br /&gt;
may make the code easier to debug. See the manpages for language specific options. &lt;br /&gt;
&lt;br /&gt;
To generate an optimized build start with &lt;br /&gt;
  -O3&lt;br /&gt;
and see the manpage for more optional optimizations. &lt;br /&gt;
&lt;br /&gt;
There are also some newer versions available using the softenv tool. Note that if you use a newer GNU toolchain, you should also have it loaded into your environment at runtime to ensure that the correct libraries are used. &lt;br /&gt;
&lt;br /&gt;
==Intel==&lt;br /&gt;
The Intel toolchain typically generates fast executables for Intel processors. It also ships with some debugging and profiling tools. You can load the Intel toolchain by executing:&lt;br /&gt;
&lt;br /&gt;
  soft add +intelcompilers-64bit&lt;br /&gt;
&lt;br /&gt;
You can then invoke&lt;br /&gt;
  icc #C&lt;br /&gt;
  icpc #C++&lt;br /&gt;
  ifort #F90/F77/F2003&lt;br /&gt;
&lt;br /&gt;
There are some known issues with debugging Fortran code (particularly if it uses dynamically allocated arrays)  using the Intel toolchain. These bugs seem to be fixed in the release version of Intel 2013, which is starting to become available on some machines (not ours yet)&lt;br /&gt;
&lt;br /&gt;
For debugging, you need at a minimum&lt;br /&gt;
  -g&lt;br /&gt;
&lt;br /&gt;
For best results, try&lt;br /&gt;
  -O0 -debug all -fstack-protector -no-ipo -g&lt;br /&gt;
&lt;br /&gt;
For an optimized build, start with:&lt;br /&gt;
  -O3&lt;br /&gt;
and check the manpage for more options. &lt;br /&gt;
&lt;br /&gt;
When compiling Fortran, it is a good idea to also pass&lt;br /&gt;
  -fheap-arrays&lt;br /&gt;
&lt;br /&gt;
The Intel debugger is called&lt;br /&gt;
  idb&lt;br /&gt;
&lt;br /&gt;
(but note that it consumes a license for the entire compiler suite, so please don't leave it running for long periods of time)&lt;br /&gt;
&lt;br /&gt;
==Portland==&lt;br /&gt;
The PGI toolchain is an alternative toolchain, with which we have had good luck debugging Fortran codes. It also supports OpenACC (like OpenMP for GPUs)&lt;br /&gt;
&lt;br /&gt;
You can load the PGI compilers by running&lt;br /&gt;
  soft add +pgi-64bit&lt;br /&gt;
&lt;br /&gt;
and invoke them as&lt;br /&gt;
  pgcc #C&lt;br /&gt;
  pgCC #C++&lt;br /&gt;
  pgfortran #various Fortran&lt;br /&gt;
  pgf90 #F90&lt;br /&gt;
  pgf77 #F77&lt;br /&gt;
&lt;br /&gt;
Note that PGI 11.x has some bad C++ related bugs. You should use PGI 12 or newer.&lt;br /&gt;
&lt;br /&gt;
If you experience extremely long link times (particularly with PGI version 12.3), try adding&lt;br /&gt;
&lt;br /&gt;
  -Mnoipa &lt;br /&gt;
&lt;br /&gt;
to your compiler flags. Note that this flag has a runtime performance cost.&lt;br /&gt;
&lt;br /&gt;
==LLVM/Clang==&lt;br /&gt;
  soft add @llvm-3.2svn&lt;br /&gt;
&lt;br /&gt;
==LLVM/Dragonegg==&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=279</id>
		<title>UGS NX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=279"/>
				<updated>2012-11-08T05:13:11Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Windows Troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
==NX==&lt;br /&gt;
&lt;br /&gt;
UGS/Siemens NX 8.0 CAD/CAE package is available in /usr/local on the Linux machines and on the Windows workstations&lt;br /&gt;
&lt;br /&gt;
You can launch it from portal0 as follows:&lt;br /&gt;
&lt;br /&gt;
  #  vglconnect -s viz001 #or one of the other graphics machiens&lt;br /&gt;
  #(run directly on portal0 for now)&lt;br /&gt;
  /usr/local/nx/ugs080/run.sh&lt;br /&gt;
&lt;br /&gt;
You can launch the documentation by opening &lt;br /&gt;
/usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html in your favorite web browser. It is known to display correctly in Iceweasel but not the current version of Google Chrome &lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html&lt;br /&gt;
&lt;br /&gt;
Installers are also available for personal machines. Please email Ben and/or Ken for instructions.&lt;br /&gt;
&lt;br /&gt;
==Windows Troubleshooting==&lt;br /&gt;
If you get an error about license bundles on the Windows machines, you need to open the NX &amp;quot;License Options&amp;quot; from the programs menu and select the current license bundles (if you follow the directions in the error message the settings won't persist). Feel free to follow along with this [[http://fluid.colorado.edu/~matthb2/videos/nx_license/nx_license_bundle.mp4 video]] (note that the available bundles may change over time, just choose the two that you're offered).&lt;br /&gt;
&lt;br /&gt;
== CAST ==&lt;br /&gt;
&lt;br /&gt;
The NX CAST tutorial library for version 8.0 is also installed. You can launch it in Iceweasel as with the main documentation:&lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/cast080/html/index.html&lt;br /&gt;
&lt;br /&gt;
== NASTRAN ==&lt;br /&gt;
[[http://en.wikipedia.org/wiki/Nastran NASTRAN]] is available on the Windows desktop in the lab. If you need it somewhere else, email Ben&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=278</id>
		<title>UGS NX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=278"/>
				<updated>2012-11-08T05:11:54Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* NX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
==NX==&lt;br /&gt;
&lt;br /&gt;
UGS/Siemens NX 8.0 CAD/CAE package is available in /usr/local on the Linux machines and on the Windows workstations&lt;br /&gt;
&lt;br /&gt;
You can launch it from portal0 as follows:&lt;br /&gt;
&lt;br /&gt;
  #  vglconnect -s viz001 #or one of the other graphics machiens&lt;br /&gt;
  #(run directly on portal0 for now)&lt;br /&gt;
  /usr/local/nx/ugs080/run.sh&lt;br /&gt;
&lt;br /&gt;
You can launch the documentation by opening &lt;br /&gt;
/usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html in your favorite web browser. It is known to display correctly in Iceweasel but not the current version of Google Chrome &lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html&lt;br /&gt;
&lt;br /&gt;
Installers are also available for personal machines. Please email Ben and/or Ken for instructions.&lt;br /&gt;
&lt;br /&gt;
==Windows Troubleshooting==&lt;br /&gt;
If you get an error about License Bundles on the Windows machines, you need to open the NX &amp;quot;License Options&amp;quot; from the programs menu and select the current license bundles (if you follow the directions in the error message the settings won't persist). Feel free to follow along with this [[http://fluid.colorado.edu/~matthb2/videos/nx_license/nx_license_bundle.mp4 video]] (note that the available bundles may change over time, just choose the two that you're offered). &lt;br /&gt;
&lt;br /&gt;
== CAST ==&lt;br /&gt;
&lt;br /&gt;
The NX CAST tutorial library for version 8.0 is also installed. You can launch it in Iceweasel as with the main documentation:&lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/cast080/html/index.html&lt;br /&gt;
&lt;br /&gt;
== NASTRAN ==&lt;br /&gt;
[[http://en.wikipedia.org/wiki/Nastran NASTRAN]] is available on the Windows desktop in the lab. If you need it somewhere else, email Ben&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=277</id>
		<title>UGS NX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=277"/>
				<updated>2012-11-08T05:11:41Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* NX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
==NX==&lt;br /&gt;
&lt;br /&gt;
UGS/Siemens NX 8.0 CAD/CAE package is available in /usr/local on the Linux machines and on the Windows workstations&lt;br /&gt;
&lt;br /&gt;
You can launch it from portal0 as follows:&lt;br /&gt;
&lt;br /&gt;
#  vglconnect -s viz001 #or one of the other graphics machiens&lt;br /&gt;
#(run directly on portal0 for now)&lt;br /&gt;
  /usr/local/nx/ugs080/run.sh&lt;br /&gt;
&lt;br /&gt;
You can launch the documentation by opening &lt;br /&gt;
/usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html in your favorite web browser. It is known to display correctly in Iceweasel but not the current version of Google Chrome &lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html&lt;br /&gt;
&lt;br /&gt;
Installers are also available for personal machines. Please email Ben and/or Ken for instructions.&lt;br /&gt;
&lt;br /&gt;
==Windows Troubleshooting==&lt;br /&gt;
If you get an error about License Bundles on the Windows machines, you need to open the NX &amp;quot;License Options&amp;quot; from the programs menu and select the current license bundles (if you follow the directions in the error message the settings won't persist). Feel free to follow along with this [[http://fluid.colorado.edu/~matthb2/videos/nx_license/nx_license_bundle.mp4 video]] (note that the available bundles may change over time, just choose the two that you're offered). &lt;br /&gt;
&lt;br /&gt;
== CAST ==&lt;br /&gt;
&lt;br /&gt;
The NX CAST tutorial library for version 8.0 is also installed. You can launch it in Iceweasel as with the main documentation:&lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/cast080/html/index.html&lt;br /&gt;
&lt;br /&gt;
== NASTRAN ==&lt;br /&gt;
[[http://en.wikipedia.org/wiki/Nastran NASTRAN]] is available on the Windows desktop in the lab. If you need it somewhere else, email Ben&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=276</id>
		<title>UGS NX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=276"/>
				<updated>2012-11-08T05:10:38Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* NASTRAN */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
==NX==&lt;br /&gt;
&lt;br /&gt;
UGS/Siemens NX 8.0 CAD/CAE package is available in /usr/local on the Linux machines and on the Windows workstations&lt;br /&gt;
&lt;br /&gt;
You can launch it from portal0 as follows:&lt;br /&gt;
&lt;br /&gt;
  vglconnect -s viz001 #or one of the other graphics machiens&lt;br /&gt;
  /usr/local/nx/ugs080/run.sh&lt;br /&gt;
&lt;br /&gt;
You can launch the documentation by opening &lt;br /&gt;
/usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html in your favorite web browser. It is known to display correctly in Iceweasel but not the current version of Google Chrome &lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html&lt;br /&gt;
&lt;br /&gt;
Installers are also available for personal machines. Please email Ben and/or Ken for instructions.&lt;br /&gt;
&lt;br /&gt;
==Windows Troubleshooting==&lt;br /&gt;
If you get an error about License Bundles on the Windows machines, you need to open the NX &amp;quot;License Options&amp;quot; from the programs menu and select the current license bundles (if you follow the directions in the error message the settings won't persist). Feel free to follow along with this [[http://fluid.colorado.edu/~matthb2/videos/nx_license/nx_license_bundle.mp4 video]] (note that the available bundles may change over time, just choose the two that you're offered). &lt;br /&gt;
&lt;br /&gt;
== CAST ==&lt;br /&gt;
&lt;br /&gt;
The NX CAST tutorial library for version 8.0 is also installed. You can launch it in Iceweasel as with the main documentation:&lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/cast080/html/index.html&lt;br /&gt;
&lt;br /&gt;
== NASTRAN ==&lt;br /&gt;
[[http://en.wikipedia.org/wiki/Nastran NASTRAN]] is available on the Windows desktop in the lab. If you need it somewhere else, email Ben&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=275</id>
		<title>UGS NX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UGS_NX&amp;diff=275"/>
				<updated>2012-11-08T05:10:02Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
==NX==&lt;br /&gt;
&lt;br /&gt;
UGS/Siemens NX 8.0 CAD/CAE package is available in /usr/local on the Linux machines and on the Windows workstations&lt;br /&gt;
&lt;br /&gt;
You can launch it from portal0 as follows:&lt;br /&gt;
&lt;br /&gt;
  vglconnect -s viz001 #or one of the other graphics machiens&lt;br /&gt;
  /usr/local/nx/ugs080/run.sh&lt;br /&gt;
&lt;br /&gt;
You can launch the documentation by opening &lt;br /&gt;
/usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html in your favorite web browser. It is known to display correctly in Iceweasel but not the current version of Google Chrome &lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/ugs080/ugdoc/html_files/nx_help/index.html&lt;br /&gt;
&lt;br /&gt;
Installers are also available for personal machines. Please email Ben and/or Ken for instructions.&lt;br /&gt;
&lt;br /&gt;
==Windows Troubleshooting==&lt;br /&gt;
If you get an error about License Bundles on the Windows machines, you need to open the NX &amp;quot;License Options&amp;quot; from the programs menu and select the current license bundles (if you follow the directions in the error message the settings won't persist). Feel free to follow along with this [[http://fluid.colorado.edu/~matthb2/videos/nx_license/nx_license_bundle.mp4 video]] (note that the available bundles may change over time, just choose the two that you're offered). &lt;br /&gt;
&lt;br /&gt;
== CAST ==&lt;br /&gt;
&lt;br /&gt;
The NX CAST tutorial library for version 8.0 is also installed. You can launch it in Iceweasel as with the main documentation:&lt;br /&gt;
&lt;br /&gt;
  iceweasel file:///usr/local/nx/cast080/html/index.html&lt;br /&gt;
&lt;br /&gt;
== NASTRAN ==&lt;br /&gt;
NASTRAN is available on the Windows desktop in the lab. If you need it somewhere else, email Ben&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=UNIX&amp;diff=274</id>
		<title>UNIX</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=UNIX&amp;diff=274"/>
				<updated>2012-11-01T21:49:44Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most of our systems (and general HPC resources) run some UNIX derivative. Much of the software is command line based, so it's worthwhile to learn the basics. &lt;br /&gt;
&lt;br /&gt;
There are tons of free resources on the web for getting started, for example this [[http://learncodethehardway.org/cli/book book]]. There should also be a &amp;quot;for dummies&amp;quot; book in the lab. &lt;br /&gt;
&lt;br /&gt;
As you find resources that are helpful, please update this page.&lt;br /&gt;
&lt;br /&gt;
== Connecting (SSH) ==&lt;br /&gt;
Windows:&lt;br /&gt;
[[http://www.chiark.greenend.org.uk/~sgtatham/putty PuTTY SSH Client]]&lt;br /&gt;
[[http://winscp.net/eng/index.php WinSCP file transfer tool]]&lt;br /&gt;
&lt;br /&gt;
MacOS and Linux users can use [[http://openssh.org/ OpennSSH]] on the command line (it generally comes with the OS).&lt;br /&gt;
&lt;br /&gt;
== Command Line Basics ==&lt;br /&gt;
[[http://code.google.com/edu/tools101/index.html Google's tutorial]]&lt;br /&gt;
&lt;br /&gt;
[[https://www.rc.colorado.edu/support/tutorials/linux Slides and Video from CU's Research Computing group]]&lt;br /&gt;
== Graphical Sessions (VNC) ==&lt;br /&gt;
See [[VNC]]&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=273</id>
		<title>VNC</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=273"/>
				<updated>2012-11-01T18:01:44Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Finding an Existing Session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;VNC is a tool which projects a GUI session over the network. If may be useful if you want to use GUI tools remotely when X forwarding performs poorly. &lt;br /&gt;
&lt;br /&gt;
'''Warning: This is still being tested and should NOT be considered stable (portal0 may be rebooted without warning)'''&lt;br /&gt;
'''Warning: The vnc password is transmitted in clear text over the network and should not be considered secure'''&lt;br /&gt;
&lt;br /&gt;
Portal0 is designated to host VNC sessions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can start a session as follows:&lt;br /&gt;
&lt;br /&gt;
  ssh jumpgate-phasta.colorado.edu&lt;br /&gt;
  ssh portal0&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  start_vnc.sh&lt;br /&gt;
&lt;br /&gt;
And follow the directions&lt;br /&gt;
 &lt;br /&gt;
(You may want to remember your password and port number so that you can reuse your session)&lt;br /&gt;
&lt;br /&gt;
When you are done, end your session by&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  stop_vnc.sh&lt;br /&gt;
&lt;br /&gt;
== OpenGL == &lt;br /&gt;
&lt;br /&gt;
Portal0 is equipped with a VirtualGL install which will allow you to use OpenGL programs (which do not use pthreads)&lt;br /&gt;
&lt;br /&gt;
Simply wrap your OpenGL program with the &amp;quot;vglrun&amp;quot; command&lt;br /&gt;
  vlgrun glxgears&lt;br /&gt;
&lt;br /&gt;
If you have access to another VirtualGL server you can connect to it first (Portal0 doesn't have a particularly fast graphics processor)&lt;br /&gt;
  vglconnect server&lt;br /&gt;
  vglrun glxgears&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that VGL uses a number of threads. If you have trouble with vglrun crashing with a message about Thread::Start() make sure you haven't set your stack size too large (remove any ulimit -s or ulimit -n calls from your shell start scripts)&lt;br /&gt;
&lt;br /&gt;
== Clients == &lt;br /&gt;
&lt;br /&gt;
Portal0 uses TurboVNC from the VirtualGL project, available from http://www.virtualgl.org/Downloads/TurboVNC&lt;br /&gt;
&lt;br /&gt;
Other VNC viewers will also work, such as TightVNC and RealVNC&lt;br /&gt;
&lt;br /&gt;
== View Only Mode == &lt;br /&gt;
&lt;br /&gt;
To share your desktop with another user in view only mode set a view only password &lt;br /&gt;
by running&lt;br /&gt;
  vncpasswd&lt;br /&gt;
&lt;br /&gt;
Have the other user connect in the same way you would but have them set their viewer to be in view only mode and use your view only password. Typically this is done as follows:&lt;br /&gt;
  vncviewer -viewonly&lt;br /&gt;
&lt;br /&gt;
== Windows == &lt;br /&gt;
The PuTTY SSH client can handle ssh tunneling on Windows based machines. You can download it here: http://www.chiark.greenend.org.uk/~sgtatham/putty/&lt;br /&gt;
&lt;br /&gt;
When you open putty, enter jumpgate-phasta.colorado.edu as in the Host Name box. Then click the + button next to SSH on the left pane (to expand the SSH tree node). Choose the Tunnels page. The start_vnc.sh script should tell you to run &amp;quot;ssh -L????:portal0:???? jumpgate-phasta.colorado.edu&amp;quot; on your machine. Enter the number between the -L and the first colon in the &amp;quot;Source port&amp;quot; box. Enter the rest in the Destination box (starting with portal0) and '''click the add button'''. Then click &amp;quot;Open&amp;quot; and login as normal. You will then be able to use a vncviewer as instructed by the script. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
The script says:&lt;br /&gt;
ssh -L5905:portal0:5900 jumpgate-phasta.colorado.edu&lt;br /&gt;
enter 5905 in the Source port box&lt;br /&gt;
enter portal0:5900 in the destination box.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try using this viewer utility&lt;br /&gt;
http://www.tightvnc.com/download/1.3.10/tightvnc-1.3.10_x86_viewer.zip&lt;br /&gt;
&lt;br /&gt;
== Web Based Viewer ==&lt;br /&gt;
&lt;br /&gt;
If you can't or don't want to install a VNC viewer you can use a Java based one. You will need a JVM and a Java browser plugin. You will also need the port that the start_vnc script assigned you to be free on your local computer&lt;br /&gt;
&lt;br /&gt;
Forward your session through jumpgate as before before, adding a second port, 580n. For example, if the script tells you to &lt;br /&gt;
&lt;br /&gt;
ssh -L5905:portal0:5902 jumpgate-phasta.colorado.edu you should&lt;br /&gt;
  ssh -L5902:portal0:5902 -L5802:portal0:5802 jumpgate-phasta.colorado.edu&lt;br /&gt;
Then point your browser to http://localhost:5802 and log in with the password specified by the script when prompted. (Replace 2 with the value specified by the script)&lt;br /&gt;
&lt;br /&gt;
== Changing the Size (Resolution) of an Existing Session ==&lt;br /&gt;
&lt;br /&gt;
You can usually use the &amp;quot;xrandr&amp;quot; tool to change the resolution of a running vnc session. First you'll need to know your session's display number (this should be the last digit or two of the port number). For example, if your VNC session is running on port 5902, then your screen number should be :2. For this example, we'll use screen 2. &lt;br /&gt;
&lt;br /&gt;
Once you know your screen number, you can see the list of supported modes as follows:&lt;br /&gt;
  xrandr -display :2&lt;br /&gt;
&lt;br /&gt;
Once you pick the one you want (generally the same size or smaller than the native resolution of your client), you can choose it by running a command like&lt;br /&gt;
  xrandr -s 1400x1050 -display :2&lt;br /&gt;
&lt;br /&gt;
(this example will set the resolution to 1400 pixels by 1050 pixels)&lt;br /&gt;
&lt;br /&gt;
You'll probably be disconnected at this point, but when you reconnect your screen size should be changed (hopefully without crashing your running programs). &lt;br /&gt;
&lt;br /&gt;
== Finding an Existing Session ==&lt;br /&gt;
SSH to portal0 and then run:&lt;br /&gt;
  /opt/vnc_script/findsession.sh&lt;br /&gt;
&lt;br /&gt;
Which will return the shortened port number of each of your currently running sessions.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting == &lt;br /&gt;
&lt;br /&gt;
If you have used vncserver (It doesn't matter which version) on a SCOREC machine before, you will need to clear your vnc settings for the script to work. You can do this by running rm -rf ~/.vnc&lt;br /&gt;
&lt;br /&gt;
stop_vnc.sh may display some errors; this is normal.&lt;br /&gt;
&lt;br /&gt;
If you have trouble deleting ~/.vnc send an email to Benjamin.A.Matthews@colorado.edu&lt;br /&gt;
&lt;br /&gt;
If any of these commands fail, you may need to source /etc/profile to get the necessary environment variables (this should be fixed soon)&lt;br /&gt;
&lt;br /&gt;
VirtualGL has trouble with some threaded programs. If your OpenGL program exhibits segmentation faults or other issues, this could be the problem. Check back for the solution later. &lt;br /&gt;
&lt;br /&gt;
If the given password is rejected you can run stop_vnc.sh and restart to get a new one. Occasionally the random password generator may generate passwords which VNC doesn't like.&lt;br /&gt;
&lt;br /&gt;
If VirtualGL complains about not being able to get a 24bit FB config either vglconnect to another VirtualGL enabled server or complain to Benjamin.A.Matthews@Colorado.edu&lt;br /&gt;
&lt;br /&gt;
If your VNC connection is very slow, you might want to try changing the compression and encoding options. See your vncviewer's documentation or try this&lt;br /&gt;
  vncviewer -encodings tight -quality 6 -compresslevel 6&lt;br /&gt;
If you have trouble with text distortion try adding &lt;br /&gt;
  -nojpeg&lt;br /&gt;
&lt;br /&gt;
If you're running OSX and see an error about Zlib, try changing your compression settings (maximum quality usually works) or use a different client. RealVNC and certain versions of ChickenOfTheVNC both exhibit this issue. The latest build of TigerVNC should work reliably, as does the Java based TightVNC client.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=272</id>
		<title>VNC</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=272"/>
				<updated>2012-11-01T18:00:45Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;VNC is a tool which projects a GUI session over the network. If may be useful if you want to use GUI tools remotely when X forwarding performs poorly. &lt;br /&gt;
&lt;br /&gt;
'''Warning: This is still being tested and should NOT be considered stable (portal0 may be rebooted without warning)'''&lt;br /&gt;
'''Warning: The vnc password is transmitted in clear text over the network and should not be considered secure'''&lt;br /&gt;
&lt;br /&gt;
Portal0 is designated to host VNC sessions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can start a session as follows:&lt;br /&gt;
&lt;br /&gt;
  ssh jumpgate-phasta.colorado.edu&lt;br /&gt;
  ssh portal0&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  start_vnc.sh&lt;br /&gt;
&lt;br /&gt;
And follow the directions&lt;br /&gt;
 &lt;br /&gt;
(You may want to remember your password and port number so that you can reuse your session)&lt;br /&gt;
&lt;br /&gt;
When you are done, end your session by&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  stop_vnc.sh&lt;br /&gt;
&lt;br /&gt;
== OpenGL == &lt;br /&gt;
&lt;br /&gt;
Portal0 is equipped with a VirtualGL install which will allow you to use OpenGL programs (which do not use pthreads)&lt;br /&gt;
&lt;br /&gt;
Simply wrap your OpenGL program with the &amp;quot;vglrun&amp;quot; command&lt;br /&gt;
  vlgrun glxgears&lt;br /&gt;
&lt;br /&gt;
If you have access to another VirtualGL server you can connect to it first (Portal0 doesn't have a particularly fast graphics processor)&lt;br /&gt;
  vglconnect server&lt;br /&gt;
  vglrun glxgears&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that VGL uses a number of threads. If you have trouble with vglrun crashing with a message about Thread::Start() make sure you haven't set your stack size too large (remove any ulimit -s or ulimit -n calls from your shell start scripts)&lt;br /&gt;
&lt;br /&gt;
== Clients == &lt;br /&gt;
&lt;br /&gt;
Portal0 uses TurboVNC from the VirtualGL project, available from http://www.virtualgl.org/Downloads/TurboVNC&lt;br /&gt;
&lt;br /&gt;
Other VNC viewers will also work, such as TightVNC and RealVNC&lt;br /&gt;
&lt;br /&gt;
== View Only Mode == &lt;br /&gt;
&lt;br /&gt;
To share your desktop with another user in view only mode set a view only password &lt;br /&gt;
by running&lt;br /&gt;
  vncpasswd&lt;br /&gt;
&lt;br /&gt;
Have the other user connect in the same way you would but have them set their viewer to be in view only mode and use your view only password. Typically this is done as follows:&lt;br /&gt;
  vncviewer -viewonly&lt;br /&gt;
&lt;br /&gt;
== Windows == &lt;br /&gt;
The PuTTY SSH client can handle ssh tunneling on Windows based machines. You can download it here: http://www.chiark.greenend.org.uk/~sgtatham/putty/&lt;br /&gt;
&lt;br /&gt;
When you open putty, enter jumpgate-phasta.colorado.edu as in the Host Name box. Then click the + button next to SSH on the left pane (to expand the SSH tree node). Choose the Tunnels page. The start_vnc.sh script should tell you to run &amp;quot;ssh -L????:portal0:???? jumpgate-phasta.colorado.edu&amp;quot; on your machine. Enter the number between the -L and the first colon in the &amp;quot;Source port&amp;quot; box. Enter the rest in the Destination box (starting with portal0) and '''click the add button'''. Then click &amp;quot;Open&amp;quot; and login as normal. You will then be able to use a vncviewer as instructed by the script. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
The script says:&lt;br /&gt;
ssh -L5905:portal0:5900 jumpgate-phasta.colorado.edu&lt;br /&gt;
enter 5905 in the Source port box&lt;br /&gt;
enter portal0:5900 in the destination box.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try using this viewer utility&lt;br /&gt;
http://www.tightvnc.com/download/1.3.10/tightvnc-1.3.10_x86_viewer.zip&lt;br /&gt;
&lt;br /&gt;
== Web Based Viewer ==&lt;br /&gt;
&lt;br /&gt;
If you can't or don't want to install a VNC viewer you can use a Java based one. You will need a JVM and a Java browser plugin. You will also need the port that the start_vnc script assigned you to be free on your local computer&lt;br /&gt;
&lt;br /&gt;
Forward your session through jumpgate as before before, adding a second port, 580n. For example, if the script tells you to &lt;br /&gt;
&lt;br /&gt;
ssh -L5905:portal0:5902 jumpgate-phasta.colorado.edu you should&lt;br /&gt;
  ssh -L5902:portal0:5902 -L5802:portal0:5802 jumpgate-phasta.colorado.edu&lt;br /&gt;
Then point your browser to http://localhost:5802 and log in with the password specified by the script when prompted. (Replace 2 with the value specified by the script)&lt;br /&gt;
&lt;br /&gt;
== Changing the Size (Resolution) of an Existing Session ==&lt;br /&gt;
&lt;br /&gt;
You can usually use the &amp;quot;xrandr&amp;quot; tool to change the resolution of a running vnc session. First you'll need to know your session's display number (this should be the last digit or two of the port number). For example, if your VNC session is running on port 5902, then your screen number should be :2. For this example, we'll use screen 2. &lt;br /&gt;
&lt;br /&gt;
Once you know your screen number, you can see the list of supported modes as follows:&lt;br /&gt;
  xrandr -display :2&lt;br /&gt;
&lt;br /&gt;
Once you pick the one you want (generally the same size or smaller than the native resolution of your client), you can choose it by running a command like&lt;br /&gt;
  xrandr -s 1400x1050 -display :2&lt;br /&gt;
&lt;br /&gt;
(this example will set the resolution to 1400 pixels by 1050 pixels)&lt;br /&gt;
&lt;br /&gt;
You'll probably be disconnected at this point, but when you reconnect your screen size should be changed (hopefully without crashing your running programs). &lt;br /&gt;
&lt;br /&gt;
== Finding an Existing Session ==&lt;br /&gt;
Run:&lt;br /&gt;
  /opt/vnc_script/findsession.sh&lt;br /&gt;
&lt;br /&gt;
Which will return the shortened port number of each of your currently running sessions.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting == &lt;br /&gt;
&lt;br /&gt;
If you have used vncserver (It doesn't matter which version) on a SCOREC machine before, you will need to clear your vnc settings for the script to work. You can do this by running rm -rf ~/.vnc&lt;br /&gt;
&lt;br /&gt;
stop_vnc.sh may display some errors; this is normal.&lt;br /&gt;
&lt;br /&gt;
If you have trouble deleting ~/.vnc send an email to Benjamin.A.Matthews@colorado.edu&lt;br /&gt;
&lt;br /&gt;
If any of these commands fail, you may need to source /etc/profile to get the necessary environment variables (this should be fixed soon)&lt;br /&gt;
&lt;br /&gt;
VirtualGL has trouble with some threaded programs. If your OpenGL program exhibits segmentation faults or other issues, this could be the problem. Check back for the solution later. &lt;br /&gt;
&lt;br /&gt;
If the given password is rejected you can run stop_vnc.sh and restart to get a new one. Occasionally the random password generator may generate passwords which VNC doesn't like.&lt;br /&gt;
&lt;br /&gt;
If VirtualGL complains about not being able to get a 24bit FB config either vglconnect to another VirtualGL enabled server or complain to Benjamin.A.Matthews@Colorado.edu&lt;br /&gt;
&lt;br /&gt;
If your VNC connection is very slow, you might want to try changing the compression and encoding options. See your vncviewer's documentation or try this&lt;br /&gt;
  vncviewer -encodings tight -quality 6 -compresslevel 6&lt;br /&gt;
If you have trouble with text distortion try adding &lt;br /&gt;
  -nojpeg&lt;br /&gt;
&lt;br /&gt;
If you're running OSX and see an error about Zlib, try changing your compression settings (maximum quality usually works) or use a different client. RealVNC and certain versions of ChickenOfTheVNC both exhibit this issue. The latest build of TigerVNC should work reliably, as does the Java based TightVNC client.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=271</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=271"/>
				<updated>2012-11-01T01:27:57Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
Matlab is installed only on Viz001 and Viz002 (since we only have node-locked licenses). Several recent versions are installed in /opt/MATLAB. Currently, the full path to the latest version is:&lt;br /&gt;
&lt;br /&gt;
  /opt/MATLAB/R2012b/bin/matlab&lt;br /&gt;
&lt;br /&gt;
The licenses expire periodically, but can be renewed. If you need an older version and find that the license has expired, please email Benjamin.A.Matthews@Colorado.edu&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=270</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=MATLAB&amp;diff=270"/>
				<updated>2012-11-01T01:27:13Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
Matlab is installed only on Viz001 and Viz002 (since we only have node-locked licenses). Several versions are installed in /opt/MATLAB. Currently, the full path to the latest version is:&lt;br /&gt;
&lt;br /&gt;
  /opt/MATLAB/R2012b/bin/matlab&lt;br /&gt;
&lt;br /&gt;
The licenses expire periodically, but can be renewed. If you need an older version and find that the license has expired, please email Benjamin.A.Matthews@Colorado.edu&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	<entry>
		<id>https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=269</id>
		<title>VNC</title>
		<link rel="alternate" type="text/html" href="https://fluid.colorado.edu/wiki/index.php?title=VNC&amp;diff=269"/>
				<updated>2012-10-30T01:19:46Z</updated>
		
		<summary type="html">&lt;p&gt;Matthb2: /* Troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;VNC is a tool which projects a GUI session over the network. If may be useful if you want to use GUI tools remotely when X forwarding performs poorly. &lt;br /&gt;
&lt;br /&gt;
'''Warning: This is still being tested and should NOT be considered stable (portal0 may be rebooted without warning)'''&lt;br /&gt;
'''Warning: The vnc password is transmitted in clear text over the network and should not be considered secure'''&lt;br /&gt;
&lt;br /&gt;
Portal0 is designated to host VNC sessions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can start a session as follows:&lt;br /&gt;
&lt;br /&gt;
  ssh jumpgate-phasta.colorado.edu&lt;br /&gt;
  ssh portal0&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  start_vnc.sh&lt;br /&gt;
&lt;br /&gt;
And follow the directions&lt;br /&gt;
 &lt;br /&gt;
(You may want to remember your password and port number so that you can reuse your session)&lt;br /&gt;
&lt;br /&gt;
When you are done, end your session by&lt;br /&gt;
  source /etc/profile&lt;br /&gt;
  stop_vnc.sh&lt;br /&gt;
&lt;br /&gt;
== OpenGL == &lt;br /&gt;
&lt;br /&gt;
Portal0 is equipped with a VirtualGL install which will allow you to use OpenGL programs (which do not use pthreads)&lt;br /&gt;
&lt;br /&gt;
Simply wrap your OpenGL program with the &amp;quot;vglrun&amp;quot; command&lt;br /&gt;
  vlgrun glxgears&lt;br /&gt;
&lt;br /&gt;
If you have access to another VirtualGL server you can connect to it first (Portal0 doesn't have a particularly fast graphics processor)&lt;br /&gt;
  vglconnect server&lt;br /&gt;
  vglrun glxgears&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that VGL uses a number of threads. If you have trouble with vglrun crashing with a message about Thread::Start() make sure you haven't set your stack size too large (remove any ulimit -s or ulimit -n calls from your shell start scripts)&lt;br /&gt;
&lt;br /&gt;
== Clients == &lt;br /&gt;
&lt;br /&gt;
Portal0 uses TurboVNC from the VirtualGL project, available from http://www.virtualgl.org/Downloads/TurboVNC&lt;br /&gt;
&lt;br /&gt;
Other VNC viewers will also work, such as TightVNC and RealVNC&lt;br /&gt;
&lt;br /&gt;
== View Only Mode == &lt;br /&gt;
&lt;br /&gt;
To share your desktop with another user in view only mode set a view only password &lt;br /&gt;
by running&lt;br /&gt;
  vncpasswd&lt;br /&gt;
&lt;br /&gt;
Have the other user connect in the same way you would but have them set their viewer to be in view only mode and use your view only password. Typically this is done as follows:&lt;br /&gt;
  vncviewer -viewonly&lt;br /&gt;
&lt;br /&gt;
== Windows == &lt;br /&gt;
The PuTTY SSH client can handle ssh tunneling on Windows based machines. You can download it here: http://www.chiark.greenend.org.uk/~sgtatham/putty/&lt;br /&gt;
&lt;br /&gt;
When you open putty, enter jumpgate-phasta.colorado.edu as in the Host Name box. Then click the + button next to SSH on the left pane (to expand the SSH tree node). Choose the Tunnels page. The start_vnc.sh script should tell you to run &amp;quot;ssh -L????:portal0:???? jumpgate-phasta.colorado.edu&amp;quot; on your machine. Enter the number between the -L and the first colon in the &amp;quot;Source port&amp;quot; box. Enter the rest in the Destination box (starting with portal0) and '''click the add button'''. Then click &amp;quot;Open&amp;quot; and login as normal. You will then be able to use a vncviewer as instructed by the script. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
The script says:&lt;br /&gt;
ssh -L5905:portal0:5900 jumpgate-phasta.colorado.edu&lt;br /&gt;
enter 5905 in the Source port box&lt;br /&gt;
enter portal0:5900 in the destination box.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try using this viewer utility&lt;br /&gt;
http://www.tightvnc.com/download/1.3.10/tightvnc-1.3.10_x86_viewer.zip&lt;br /&gt;
&lt;br /&gt;
== Web Based Viewer ==&lt;br /&gt;
&lt;br /&gt;
If you can't or don't want to install a VNC viewer you can use a Java based one. You will need a JVM and a Java browser plugin. You will also need the port that the start_vnc script assigned you to be free on your local computer&lt;br /&gt;
&lt;br /&gt;
Forward your session through jumpgate as before before, adding a second port, 580n. For example, if the script tells you to &lt;br /&gt;
&lt;br /&gt;
ssh -L5905:portal0:5902 jumpgate-phasta.colorado.edu you should&lt;br /&gt;
  ssh -L5902:portal0:5902 -L5802:portal0:5802 jumpgate-phasta.colorado.edu&lt;br /&gt;
Then point your browser to http://localhost:5802 and log in with the password specified by the script when prompted. (Replace 2 with the value specified by the script)&lt;br /&gt;
&lt;br /&gt;
== Changing the Size (Resolution) of an Existing Session ==&lt;br /&gt;
&lt;br /&gt;
You can usually use the &amp;quot;xrandr&amp;quot; tool to change the resolution of a running vnc session. First you'll need to know your session's display number (this should be the last digit or two of the port number). For example, if your VNC session is running on port 5902, then your screen number should be :2. For this example, we'll use screen 2. &lt;br /&gt;
&lt;br /&gt;
Once you know your screen number, you can see the list of supported modes as follows:&lt;br /&gt;
  xrandr -display :2&lt;br /&gt;
&lt;br /&gt;
Once you pick the one you want (generally the same size or smaller than the native resolution of your client), you can choose it by running a command like&lt;br /&gt;
  xrandr -s 1400x1050 -display :2&lt;br /&gt;
&lt;br /&gt;
(this example will set the resolution to 1400 pixels by 1050 pixels)&lt;br /&gt;
&lt;br /&gt;
You'll probably be disconnected at this point, but when you reconnect your screen size should be changed (hopefully without crashing your running programs). &lt;br /&gt;
&lt;br /&gt;
== Troubleshooting == &lt;br /&gt;
&lt;br /&gt;
If you have used vncserver (It doesn't matter which version) on a SCOREC machine before, you will need to clear your vnc settings for the script to work. You can do this by running rm -rf ~/.vnc&lt;br /&gt;
&lt;br /&gt;
stop_vnc.sh may display some errors; this is normal.&lt;br /&gt;
&lt;br /&gt;
If you have trouble deleting ~/.vnc send an email to Benjamin.A.Matthews@colorado.edu&lt;br /&gt;
&lt;br /&gt;
If any of these commands fail, you may need to source /etc/profile to get the necessary environment variables (this should be fixed soon)&lt;br /&gt;
&lt;br /&gt;
VirtualGL has trouble with some threaded programs. If your OpenGL program exhibits segmentation faults or other issues, this could be the problem. Check back for the solution later. &lt;br /&gt;
&lt;br /&gt;
If the given password is rejected you can run stop_vnc.sh and restart to get a new one. Occasionally the random password generator may generate passwords which VNC doesn't like.&lt;br /&gt;
&lt;br /&gt;
If VirtualGL complains about not being able to get a 24bit FB config either vglconnect to another VirtualGL enabled server or complain to Benjamin.A.Matthews@Colorado.edu&lt;br /&gt;
&lt;br /&gt;
If your VNC connection is very slow, you might want to try changing the compression and encoding options. See your vncviewer's documentation or try this&lt;br /&gt;
  vncviewer -encodings tight -quality 6 -compresslevel 6&lt;br /&gt;
If you have trouble with text distortion try adding &lt;br /&gt;
  -nojpeg&lt;br /&gt;
&lt;br /&gt;
If you're running OSX and see an error about Zlib, try changing your compression settings (maximum quality usually works) or use a different client. RealVNC and certain versions of ChickenOfTheVNC both exhibit this issue. The latest build of TigerVNC should work reliably, as does the Java based TightVNC client.&lt;/div&gt;</summary>
		<author><name>Matthb2</name></author>	</entry>

	</feed>