<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.sharcnet.ca/help/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Edward</id>
		<title>Documentation - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.sharcnet.ca/help/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Edward"/>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php/Special:Contributions/Edward"/>
		<updated>2026-04-09T19:04:44Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.2</generator>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=VALGRIND&amp;diff=17969</id>
		<title>VALGRIND</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=VALGRIND&amp;diff=17969"/>
				<updated>2019-06-06T14:41:49Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCDelete}}&lt;br /&gt;
{{GrahamUpdate}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=VALGRIND&lt;br /&gt;
|package_description=Memory debugger&lt;br /&gt;
|package_idnumber=132&lt;br /&gt;
}}&lt;br /&gt;
'''Valgrind''' is a powerful tool for analyzing programs, memory debugging, memory leak detection and profiling.  It is freely available under GNU license.  Version 3.5.0 is available on most SHARCNET systems.&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' To avoid spurious warnings it is important to not use too new of a version of GCC or OpenMPI.  We recommend&lt;br /&gt;
&lt;br /&gt;
* gcc/4.8.2&lt;br /&gt;
* openmpi/gcc-debug/1.8.3 modules&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
Valgrind is a dynamic binary instrumentation framework that dynamically translates executables to add instrumentation and track all memory and register usages by a program.  The advantages of this approach are that&lt;br /&gt;
&lt;br /&gt;
* it can be directly run on any executable, and&lt;br /&gt;
* dynamic translation allows ultimate instrumentation&lt;br /&gt;
&lt;br /&gt;
while the disadvantages are&lt;br /&gt;
&lt;br /&gt;
* 5-100 x slow down depending on tool,&lt;br /&gt;
* 12-18 x increase in size of translated code, and&lt;br /&gt;
* corner cases may exist between translated code and original.&lt;br /&gt;
&lt;br /&gt;
Several tools have been built upon this framework.  These include&lt;br /&gt;
&lt;br /&gt;
* ''memcheck'' -  memory error detector&lt;br /&gt;
* ''cachegrind'' - cache and branch-prediction profiler&lt;br /&gt;
* ''callgrind'' - call-graph generating cache and branch prediction profiler&lt;br /&gt;
* ''helgrind'' - thread error detector&lt;br /&gt;
* ''DRD'' - thread error detector&lt;br /&gt;
* ''Massif'' - heap profiler&lt;br /&gt;
* ''DHAT'' - dynamic heap analysis tool&lt;br /&gt;
* ''SGCheck'' - experimental stack and global array overrun detector&lt;br /&gt;
* ''BBV'' - experimental basic block vector generation tool&lt;br /&gt;
&lt;br /&gt;
You are welcome to use any or all of these, but we have only used ''memcheck'' and ''cachegrind'' and only support ''memcheck''.&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
The primary used tool is ''memcheck''.  This is the default tool and the only one we discuss here.  Documentation for other tools can be found on the [http://www.valgrind.org valgrind website].  The memcheck tool detects several common memory errors&lt;br /&gt;
&lt;br /&gt;
* overrunning and underrunning heap blocks,&lt;br /&gt;
* overrunning top of stack,&lt;br /&gt;
* continuing to access released memory,&lt;br /&gt;
* using uninitialized values,&lt;br /&gt;
* incorrectly using memory copying routines,&lt;br /&gt;
* incorrectly paired allocation/release calls,&lt;br /&gt;
* relasing unallocated memory, and&lt;br /&gt;
* not releasing memory.&lt;br /&gt;
&lt;br /&gt;
We recommend running all new code under valgrind on small test cases (small due to the aforementioned ~10x slowdown).  This can save hours and hours of debugging.  Running the program under valgrind can be as simple as compiling with debugging information (adding the &amp;lt;tt&amp;gt;-g&amp;lt;/tt&amp;gt; flag) and running as &amp;lt;tt&amp;gt;valgrind &amp;lt;program&amp;gt; &amp;lt;arguements&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Serial code ==&lt;br /&gt;
&lt;br /&gt;
Consider the following ''bug.c'' code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
  double array[10];&lt;br /&gt;
&lt;br /&gt;
  // Execution depends on uninitialized value&lt;br /&gt;
  if (array[4] &amp;lt; 0.0)&lt;br /&gt;
    printf(&amp;quot;the results is negative\n&amp;quot;);&lt;br /&gt;
  else if (array[4] == 0.0)&lt;br /&gt;
    printf(&amp;quot;the results is zero\n&amp;quot;);&lt;br /&gt;
  else if (array[4] &amp;gt; 0.0)&lt;br /&gt;
    printf(&amp;quot;the results is positive\n&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    printf(&amp;quot;the results are special\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has an uninitialized value bug.  Running this under valgrind&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cc -Wall -g bug.c -o bug&lt;br /&gt;
valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
reports this&lt;br /&gt;
&lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x400511: main (bug.c:7)&lt;br /&gt;
 ==5955== &lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x40052C: main (bug.c:9)&lt;br /&gt;
 ==5955== &lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x400536: main (bug.c:9)&lt;br /&gt;
 ==5955== &lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x400551: main (bug.c:11)&lt;br /&gt;
&lt;br /&gt;
Note that valgrind only reports uninitialized values usage once they lead to non-determinism (i.e., when the program encounters a branch whose choice depends on the result of an uninitiated value).  This means you the first report you get is frequently not in the calculation done on the uninitialized values but rather the convergence test or print statement at the end of calculations (print statements contains a bunch of branches in order to handling printing of each different digit).&lt;br /&gt;
&lt;br /&gt;
=== Tracking down uninitialized values ===&lt;br /&gt;
&lt;br /&gt;
More typically a program will be composed of multiple routines that all work on the data.  To this end, consider the following ''bug.c'' code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void initialize_sequence(double* array, const int array_length) {&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  for (i=1; i&amp;lt;array_length+1; ++i)&lt;br /&gt;
    array[i] = i;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
double sum(const double* array, const int array_length) {&lt;br /&gt;
  double array_sum;&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array_sum += array[i];&lt;br /&gt;
&lt;br /&gt;
  return array_sum;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
  double array[10];&lt;br /&gt;
  const int array_length = sizeof(array)/sizeof(array[0]);&lt;br /&gt;
&lt;br /&gt;
  double array_sum;&lt;br /&gt;
&lt;br /&gt;
  initialize_sequence(array,array_length);&lt;br /&gt;
  array_sum = sum(array,array_length);&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;the sum of 0..%d is %f\n&amp;quot;, array_length-1, array_sum);&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has both indexing and uninitialized value bugs.  Despite this, directly running the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cc -Wall -g bug.c -o bug&lt;br /&gt;
./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will mostly likely produce the correct answer on most machines most of the time&lt;br /&gt;
&lt;br /&gt;
 the sum of 0..9 is 45.000000&lt;br /&gt;
&lt;br /&gt;
Running under valgrind&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
reliably gives many warnings of the following form&lt;br /&gt;
&lt;br /&gt;
 ==15930== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==15930==    at 0x5312CF0: __printf_fp (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==15930==    by 0x530E89F: vfprintf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==15930==    by 0x5318189: printf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==15930==    by 0x400722: main (bug.c:29)&lt;br /&gt;
&lt;br /&gt;
This is a typical numeric code example were the warnings first occur at a print statement because this is the first time the uninitialized value leads to non-determinism (i.e., the program's behaviour is random as it is taking or does not taking a branch based on a result computed from something that was not set by the programmer).&lt;br /&gt;
&lt;br /&gt;
We now know the problem is that something unset went into computing the value of ''array_sum'', so we should trace the ''array_sum'' calculation backwards through the program.  This quickly gets difficult as we then find ourselves also tracing back all variables that went into the ''array_sum'' calculation, and then all variables that went into those variables, and so on.&lt;br /&gt;
&lt;br /&gt;
Fortunately Valgrind provides a &amp;lt;tt&amp;gt;--track-origins=yes&amp;lt;/tt&amp;gt; flag to ease our search by telling us which variables are the source of the problem.  Re-running with this flag&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
valgrind --track-origins=yes ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
gives warning messages augmented to include the source of the uninitialized value that went into the computation of ''array_sum''&lt;br /&gt;
&lt;br /&gt;
 ==17589== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==17589==    at 0x5312CF0: __printf_fp (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==17589==    by 0x530E89F: vfprintf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==17589==    by 0x5318189: printf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==17589==    by 0x400722: main (bug.c:29)&lt;br /&gt;
 ==17589==  Uninitialised value was created by a stack allocation&lt;br /&gt;
 ==17589==    at 0x400632: sum (bug.c:10)&lt;br /&gt;
&lt;br /&gt;
Now we know the source of the uninitialized value in the ''array_sum'' computation was a local variable in the ''sum'' routine.  Looking into ''sum'' we hopefully figure out without too much difficulty that we forgot to initialize ''array_sum'' to zero.  If our program is producing the correct answer, it is only because we are getting lucky and ''array_sum'' happens to be allocated from memory that is initially zero.&lt;br /&gt;
&lt;br /&gt;
Correcting the ''sum'' routine&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
double sum(const double* array, const int array_length) {&lt;br /&gt;
  double array_sum;&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  array_sum = 0.0;&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array_sum += array[i];&lt;br /&gt;
&lt;br /&gt;
  return array_sum;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and re-running under valgrind reveals we are still getting uninitialized values warnings associated with the ''array_sum'' computation.  Now (using the &amp;lt;tt&amp;gt;--track-origins=yes&amp;lt;/tt&amp;gt;) they are of the form&lt;br /&gt;
&lt;br /&gt;
 ==18613== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==18613==    at 0x5312CF0: __printf_fp (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==18613==    by 0x530E89F: vfprintf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==18613==    by 0x5318189: printf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==18613==    by 0x40072C: main (bug.c:30)&lt;br /&gt;
 ==18613==  Uninitialised value was created by a stack allocation&lt;br /&gt;
 ==18613==    at 0x400690: main (bug.c:21)&lt;br /&gt;
&lt;br /&gt;
Valgrind is now telling us that a local variable inside ''main'' went into the computation of ''array_sum'' despite never being set.  This must be ''array'' itself as ''array_length'' is clearly set to the compiler computed &amp;lt;tt&amp;gt;sizeof(array)/sizeof(array[0])&amp;lt;/tt&amp;gt; value.&lt;br /&gt;
&lt;br /&gt;
Looking at ''main'' it is clear ''array'' should have been fully initialized by ''initialize_sequence''.  Careful examination of this routine reveals the final error.  The initialization loop was done using Fortran indices (1...''array_length'')  instead of C (0...''array_length-1'').  Correcting this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
void initialize_sequence(double* array, const int array_length) {&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array[i] = i;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
finally produces code the runs under valgrind without any warnings.&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' The Valgrind warnings were being generated because the ''array[0]'' value was not being initialized.  The code was also incorrect in that it was initializing ''array[array_length]'' which is one past the end of ''array''.  If you put this later error back into the program and run under Valgrind you will discover it does not produce any warnings.  This shows that even codes that successfully under Valgrind can still contain errors.&lt;br /&gt;
&lt;br /&gt;
=== Calling Valgrind from your program ===&lt;br /&gt;
&lt;br /&gt;
In some cases it can be helpful to call Valgrind directly from your program in order to check the status of various bits of memory.  This is easily done by including the ''valgrind/memcheck.h'' header file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;valgrind/memcheck.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then adding calls to the appropriate [http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs client check routines].  For example, here is a modified ''sum'' routine for the above program that prints a warning if it is called with an ''array'' that is not fully initialized&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
double sum(const double* array, const int array_length) {&lt;br /&gt;
  double array_sum;&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  if (VALGRIND_CHECK_MEM_IS_DEFINED(array,sizeof(double)*array_length)) &lt;br /&gt;
    fprintf(stderr,&amp;quot;sum called with an array that is not fully defined...\n&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array_sum += array[i];&lt;br /&gt;
&lt;br /&gt;
  return array_sum;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the ''bug.c'' code under Valgrind with this modification produces the following output&lt;br /&gt;
&lt;br /&gt;
 ==29765== Uninitialised byte(s) found during client check request&lt;br /&gt;
 ==29765==    at 0x400745: sum (bug.c:15)&lt;br /&gt;
 ==29765==    by 0x400832: main (bug.c:31)&lt;br /&gt;
 ==29765==  Address 0x7fefff8e8 is on thread 1's stack&lt;br /&gt;
 ==29765== &lt;br /&gt;
 sum called with an array that is not fully defined...&lt;br /&gt;
&lt;br /&gt;
== MPI code ==&lt;br /&gt;
&lt;br /&gt;
Consider the following ''bug.c'' MPI code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;mpi.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int argc,char *argv[]){&lt;br /&gt;
  int rank, size;&lt;br /&gt;
  int value;&lt;br /&gt;
&lt;br /&gt;
  MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
&lt;br /&gt;
  MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
  MPI_Comm_size(MPI_COMM_WORLD, &amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
  if (rank == 0 &amp;amp;&amp;amp; size &amp;gt; 1) {&lt;br /&gt;
    MPI_Request request;&lt;br /&gt;
&lt;br /&gt;
    MPI_Irecv(&amp;amp;value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &amp;amp;request);&lt;br /&gt;
    value = 0;&lt;br /&gt;
    MPI_Wait (&amp;amp;request, MPI_STATUS_IGNORE);&lt;br /&gt;
  }&lt;br /&gt;
  else if (rank == 1) {&lt;br /&gt;
    MPI_Request request;&lt;br /&gt;
&lt;br /&gt;
    MPI_Isend(&amp;amp;value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &amp;amp;request);&lt;br /&gt;
    value = 1;&lt;br /&gt;
    MPI_Wait(&amp;amp;request, MPI_STATUS_IGNORE);&lt;br /&gt;
  } &lt;br /&gt;
&lt;br /&gt;
  MPI_Finalize();&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has an uninitialized value bug and two race condition bugs around the use of value.&lt;br /&gt;
&lt;br /&gt;
# The first race condition is that rank==0 sets value=0 while at the same time doing a non-blocking receive into value (bug:16).&lt;br /&gt;
# The uninitialized value problem is that rank==1 starts a send of value to rank==0 without ever setting value (bug:22).&lt;br /&gt;
# The second race condition is that rank==1 sets value=1 while at the same time doing a non-blocking send of value (bug:23).&lt;br /&gt;
&lt;br /&gt;
=== Basic Functionality ===&lt;br /&gt;
&lt;br /&gt;
If we just straight up compile and run this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module unload intel openmpi&lt;br /&gt;
module load gcc/4.8.2 openmpi/gcc/1.8.3&lt;br /&gt;
mpicc -Wall -g bug.c -o bug&lt;br /&gt;
mpirun -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we presumably get a report about the uninitialized value, but it is buried in tens of thousands of other bogus error messages.&lt;br /&gt;
&lt;br /&gt;
This solution is to link against the valgrind openmpi debug wrapper library too&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpicc -Wall -g bug.c -L/usr/lib64/valgrind -lmpiwrap-amd64-linux -Xlinker -rpath=/usr/lib64/valgrind -o bug&lt;br /&gt;
mpirun -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now there are only a few bogus errors reported of the form&lt;br /&gt;
&lt;br /&gt;
 ==12598== Syscall param write(buf) points to uninitialised byte(s)&lt;br /&gt;
 ==12598==    at 0x53916FD: ??? (in /lib64/libpthread-2.12.so)&lt;br /&gt;
 ==12598==    by 0x8AC8E40: send_bytes (oob_tcp_sendrecv.c:84)&lt;br /&gt;
 ==12598==    by 0x8AC9471: mca_oob_tcp_send_handler (oob_tcp_sendrecv.c:205)&lt;br /&gt;
 ==12598==    by 0x616FA23: opal_libevent2021_event_base_loop (in /opt/sharcnet/openmpi/1.8.1/gcc-debug/lib/libopen-pal.so.6.1.1)&lt;br /&gt;
 ==12598==    by 0x5B7E78D: orte_progress_thread_engine (ess_base_std_app.c:456)&lt;br /&gt;
 ==12598==    by 0x538A9D0: start_thread (in /lib64/libpthread-2.12.so)&lt;br /&gt;
 ==12598==    by 0x8AB86FF: ???&lt;br /&gt;
&lt;br /&gt;
We know this isn't an issue with ''bug.c'' as the backtrace shows it is occurring in a pure OpenMPI thread (the backtrace starts with ''start_thread'' and all subsequent routines are not from ''bug.c'').  Skipping over these we now see Valgrind is picking up on sending the uninitialized value&lt;br /&gt;
&lt;br /&gt;
 ==12599== Uninitialised byte(s) found during client check request&lt;br /&gt;
 ==12599==    at 0x4E3641D: check_mem_is_defined_untyped (libmpiwrap.c:952)&lt;br /&gt;
 ==12599==    by 0x4E5BBC5: generic_Isend (libmpiwrap.c:908)&lt;br /&gt;
 ==12599==    by 0x4E5BEE9: PMPI_Isend (libmpiwrap.c:1393)&lt;br /&gt;
 ==12599==    by 0x400B02: main (bug.c:22)&lt;br /&gt;
 ==12599==  Address 0x7fefff5c4 is on thread 1's stack&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' If we want to avoid recompiling our program, we can also preload the ''mpiwrap-amd64-linux'' library instead of linking against it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpicc -Wall -g bug.c -o bug&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;$(which mpirun | sed -e 's|/bin/.*$|/lib|')${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}&amp;quot; \&lt;br /&gt;
LD_PRELOAD=/usr/lib64/valgrind/libmpiwrap-amd64-linux.so mpirun -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breaking out output by rank ===&lt;br /&gt;
&lt;br /&gt;
By default the Valgrind output from all the MPI ranks gets intermingled together on stderr.  Although they can be distinguished for the most part as each line is prefixed with the process number, it is frequently nice to write them out to individual files.  This can be done by using the ''mpirun'' &amp;lt;tt&amp;gt;--output-filename &amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt; option.  It captures the output of each rank to ''&amp;lt;filename&amp;gt;'' suffixed with the ''MPI_COMM_WORLD'' rank&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun --output-filename bug.log -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To redirect just the Valgrind output we need to use the Valgrind &amp;lt;tt&amp;gt;--log-file=&amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt; option with the special &amp;lt;tt&amp;gt;%q{&amp;lt;environment-variable&amp;gt;}&amp;lt;/tt&amp;gt; syntax&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np 2 valgrind --log-file=bug.log-%q{OMPI_COMM_WORLD_RANK} ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both of the above can also be done by wrapping the Valgrind call with Bash to perform redirection and/or environment variable expansion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np 2 /bin/bash -c 'exec valgrind ./bug &amp;gt; bug.log-$OMPI_COMM_WORLD_RANK 2&amp;gt;&amp;amp;1'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np 2 /bin/bash -c 'exec valgrind --log-file=bug.log-$OMPI_COMM_WORLD_RANK ./bug'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Advanced Functionality ===&lt;br /&gt;
&lt;br /&gt;
Now, if on top of this, we also bring in the valgrind enabled openmpi debug library (i.e., the ''debug'' version of our ''openmpi'' module), things get really sweet&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module unload gcc openmpi&lt;br /&gt;
module load gcc/4.8.2 openmpi/gcc-debug/1.8.3&lt;br /&gt;
mpicc -Wall -g bug.c -L/usr/lib64/valgrind -lmpiwrap-amd64-linux -Xlinker -rpath=/usr/lib64/valgrind -o bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now all the bugs in the code are detected and reported&lt;br /&gt;
&lt;br /&gt;
 ==27774== Uninitialised byte(s) found during client check request&lt;br /&gt;
 ==27774==    at 0x4E3641D: check_mem_is_defined_untyped (libmpiwrap.c:952)&lt;br /&gt;
 ==27774==    by 0x4E5BBC5: generic_Isend (libmpiwrap.c:908)&lt;br /&gt;
 ==27774==    by 0x4E5BEE9: PMPI_Isend (libmpiwrap.c:1393)&lt;br /&gt;
 ==27774==    by 0x402713: main (bug.c:22)&lt;br /&gt;
 ==27774==  Address 0x7fefff6f4 is on thread 1's stack&lt;br /&gt;
 &lt;br /&gt;
 ==27773== Invalid write of size 4&lt;br /&gt;
 ==27773==    at 0x4026A0: main (bug.c:16)&lt;br /&gt;
 ==27773==  Address 0x7fefff6f4 is on thread 1's stack&lt;br /&gt;
 &lt;br /&gt;
 ==27774== Invalid write of size 4&lt;br /&gt;
 ==27774==    at 0x40271B: main (bug.c:23)&lt;br /&gt;
 ==27774==  Address 0x7fefff6f4 is on thread 1's stack&lt;br /&gt;
&lt;br /&gt;
=== Suppression File ===&lt;br /&gt;
&lt;br /&gt;
There is also a valgrind suppression option &amp;lt;tt&amp;gt;--suppressions=&amp;quot;$(which mpirun | sed -e 's|/bin/.*|/share/openmpi/openmpi-valgrind.supp|')&amp;quot;&amp;lt;/tt&amp;gt;.  We have not observed any cases where this makes a difference yet though.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Valgrind Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.valgrind.org&lt;br /&gt;
&lt;br /&gt;
o Valgrind's Tool Suite&amp;lt;br&amp;gt;&lt;br /&gt;
http://valgrind.org/info/tools.html&lt;br /&gt;
&lt;br /&gt;
o kcachegrind (sharcnet does not have)&amp;lt;br&amp;gt;&lt;br /&gt;
http://kcachegrind.sourceforge.net/html/Download.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Software packages]]&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=User:Ppomorsk/Test&amp;diff=17964</id>
		<title>User:Ppomorsk/Test</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=User:Ppomorsk/Test&amp;diff=17964"/>
				<updated>2019-06-06T14:37:38Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCMissing}}&lt;br /&gt;
The header titles get automatically converted into tab titles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&amp;lt;big&amp;gt;'''PyCUDA''' makes it possible to easily use CUDA inside Python code.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Documentation can be found on the [http://mathema.tician.de/software/pycuda package webpage].&lt;br /&gt;
&lt;br /&gt;
This package is not currently installed as SHARCNET-supported software, but it's easy for users to install it on their own following instructions below.  If any difficulties are encountered when following these instructions, please ask SHARCNET staff for help.&lt;br /&gt;
&lt;br /&gt;
See also: [[PyOpenCL]]&lt;br /&gt;
&lt;br /&gt;
==SHARCNET installation instructions==&lt;br /&gt;
&lt;br /&gt;
===Monk cluster===&lt;br /&gt;
(These instructions were tested on Oct 22, 2014 )&lt;br /&gt;
&lt;br /&gt;
1. Unload the Intel compiler module (loaded by default), so that GCC becomes the default compiler. Also, use a later python version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module unload openmpi&lt;br /&gt;
module load gcc/4.8.2&lt;br /&gt;
module load openmpi/gcc/1.8.1&lt;br /&gt;
module load python/gcc/2.7.8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Note: openmpi module is loaded because the python module needs it (it is not actually used by PyCuda)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.  Create some directory you want to build the package in, cd into it, then get the PyCUDA source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone http://git.tiker.net/trees/pycuda.git&lt;br /&gt;
cd pycuda&lt;br /&gt;
git submodule init&lt;br /&gt;
git submodule update&lt;br /&gt;
&lt;br /&gt;
wget https://pypi.python.org/packages/source/p/pycuda/pycuda-2014.1.tar.gz#md5=fdc2f59e57ab7256a7e0df0d9d943022&lt;br /&gt;
tar xfz pycuda-2014.1.tar.gz&lt;br /&gt;
cd pycuda-2014.1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. At this point decide where you want the package to be installed.  In this example will use a directory called python_packages in the home directory.  If this directory does not yet exist, make it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p ~/python_packages/lib/python/&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Doing it this way creates the required subdirectories as well.&lt;br /&gt;
&lt;br /&gt;
4. Edit file Makefile.in to add --home flag pointing to the directory you created to the setup install line, so that it reads:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
${PYTHON_EXE} setup.py install --home=~/python_packages&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.You now need to update the PYTHONPATH variable to point to the library directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export PYTHONPATH=~/python_packages/lib/python/:$PYTHONPATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Configure and compile, providing a path to the CUDA files on monk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python configure.py --cuda-root=/opt/sharcnet/cuda/6.0.37/toolkit&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Do the first test of the installation to make sure the pycuda module can be imported, by starting python and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
import pycuda&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If no errors are reported, everything worked and the package is ready for use.&lt;br /&gt;
&lt;br /&gt;
8.  Add the lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module unload openmpi&lt;br /&gt;
module load gcc/4.8.2&lt;br /&gt;
module load openmpi/gcc/1.8.1&lt;br /&gt;
module load python/gcc/2.7.8&lt;br /&gt;
export PYTHONPATH=~/python_packages/lib/python/:$PYTHONPATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to your ~/.bashrc file so that this variable is set automatically for you on every login.&lt;br /&gt;
&lt;br /&gt;
9.  Test PyCUDA on a development node which has a GPU (the login node does not have one so PyCUDA tests will produce an error).  To do this, execute on monk login node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ssh mon54&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then go to the directory where you put the PyCuda source code, and execute:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python test/test_driver.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gives error:&lt;br /&gt;
&lt;br /&gt;
[ppomorsk@mon241:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] python test_driver.py&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;test_driver.py&amp;quot;, line 4, in &amp;lt;module&amp;gt;&lt;br /&gt;
    from pycuda.tools import mark_cuda_test&lt;br /&gt;
  File &amp;quot;/home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/tools.py&amp;quot;, line 30, in &amp;lt;module&amp;gt;&lt;br /&gt;
    import pycuda.driver as cuda&lt;br /&gt;
  File &amp;quot;/home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/driver.py&amp;quot;, line 2, in &amp;lt;module&amp;gt;&lt;br /&gt;
    from pycuda._driver import *  # noqa&lt;br /&gt;
 ImportError: /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so: undefined symbol: cuStreamAttachMemAsync&lt;br /&gt;
&lt;br /&gt;
ldd output&lt;br /&gt;
&lt;br /&gt;
 [ppomorsk@mon54:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] ldd /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so&lt;br /&gt;
&lt;br /&gt;
	linux-vdso.so.1 =&amp;gt;  (0x00007fffac5c1000)&lt;br /&gt;
&lt;br /&gt;
	libcuda.so.1 =&amp;gt; /usr/lib64/libcuda.so.1 (0x00002b7dbda9e000)&lt;br /&gt;
&lt;br /&gt;
	libcurand.so.6.0 =&amp;gt; /opt/sharcnet/cuda/6.0.37/toolkit/lib64/libcurand.so.6.0 (0x00002b7dbea01000)&lt;br /&gt;
&lt;br /&gt;
	libstdc++.so.6 =&amp;gt; /opt/sharcnet/gcc/4.8.2/lib64/libstdc++.so.6 (0x00002b7dc3f08000)&lt;br /&gt;
&lt;br /&gt;
	libm.so.6 =&amp;gt; /lib64/libm.so.6 (0x00002b7dc4211000)&lt;br /&gt;
	&lt;br /&gt;
libgcc_s.so.1 =&amp;gt; /opt/sharcnet/gcc/4.8.2/lib64/libgcc_s.so.1 (0x00002b7dc4496000)&lt;br /&gt;
	&lt;br /&gt;
libpthread.so.0 =&amp;gt; /lib64/libpthread.so.0 (0x00002b7dc46ac000)&lt;br /&gt;
	&lt;br /&gt;
libc.so.6 =&amp;gt; /lib64/libc.so.6 (0x00002b7dc48c9000)&lt;br /&gt;
	&lt;br /&gt;
libz.so.1 =&amp;gt; /lib64/libz.so.1 (0x00002b7dc4c5e000)&lt;br /&gt;
	&lt;br /&gt;
libdl.so.2 =&amp;gt; /lib64/libdl.so.2 (0x00002b7dc4e74000)&lt;br /&gt;
	&lt;br /&gt;
librt.so.1 =&amp;gt; /lib64/librt.so.1 (0x00002b7dc5078000)&lt;br /&gt;
	/lib64/ld-linux-x86-64.so.2 (0x00002b7dbd4a9000)&lt;br /&gt;
&lt;br /&gt;
and the symbol does seem to exist&lt;br /&gt;
&lt;br /&gt;
 [ppomorsk@mon54:/usr/lib64] readelf -Ws libcuda.so.331.89 | grep cuStreamAttachMemAsync&lt;br /&gt;
    43: 0000000000139890   538 FUNC    GLOBAL DEFAULT   10 cuStreamAttachMemAsync&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
try&lt;br /&gt;
&lt;br /&gt;
 python configure.py --cuda-root=/opt/sharcnet/cuda/6.0.37/toolkit --cudadrv-lib-dir=/usr/lib64&lt;br /&gt;
If everything is working properly, the output should look like this:&lt;br /&gt;
&lt;br /&gt;
http://pycuda.2962900.n2.nabble.com/PyCUDA-undefined-symbol-cuMemAllocPitch-v2-td7571641.html&lt;br /&gt;
&lt;br /&gt;
&amp;quot;cudart is the run-time interface, which is used by 'conventional' CUDA C &lt;br /&gt;
code. (cudaMemcpy) PyCUDA uses the driver interface. (cuMemcpy) &amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;mismatch between cuda.h and driver&amp;quot; ??&lt;br /&gt;
try older CUDA modules?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
python configure.py --cuda-root=/opt/sharcnet/cuda/5.5.22/toolkit --cudadrv-lib-dir=/usr/lib64&lt;br /&gt;
&lt;br /&gt;
with cuda/5.5.22 loaded&lt;br /&gt;
even basic cuda test program fails with&lt;br /&gt;
&lt;br /&gt;
FATAL: Error inserting nvidia (/lib/modules/2.6.32-431.3.1.el6.x86_64/kernel/drivers/video/nvidia.ko): No such device&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
runpaths problem&lt;br /&gt;
&lt;br /&gt;
 _driver.so has an RPATH, but none of the members contain libcuda.so.  so it was build wrong, in that it doesn't correctly encode its actual dependency.&lt;br /&gt;
&lt;br /&gt;
[ppomorsk@mon241:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] objdump -x /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so | grep RPATH&lt;br /&gt;
  RPATH                /opt/sharcnet/python/2.7.8/gcc/lib:/opt/sharcnet/gcc/4.8.2/lib64:/opt/sharcnet/cuda/6.0.37/cula/lib64:/opt/sharcnet/cuda/6.0.37/toolkit/lib64:/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64:/opt/sharcnet/mkl/10.3.9/lib/intel64&lt;br /&gt;
&lt;br /&gt;
Problem with python itself??&lt;br /&gt;
python/gcc/2.7.8 module has theano, which is GPU , so there might be some hidden dependency.&lt;br /&gt;
&lt;br /&gt;
Anyway, with theano python/gcc/2.7.8 ought to have an explicit CUDA dependency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[ppomorsk@mon54:~/pycuda] python test/test_driver.py &lt;br /&gt;
============================= test session starts ==============================&lt;br /&gt;
platform linux2 -- Python 2.6.6 -- pytest-2.3.4&lt;br /&gt;
collected 21 items &lt;br /&gt;
&lt;br /&gt;
test_driver.py .....................&lt;br /&gt;
&lt;br /&gt;
========================== 21 passed in 61.39 seconds ==========================&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10.  Try the example programs provided with the source code, found in the ''examples'' subdirectory of your pycuda source directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python examples/dump_properties.py&lt;br /&gt;
python examples/hello_gpu.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sample PyCUDA code==&lt;br /&gt;
This is code from the '''hello_gpu.py''' example program. It multiplies two vectors elementwise on the GPU, and then verifies the result with a standard calculation on the CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import pycuda.driver as drv&lt;br /&gt;
import pycuda.tools&lt;br /&gt;
import pycuda.autoinit&lt;br /&gt;
import numpy&lt;br /&gt;
import numpy.linalg as la&lt;br /&gt;
from pycuda.compiler import SourceModule&lt;br /&gt;
&lt;br /&gt;
mod = SourceModule(&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
__global__ void multiply_them(float *dest, float *a, float *b)&lt;br /&gt;
{&lt;br /&gt;
  const int i = threadIdx.x;&lt;br /&gt;
  dest[i] = a[i] * b[i];&lt;br /&gt;
}&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
multiply_them = mod.get_function(&amp;quot;multiply_them&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
a = numpy.random.randn(400).astype(numpy.float32)&lt;br /&gt;
b = numpy.random.randn(400).astype(numpy.float32)&lt;br /&gt;
&lt;br /&gt;
dest = numpy.zeros_like(a)&lt;br /&gt;
multiply_them(&lt;br /&gt;
        drv.Out(dest), drv.In(a), drv.In(b),&lt;br /&gt;
        block=(400,1,1))&lt;br /&gt;
&lt;br /&gt;
print dest-a*b&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Software packages]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
List of colors: [https://meta.wikimedia.org/wiki/Wiki_color_formatting_help Wiki_color_formatting_help] &lt;br /&gt;
&lt;br /&gt;
Simplest table&lt;br /&gt;
&lt;br /&gt;
{| &lt;br /&gt;
|AA || BB || CC&lt;br /&gt;
|-&lt;br /&gt;
|DD || EE || FF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Table with padding&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=5&lt;br /&gt;
|AA || BB || CC&lt;br /&gt;
|-&lt;br /&gt;
|DD || EE || FF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Table with border&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=5 style=&amp;quot;border:1px solid #BBB&amp;quot;&lt;br /&gt;
|- bgcolor=&amp;quot;#fafeff&amp;quot;&lt;br /&gt;
|AA || CC || EE&lt;br /&gt;
|- bgcolor=&amp;quot;#fafeff&amp;quot;&lt;br /&gt;
|BB || DD || FF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notebox:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=5 style=&amp;quot;border:4px solid #4682B4&amp;quot;&lt;br /&gt;
|- bgcolor=&amp;quot;#E0FFFF&amp;quot;&lt;br /&gt;
| This is a notebox&amp;lt;br&amp;gt;to show border color.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#switchtablink:Tab name|CUDA|CUDA}}&lt;br /&gt;
&amp;lt;headertabs/&amp;gt;&lt;br /&gt;
= Third section header =&lt;br /&gt;
This will be always displayed under the tab view&lt;br /&gt;
because it's below the &amp;amp;lt;headertabs/&amp;amp;gt; tag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Some text above the tab view&lt;br /&gt;
= First section header =&lt;br /&gt;
This will be displayed on the first tab&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{#switchtablink:Second section header|Click here to go to the next tab...}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{#switchtablink:Tab name|Link text|Page name}}&lt;br /&gt;
= Second section header =&lt;br /&gt;
This will be displayed on the second tab&lt;br /&gt;
&amp;lt;headertabs/&amp;gt;&lt;br /&gt;
= Third section header =&lt;br /&gt;
This will be always displayed under the tab view&lt;br /&gt;
because it's below the &amp;amp;lt;headertabs/&amp;amp;gt; tag.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=17959</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=17959"/>
				<updated>2019-06-06T14:34:18Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCMissing}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
==OCTAVE on the Graham national system==&lt;br /&gt;
&lt;br /&gt;
On the Graham system the user simply needs to call the &amp;quot;module load&amp;quot; command without manually unloading conflicting packages.&lt;br /&gt;
&lt;br /&gt;
 $ module load octave/4.2.1&lt;br /&gt;
&lt;br /&gt;
To obtain information about the package's dependencies the &amp;quot;spider&amp;quot; action can be included in the call to &amp;quot;module&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module spider octave&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
  octave:&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
    Description:&lt;br /&gt;
      GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
     Versions:&lt;br /&gt;
        octave/4.2.1&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
  For detailed information about a specific &amp;quot;octave&amp;quot; module (including how to load the modules) use the module's full name.&lt;br /&gt;
  For example:&lt;br /&gt;
&lt;br /&gt;
     $ module spider octave/4.2.1&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
  octave: octave/4.2.1&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
    Description:&lt;br /&gt;
      GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
    Properties:&lt;br /&gt;
      Tools for development / Outils de développement&lt;br /&gt;
&lt;br /&gt;
    You will need to load all module(s) on any one of the lines below before the &amp;quot;octave/4.2.1&amp;quot; module is available to load.&lt;br /&gt;
&lt;br /&gt;
      nixpkgs/16.09  gcc/5.4.0&lt;br /&gt;
      nixpkgs/16.09  intel/2016.4&lt;br /&gt;
      nixpkgs/16.09  intel/2017.1&lt;br /&gt;
 &lt;br /&gt;
    Help:&lt;br /&gt;
      GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple &amp;quot;Hello World!&amp;quot; process to Graham the user would first need to create a submit script as follows.&lt;br /&gt;
&lt;br /&gt;
 $ cat oct_serial.sh &lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH -t 0-00:01&lt;br /&gt;
 #SBATCH --mem=400&lt;br /&gt;
 octave --eval 'disp(&amp;quot;Hello World! from Octave&amp;quot;)'&lt;br /&gt;
&lt;br /&gt;
Then pass this submit script to &amp;quot;sbatch&amp;quot; to be entered into the queue:&lt;br /&gt;
&lt;br /&gt;
 $ sbatch --account=accountname oct_serial.sh&lt;br /&gt;
&lt;br /&gt;
... where &amp;quot;accountname&amp;quot; is the name of the accounting group to submit to (e.g. def-groupname, rgg-projectname).&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
This section shows howto submit a  [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts  [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat sample.m &lt;br /&gt;
#! /bin/octave -qf&lt;br /&gt;
printf (&amp;quot;%s&amp;quot;, program_name ());&lt;br /&gt;
arg_list = argv ();&lt;br /&gt;
for i = 1:nargin&lt;br /&gt;
    printf (&amp;quot; %s&amp;quot;, arg_list{i});&lt;br /&gt;
endfor&lt;br /&gt;
printf (&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To eliminate exatraneous verbosity in the output file two switches are passed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc&lt;br /&gt;
WARNING: no memory requirement defined; assuming 2GB per process.&lt;br /&gt;
submitted as jobid 6937872&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file from the job appears as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50&lt;br /&gt;
sample.m arg1 arg2 arg3 etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==One the Graham national system==&lt;br /&gt;
&lt;br /&gt;
Rather than dedicated development as it typical on some of the other SHARCNET systems the national systems have nodes that prioritize interactive jobs allocated by call to &amp;quot;salloc&amp;quot; of the Slurm scheduler.&lt;br /&gt;
&lt;br /&gt;
To use Octave interactively on Graham you can do the following:&lt;br /&gt;
&lt;br /&gt;
Use salloc to request a single task for one hour:&lt;br /&gt;
&lt;br /&gt;
 $ salloc --account=def-roxa88 --time=1:0:0 --ntasks=1&lt;br /&gt;
&lt;br /&gt;
Then you will receive notification when the reservation is granted (including jobid), for&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
 salloc: Granted job allocation 12345&lt;br /&gt;
&lt;br /&gt;
Then use srun to start a terminal to work in on the reservation:&lt;br /&gt;
&lt;br /&gt;
 $ srun --wait 0 --pty bash&lt;br /&gt;
&lt;br /&gt;
Once running the terminal in the allocation you can start your work with Octave by loading&lt;br /&gt;
the module and starting the program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module load octave&lt;br /&gt;
$ octave&lt;br /&gt;
octave: X11 DISPLAY environment variable not set&lt;br /&gt;
octave: disabling GUI features&lt;br /&gt;
GNU Octave, version 4.2.1&lt;br /&gt;
Copyright (C) 2017 John W. Eaton and others.&lt;br /&gt;
This is free software; see the source code for copying conditions.&lt;br /&gt;
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.&lt;br /&gt;
&lt;br /&gt;
Octave was configured for &amp;quot;x86_64-pc-linux-gnu&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Additional information about Octave is available at http://www.octave.org.&lt;br /&gt;
&lt;br /&gt;
Please contribute if you find this software useful.&lt;br /&gt;
For more information, visit http://www.octave.org/get-involved.html&lt;br /&gt;
&lt;br /&gt;
Read http://www.octave.org/bugs.html to learn how to submit bug reports.&lt;br /&gt;
For information about changes from previous versions, type 'news'.&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... Then once you have the &amp;quot;octave:#&amp;gt;&amp;quot; prompt the terminal will behave like the Matlab&lt;br /&gt;
command line.&lt;br /&gt;
&lt;br /&gt;
Once you are finished with Octave use &amp;quot;quit&amp;quot; to exit the program, then &amp;quot;exit&amp;quot; to logout of&lt;br /&gt;
the compute node (terminate srun), then &amp;quot;exit&amp;quot; again to terminate the allocation&lt;br /&gt;
(relinquishing the allocate resources).&lt;br /&gt;
&lt;br /&gt;
=Running on a visualization system=&lt;br /&gt;
&lt;br /&gt;
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu &amp;gt; Eduction &amp;gt; GNU Octave.&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave --traditional mycode.m&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system.  Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).&lt;br /&gt;
&lt;br /&gt;
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature).  Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.&lt;br /&gt;
&lt;br /&gt;
===Sharing Packages===&lt;br /&gt;
&lt;br /&gt;
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users.  To do this simply set access permissions for group or global read access accordingly. For details on how to change &lt;br /&gt;
the permissions see:   https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F&lt;br /&gt;
&lt;br /&gt;
===Managing Packages===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===Package Commands===&lt;br /&gt;
&lt;br /&gt;
Additional examples of package commands are shown in this section.  For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Package Example===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MPIBLAST&amp;diff=17957</id>
		<title>MPIBLAST</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MPIBLAST&amp;diff=17957"/>
				<updated>2019-06-06T14:32:11Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCDelete}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=MPIBLAST&lt;br /&gt;
|package_description=Parallel implementation of NCBI BLAST&lt;br /&gt;
|package_idnumber=55}}&lt;br /&gt;
{{Template:GrahamUpdate}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The mpiblast module must be manually loaded before submitting any mpiblast jobs.  Two examples below &lt;br /&gt;
demonstrate how to setup and submit jobs to the mpi queue.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
===All Clusters (except Guppy)===&lt;br /&gt;
&lt;br /&gt;
 module unload openmpi intel&lt;br /&gt;
 module load intel/12.1.3 openmpi/intel/1.6.2 mpiblast/1.6.0&lt;br /&gt;
&lt;br /&gt;
===Guppy Only===&lt;br /&gt;
&lt;br /&gt;
 module unload openmpi intel&lt;br /&gt;
 module load intel/11.0.083 openmpi/intel/1.4.2 mpiblast/1.6.0&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 15m -n 24 -q mpi --mpp=3g -o ofile%J mpiblast etc&lt;br /&gt;
&lt;br /&gt;
where the number of cores n=24 is arbitrary.&lt;br /&gt;
&lt;br /&gt;
=Example Jobs=&lt;br /&gt;
&lt;br /&gt;
==DROSOPH==&lt;br /&gt;
&lt;br /&gt;
Copy sample problem files (fasta database and input) from the /opt/sharcnet &amp;lt;i&amp;gt;examples&amp;lt;/i&amp;gt; directory a directory under work as shown here.  The fasta database used in this example can be obtained as a guest  from NCBI here http://www.ncbi.nlm.nih.gov/guide/all/#downloads_  then clicking &amp;quot;FTP: FASTA BLAST Databases&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /work/$USER/samples/mpiblast/test1&lt;br /&gt;
rm /work/$USER/samples/mpiblast/test1/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test1&lt;br /&gt;
cp /opt/sharcnet/mpiblast/1.6.0/examples/drosoph.in drosoph.in&lt;br /&gt;
gunzip -c /opt/sharcnet/mpiblast/1.6.0/examples/drosoph.nt.gz &amp;gt; drosoph.nt.$USER&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a hidden configuration file using a text editor (such as vi) to define a Shared storage location between nodes and a Local storage directory available on each compute node as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:/work/$USER/samples/mpiblast/test1] vi .ncbirc&lt;br /&gt;
[NCBI]&lt;br /&gt;
Data=/opt/sharcnet/mpiblast/1.6.0/ncbi/data&lt;br /&gt;
[BLAST]&lt;br /&gt;
BLASTDB=/scratch/YourSharcnetUsername/mpiblasttest1&lt;br /&gt;
BLASTMAT=/work/YourSharcnetUsername/samples/mpiblast/test1&lt;br /&gt;
[mpiBLAST]&lt;br /&gt;
Shared=/scratch/YourSharcnetUsername/mpiblasttest1&lt;br /&gt;
Local=/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Partition the database into 8 fragments into &amp;lt;i&amp;gt;/scratch/$USER/mpiblasttest1&amp;lt;/i&amp;gt; where they will be searched for when running a job in queue according to the &amp;lt;i&amp;gt;.ncbirc&amp;lt;/i&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load mpiblast/1.6.0&lt;br /&gt;
mkdir /scratch/roberpj/mpiblasttest1&lt;br /&gt;
rm -f /scratch/$USER/mpiblasttest1/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test1&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd20:/work/$USER/samples/mpiblast/test1] mpiformatdb -N 8 -i drosoph.nt.$USER -o T -p F -n /scratch/$USER/mpiblasttest1&lt;br /&gt;
Reading input file&lt;br /&gt;
Done, read 1534943 lines&lt;br /&gt;
Breaking drosoph.nt into 8 fragments&lt;br /&gt;
Executing: formatdb -p F -i drosoph.nt -N 8 -n /scratch/roberpj/mpiblasttest1/drosoph.nt -o T &lt;br /&gt;
Created 8 fragments.&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt; Please make sure the formatted database fragments are placed in /scratch/roberpj/mpiblasttest1/ before executing mpiblast. &amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd20:/scratch/roberpj/mpiblasttest1] ls&lt;br /&gt;
drosoph.nt.000.nhr  drosoph.nt.002.nin  drosoph.nt.004.nnd  drosoph.nt.006.nni&lt;br /&gt;
drosoph.nt.000.nin  drosoph.nt.002.nnd  drosoph.nt.004.nni  drosoph.nt.006.nsd&lt;br /&gt;
drosoph.nt.000.nnd  drosoph.nt.002.nni  drosoph.nt.004.nsd  drosoph.nt.006.nsi&lt;br /&gt;
drosoph.nt.000.nni  drosoph.nt.002.nsd  drosoph.nt.004.nsi  drosoph.nt.006.nsq&lt;br /&gt;
drosoph.nt.000.nsd  drosoph.nt.002.nsi  drosoph.nt.004.nsq  drosoph.nt.007.nhr&lt;br /&gt;
drosoph.nt.000.nsi  drosoph.nt.002.nsq  drosoph.nt.005.nhr  drosoph.nt.007.nin&lt;br /&gt;
drosoph.nt.000.nsq  drosoph.nt.003.nhr  drosoph.nt.005.nin  drosoph.nt.007.nnd&lt;br /&gt;
drosoph.nt.001.nhr  drosoph.nt.003.nin  drosoph.nt.005.nnd  drosoph.nt.007.nni&lt;br /&gt;
drosoph.nt.001.nin  drosoph.nt.003.nnd  drosoph.nt.005.nni  drosoph.nt.007.nsd&lt;br /&gt;
drosoph.nt.001.nnd  drosoph.nt.003.nni  drosoph.nt.005.nsd  drosoph.nt.007.nsi&lt;br /&gt;
drosoph.nt.001.nni  drosoph.nt.003.nsd  drosoph.nt.005.nsi  drosoph.nt.007.nsq&lt;br /&gt;
drosoph.nt.001.nsd  drosoph.nt.003.nsi  drosoph.nt.005.nsq  drosoph.nt.dbs&lt;br /&gt;
drosoph.nt.001.nsi  drosoph.nt.003.nsq  drosoph.nt.006.nhr  drosoph.nt.mbf&lt;br /&gt;
drosoph.nt.001.nsq  drosoph.nt.004.nhr  drosoph.nt.006.nin  drosoph.nt.nal&lt;br /&gt;
drosoph.nt.002.nhr  drosoph.nt.004.nin  drosoph.nt.006.nnd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Submit a short job with a 15m time limit on n=16 cores calculate by taking N=8 fragments + 8.  If all goes well output results will be written to &amp;lt;i&amp;gt;drosoph.out&amp;lt;/i&amp;gt; and the execution time will appear in ofile%J where %J is the job number:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:/work/$USER/samples/mpiblast/test1]&lt;br /&gt;
sqsub -r 15m -n 106 -q mpi --mpp=1G -o ofile%J mpiblast -d drosoph.nt.$USER -i drosoph.in&lt;br /&gt;
    -p blastn -o drosoph.out --use-parallel-write --use-virtual-frags&lt;br /&gt;
submitted as jobid 6966896&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd20:/work/roberpj/samples/mpiblast/test1] cat ofile6966896.hnd50 &lt;br /&gt;
Total Execution Time: 1.80031&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When submitting a mpiblast job on a cluster such as goblin that doesnt have an inifiniband interconnect better performance (at least double speedup) will be achieved running the mpi job on one compute node.  For regular users of non-contributed hardware typically specify &amp;quot;-n 8&amp;quot; to reflect the max number of cores on a single node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 15m -n 8 -N 1 -q mpi --mpp=4G -o ofile%J mpiblast -d drosoph.nt -i drosoph.in&lt;br /&gt;
           -p blastn -o drosoph.out --use-parallel-write --use-virtual-frags&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample output results computed previously with BLASTN 2.2.15 [Oct-15-2006] are included in &amp;lt;i&amp;gt;/opt/sharcnet/mpiblast/1.6.0/examples/ROSOPH.out&amp;lt;/i&amp;gt; to compare your newly generated &amp;lt;i&amp;gt;drosoph.out&amp;lt;/i&amp;gt; file with.&lt;br /&gt;
&lt;br /&gt;
==UNIGENE==&lt;br /&gt;
&lt;br /&gt;
The main purpose of this example is to illustrate some additional options and switchs that maybe useful for debugging and for dealing with larger databases as described in official detail at http://www.mpiblast.org/Docs/Guide.  The fasta database used in this example can also be downloaded from http://www.ncbi.nlm.nih.gov/guide/all/#downloads_ as a guest by clicking &amp;quot;FTP: UniGene&amp;quot; then entering the &amp;quot;Homo_sapiens&amp;quot; sub-directory.  More information about UniGene alignments can be found at https://cgwb.nci.nih.gov/cgi-bin/hgTrackUi?hgsid=95443&amp;amp;c=chr1&amp;amp;g=uniGene_3 .  As with Example1 above, for convenience all required files can simply be copied from the /opt/sharcnet &amp;lt;i&amp;gt;examples&amp;lt;/i&amp;gt; subdirectory to work as shown here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /work/$USER/samples/mpiblast/test2&lt;br /&gt;
rm -f /work/$USER/samples/mpiblast/test2/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test2&lt;br /&gt;
cp /opt/sharcnet/mpiblast/1.6.0/examples/il2ra.in il2ra.in&lt;br /&gt;
gunzip -c /opt/sharcnet/mpiblast/1.6.0/examples/Hs.seq.uniq.gz &amp;gt; Hs.seq.$USER&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login2:/work/roberpj/samples/mpiblast/test2] ls&lt;br /&gt;
Hs.seq.roberpj  il2ra.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a hidden configuration file using a text editor (such as vi) to define a Shared storage location between nodes and a Local storage directory available on each compute node as followw.  Note that the ncbi/data directory is not used in this example and hence can be omitted.  If the Local and Shared directories are the same replace &amp;lt;b&amp;gt;--copy-via=mpi&amp;lt;/b&amp;gt; with &amp;lt;b&amp;gt;--copy-via=none&amp;lt;/b&amp;gt; as will be demonstrated in the below sqsub commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[username@orc-login1:/work/$USER/samples/mpiblast/test2] vi .ncbirc&lt;br /&gt;
[NCBI]&lt;br /&gt;
Data=/opt/sharcnet/mpiblast/1.6.0/ncbi/data&lt;br /&gt;
[BLAST]&lt;br /&gt;
BLASTDB=/work/YourSharcnetUsername/mpiblasttest2&lt;br /&gt;
BLASTMAT=/work/YourSharcnetUsername/samples/mpiblast/test2&lt;br /&gt;
[mpiBLAST]&lt;br /&gt;
Shared=/work/YourSharcnetUsername/mpiblasttest2&lt;br /&gt;
Local=/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again partition the database into 8 fragments into &amp;lt;i&amp;gt;/work/$USER/mpiblasttest2&amp;lt;/i&amp;gt; where they will be searched for when a job runs in the queue according to the &amp;lt;i&amp;gt;.ncbirc&amp;lt;/i&amp;gt; file, first removing previous partitioning if any such files exist.  For this example assume $USER=roberpj however be sure to replace with your username!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load mpiblast/1.6.0&lt;br /&gt;
mkdir -p /work/$USER/mpiblasttest2&lt;br /&gt;
rm -f /work/$USER/mpiblasttest2/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test2&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login1:/work/roberpj/samples/mpiblast/test2] mpiformatdb -N 8 -i Hs.seq.$USER -o T -p F -n /work/roberpj/mpiblasttest2&lt;br /&gt;
Reading input file&lt;br /&gt;
Done, read 2348651 lines&lt;br /&gt;
Breaking Hs.seq.roberpj into 8 fragments&lt;br /&gt;
Executing: formatdb -p F -i Hs.seq.roberpj -N 8 -n /work/roberpj/mpiblasttest2/Hs.seq.roberpj -o T &lt;br /&gt;
Created 8 fragments.&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt; Please make sure the formatted database fragments are placed in /work/roberpj/mpiblasttest2/ before executing mpiblast. &amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login1:/work/roberpj/samples/mpiblast/test1] ls&lt;br /&gt;
formatdb.log  Hs.seq.roberpj  il2ra.in&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login1:/work/roberpj/mpiblasttest2] ls&lt;br /&gt;
Hs.seq.roberpj.000.nhr  Hs.seq.roberpj.002.nin  Hs.seq.roberpj.004.nnd  Hs.seq.roberpj.006.nni&lt;br /&gt;
Hs.seq.roberpj.000.nin  Hs.seq.roberpj.002.nnd  Hs.seq.roberpj.004.nni  Hs.seq.roberpj.006.nsd&lt;br /&gt;
Hs.seq.roberpj.000.nnd  Hs.seq.roberpj.002.nni  Hs.seq.roberpj.004.nsd  Hs.seq.roberpj.006.nsi&lt;br /&gt;
Hs.seq.roberpj.000.nni  Hs.seq.roberpj.002.nsd  Hs.seq.roberpj.004.nsi  Hs.seq.roberpj.006.nsq&lt;br /&gt;
Hs.seq.roberpj.000.nsd  Hs.seq.roberpj.002.nsi  Hs.seq.roberpj.004.nsq  Hs.seq.roberpj.007.nhr&lt;br /&gt;
Hs.seq.roberpj.000.nsi  Hs.seq.roberpj.002.nsq  Hs.seq.roberpj.005.nhr  Hs.seq.roberpj.007.nin&lt;br /&gt;
Hs.seq.roberpj.000.nsq  Hs.seq.roberpj.003.nhr  Hs.seq.roberpj.005.nin  Hs.seq.roberpj.007.nnd&lt;br /&gt;
Hs.seq.roberpj.001.nhr  Hs.seq.roberpj.003.nin  Hs.seq.roberpj.005.nnd  Hs.seq.roberpj.007.nni&lt;br /&gt;
Hs.seq.roberpj.001.nin  Hs.seq.roberpj.003.nnd  Hs.seq.roberpj.005.nni  Hs.seq.roberpj.007.nsd&lt;br /&gt;
Hs.seq.roberpj.001.nnd  Hs.seq.roberpj.003.nni  Hs.seq.roberpj.005.nsd  Hs.seq.roberpj.007.nsi&lt;br /&gt;
Hs.seq.roberpj.001.nni  Hs.seq.roberpj.003.nsd  Hs.seq.roberpj.005.nsi  Hs.seq.roberpj.007.nsq&lt;br /&gt;
Hs.seq.roberpj.001.nsd  Hs.seq.roberpj.003.nsi  Hs.seq.roberpj.005.nsq  Hs.seq.roberpj.dbs&lt;br /&gt;
Hs.seq.roberpj.001.nsi  Hs.seq.roberpj.003.nsq  Hs.seq.roberpj.006.nhr  Hs.seq.roberpj.mbf&lt;br /&gt;
Hs.seq.roberpj.001.nsq  Hs.seq.roberpj.004.nhr  Hs.seq.roberpj.006.nin  Hs.seq.roberpj.nal&lt;br /&gt;
Hs.seq.roberpj.002.nhr  Hs.seq.roberpj.004.nin  Hs.seq.roberpj.006.nnd   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Submit a couple of short jobs 15m time limit.  If all goes well output results will be written to &amp;lt;i&amp;gt;biobrewA.out&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;biobrewB.out&amp;lt;/i&amp;gt; and the execution time appear in corresponding ofile%J's where %J is the job number as per usual.  In these examples we will submit the job from a saw specific directory which can be copied from test2 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@saw-login1:~] module load mpiblast/1.6.0&lt;br /&gt;
[roberpj@saw-login1:~] cd /work/roberpj/samples/mpiblast&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast] cp -a test2 test2.saw&lt;br /&gt;
&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw] vi .ncbirc&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw] cat .ncbirc | grep BLASTMAT&lt;br /&gt;
BLASTMAT=/work/roberpj/samples/mpiblast/test2.saw&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A) Submit job with profile time option choosing n=24 (8 fragments + 8 or greater):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw] rm -f oTime*;&lt;br /&gt;
    sqsub -r 15m -n 24 -q mpi -o ofile%J mpiblast  --use-parallel-write --copy-via=mpi&lt;br /&gt;
       -d Hs.seq.roberpj -i il2ra.in -p blastn -o biobrew.out --time-profile=oTime&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
B) Usage of the debug option again choosing n=16 (8 fragments + 8 or greater):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw]  rm -f oLog*;&lt;br /&gt;
    sqsub -r 15m -n 16 -q mpi -o ofile%J mpiblast --use-parallel-write --copy-via=none&lt;br /&gt;
        -d Hs.seq.$USER -i il2ra.in -p blastn -o biobrew.out --debug=oLog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally compare &amp;lt;i&amp;gt;/opt/sharcnet/mpiblast/1.6.0/examples/BIOBREW.out&amp;lt;/i&amp;gt; computed previously with BLASTN 2.2.15 [Oct-15-2006] with your newly generated &amp;lt;i&amp;gt;biobrew.out&amp;lt;/i&amp;gt; output file to verify the results and submit a ticket if there are any problems!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;SUPPORTED PROGRAMS IN MPIBLAST&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As described in http://www.mpiblast.org/Docs/FAQ mpiblast supports the standard blast programs http://www.ncbi.nlm.nih.gov/BLAST/blast_program.shtml which are reproduced here for reference:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blastp:     Compares an amino acid query sequence against a protein sequence database.&lt;br /&gt;
blastn:     Compares a nucleotide query sequence against a nucleotide sequence database.&lt;br /&gt;
blastx:     Compares a nucleotide query sequence translated in all reading frames against&lt;br /&gt;
            a protein sequence database.&lt;br /&gt;
tblastn:    Compares a protein query sequence against a nucleotide sequence database&lt;br /&gt;
            dynamically translated in all reading frames.&lt;br /&gt;
tblastx:    Compares the six-frame translations of a nucleotide query sequence against&lt;br /&gt;
            the six-frame translations of a nucleotide sequence database.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;MPIBLAST BINARIES OPTIONS&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:/opt/sharcnet/mpiblast/1.6.0/bin] ./mpiblast -help&lt;br /&gt;
mpiBLAST requires the following options: -d [database] -i [query file] -p [blast program name]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:/opt/sharcnet/mpiblast/1.6.0/bin] ./mpiformatdb --help&lt;br /&gt;
Executing: formatdb - &lt;br /&gt;
&lt;br /&gt;
formatdb 2.2.20   arguments:&lt;br /&gt;
&lt;br /&gt;
  -t  Title for database file [String]  Optional&lt;br /&gt;
  -i  Input file(s) for formatting [File In]  Optional&lt;br /&gt;
  -l  Logfile name: [File Out]  Optional&lt;br /&gt;
    default = formatdb.log&lt;br /&gt;
  -p  Type of file&lt;br /&gt;
         T - protein   &lt;br /&gt;
         F - nucleotide [T/F]  Optional&lt;br /&gt;
    default = T&lt;br /&gt;
  -o  Parse options&lt;br /&gt;
         T - True: Parse SeqId and create indexes.&lt;br /&gt;
         F - False: Do not parse SeqId. Do not create indexes.&lt;br /&gt;
 [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -a  Input file is database in ASN.1 format (otherwise FASTA is expected)&lt;br /&gt;
         T - True, &lt;br /&gt;
         F - False.&lt;br /&gt;
 [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -b  ASN.1 database in binary mode&lt;br /&gt;
         T - binary, &lt;br /&gt;
         F - text mode.&lt;br /&gt;
 [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -e  Input is a Seq-entry [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -n  Base name for BLAST files [String]  Optional&lt;br /&gt;
  -v  Database volume size in millions of letters [Integer]  Optional&lt;br /&gt;
    default = 4000&lt;br /&gt;
  -s  Create indexes limited only to accessions - sparse [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -V  Verbose: check for non-unique string ids in the database [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -L  Create an alias file with this name&lt;br /&gt;
        use the gifile arg (below) if set to calculate db size&lt;br /&gt;
        use the BLAST db specified with -i (above) [File Out]  Optional&lt;br /&gt;
  -F  Gifile (file containing list of gi's) [File In]  Optional&lt;br /&gt;
  -B  Binary Gifile produced from the Gifile specified above [File Out]  Optional&lt;br /&gt;
  -T  Taxid file to set the taxonomy ids in ASN.1 deflines [File In]  Optional&lt;br /&gt;
  -N  Number of database volumes [Integer]  Optional&lt;br /&gt;
    default = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General Notes=&lt;br /&gt;
&lt;br /&gt;
==Issue1: Jobs Fail to Start==&lt;br /&gt;
&lt;br /&gt;
If the following error message occurs it maybe necessary to stop all mpiblast jobs you are running on the cluster and clear&lt;br /&gt;
out all the files from /tmp then submit your job again.  In the case of Example2 above the following steps work to resolve the problem, where the nodes used from the last run job were red[7-14].  Should there be any questions please open a problem ticket.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Purging Job Node Subset (redfin)&lt;br /&gt;
 pdsh -w red[7-14] ls /tmp/Hs*     (confirm existence of file from previous runs)&lt;br /&gt;
 pdsh -w red[7-14] rm -f /tmp/Hs*&lt;br /&gt;
 pdsh -w red[7-14] ls /tmp/Hs*     (confirm all files from previous runs removed)&lt;br /&gt;
&lt;br /&gt;
Purging Full Cluster (hound)&lt;br /&gt;
pdsh -w hnd[1-18] -f 4 rm -f /tmp/Hs*&lt;br /&gt;
pdsh -w hnd[1-18] -f 4 ls /tmp/Hs*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@red-admin:/work/roberpj/samples/mpiblast/test2.red4] cat ofile489214.red-admin.redfin.sharcnet&lt;br /&gt;
8       0.577904        Bailing out with signal 11&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
MPI_ABORT was invoked on rank 8 in communicator MPI_COMM_WORLD&lt;br /&gt;
with errorcode 0.&lt;br /&gt;
&lt;br /&gt;
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.&lt;br /&gt;
You may or may not see output from other processes, depending on&lt;br /&gt;
exactly when Open MPI kills them.&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
20      0.577719        Bailing out with signal 11&lt;br /&gt;
0       0.591128        Bailing out with signal 15&lt;br /&gt;
[red14:09194] [[36424,0],0]-[[36424,1],0] mca_oob_tcp_msg_recv: readv failed: Connection reset by peer (104)&lt;br /&gt;
1       0.591327        Bailing out with signal 15&lt;br /&gt;
etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Issue2: Jobs Run for a While then Die==&lt;br /&gt;
&lt;br /&gt;
The solution here is to filter the input sequence file. For reasons yet understood the presence of repeat sections results in many thousands of WARNING and ERROR messages rapidly written to the &amp;quot;sqsub -o ofile&amp;quot; output file presumably as mpiblast ignores sequences before eventually diing after several hours, or possibly days.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat  ofile1635556.saw-admin.saw.sharcnet | grep &amp;quot;WARNING\|ERROR&amp;quot; | wc -l&lt;br /&gt;
10560&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat ofile1635556.saw-admin.saw.sharcnet&lt;br /&gt;
Selenocysteine (U) at position 60 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 42 replaced by X&lt;br /&gt;
[blastall] WARNING:  [000.000]  NODE_84_length_162_cov_46.259258_1_192_-: SetUpBlastSearch failed.&lt;br /&gt;
[blastall] ERROR:  [000.000]  NODE_84_length_162_cov_46.259258_1_192_-: BLASTSetUpSearch: Unable to calculate Karlin-Altschul params, check query sequence&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt;&amp;lt; snipped out ~10000 similar WARNING and ERROR messages from this example &amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
[blastall] WARNING:  [000.000]  NODE_65409_length_87_cov_2.367816_1_77_+: SetUpBlastSearch failed.&lt;br /&gt;
[blastall] ERROR:  [000.000]  NODE_65409_length_87_cov_2.367816_1_77_+: BLASTSetUpSearch: Unable to calculate Karlin-Altschul params, check query sequence&lt;br /&gt;
Selenocysteine (U) at position 61 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 62 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 34 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 1058 replaced by X&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
mpirun noticed that process rank 52 with PID 30067 on node saw214 exited on signal 9 (Killed).&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
1618    17      651     62909.3 Bailing out with signal 15&lt;br /&gt;
14      3       62909.3 Bailing out with signal 15&lt;br /&gt;
19      15      62909.3 Bailing out with signal 1536    5       7       62909.312       62909.310       62909.3 Bailing out with signal 1547    21      62909.3 Bailing out with signal 159  62909.3 Bailing out with signal 15&lt;br /&gt;
45      62909.3 Bailing out with signal 1525    62909.3 Bailing out with signal 158     62909.3 Bailing out with signal 15&lt;br /&gt;
50      62909.3 Bailing out with signal 1522    62909.3 Bailing out with signal 15&lt;br /&gt;
11      62909.3 Bailing out with signal 15&lt;br /&gt;
48      62909.323       62909.3 Bailing out with signal 15&lt;br /&gt;
        Bailing out with signal 15&lt;br /&gt;
46      62909.3 Bailing out with signal 15&lt;br /&gt;
etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o MPIBLAST Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.mpiblast.org/&lt;br /&gt;
&lt;br /&gt;
o MPIBLAST Version History&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.mpiblast.org/Downloads/Version-History&lt;br /&gt;
&lt;br /&gt;
[[Category:Bioinformatics]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--checked2016--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MPFUN90&amp;diff=17956</id>
		<title>MPFUN90</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MPFUN90&amp;diff=17956"/>
				<updated>2019-06-06T14:30:29Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCDelete}}&lt;br /&gt;
{{Template:LegacyPage}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=MPFUN90&lt;br /&gt;
|package_description=A Fortran-90 arbitrary precision package&lt;br /&gt;
|package_idnumber=16&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
MPFUN90 is a Fortran-90 arbitrary precision package (i.e. user specifies the desired precision)written by David H. Bailey et. al from the Lawrence  Berkeley National Laboratory. If 64 digits of precision are sufficient for an application then users should use QD instead of MPFUN which would run much faster.&lt;br /&gt;
&lt;br /&gt;
=Versions=&lt;br /&gt;
&lt;br /&gt;
==20060123==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load intel/12.1.3&lt;br /&gt;
module load mpfun90/20060123 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==20100825==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load intel/15.0.3&lt;br /&gt;
module load mpfun90/intel1503/20100825&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
&lt;br /&gt;
==Cluster==&lt;br /&gt;
To submit a job to the serial queue use:&lt;br /&gt;
&lt;br /&gt;
  sqsub -r 10m --mpp=2G -o ofile.%J ./a.out&lt;br /&gt;
&lt;br /&gt;
==Interactive==&lt;br /&gt;
&lt;br /&gt;
===testmp90===&lt;br /&gt;
&lt;br /&gt;
This example shows how to compile and run &amp;lt;i&amp;gt;testmp90.f90&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;testmp90.f&amp;lt;/i&amp;gt; using the 2006 and 2010 sharcnet mpfun90 modules:&lt;br /&gt;
&lt;br /&gt;
====20060123====&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login2:~] module load intel/12.1.3; module load mpfun90/20060123&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/20060123] cp /opt/sharcnet/mpfun90/20060123/f90/src/testmp90.f90 .&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/20060123] ifort testmp90.f90 $CPPFLAGS $LDFLAGS -lmp&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/20060123] ./a.out&lt;br /&gt;
 Completed Test  1&lt;br /&gt;
 Completed Test  2&lt;br /&gt;
 Completed Test  3&lt;br /&gt;
 .................&lt;br /&gt;
 Completed Test 62&lt;br /&gt;
&lt;br /&gt;
====20100825====&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login2:~] module unload intel mkl mpfun90&lt;br /&gt;
 [roberpj@orc-login2:~] module load intel/15.0.3; module load mpfun90/intel1503/20100825&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/20100825] cp $MPFUN90_ROOT/f90/testmp90.f .&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/20100825] ifort -free testmp90.f $MPFUN90_ROOT/toolkit/mpfun90.o  -I$MPFUN90_ROOT/toolkit&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/20100825] ./a.out&lt;br /&gt;
 Completed Test  1&lt;br /&gt;
 Completed Test  2&lt;br /&gt;
 Completed Test  3&lt;br /&gt;
 .................&lt;br /&gt;
 Completed Test 62&lt;br /&gt;
&lt;br /&gt;
o Note that when using the mpfun90/20100825 (or newer sharcnet modules) when the main program contains &amp;quot;use mpmodule&amp;quot; its necessary to include &amp;quot;$MPFUN90_ROOT/toolkit/mpmod90.o&amp;quot; when compiling otherwise error messages such as &amp;lt;i&amp;gt;&amp;quot;undefined reference to mpdefmod_mp_mpinit_&amp;quot;&amp;lt;/i&amp;gt; will occur.  Also note this is not required with the legacy mpfun90/20060123 module since the custom built static mp library (which is no longer being provided by sharcnet) contains all mpfun objects.&lt;br /&gt;
&lt;br /&gt;
===factorial_100.f90===&lt;br /&gt;
&lt;br /&gt;
This example shows how to compile and run the program &amp;lt;i&amp;gt;factorial_100.f90&amp;lt;/i&amp;gt; using the 2010 sharcnet mpfun90 module only:&lt;br /&gt;
&lt;br /&gt;
       program factorial_100_pgm&lt;br /&gt;
       use mpmodule&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: Nmx = 100&lt;br /&gt;
       integer            :: AllocateStatus&lt;br /&gt;
       integer            :: J&lt;br /&gt;
       type(mp_real) zero, one&lt;br /&gt;
       type(mp_real), dimension (:), allocatable        :: fac&lt;br /&gt;
       call mpinit(800)&lt;br /&gt;
       call mpsetprec(800)&lt;br /&gt;
       call mpsetoutputprec(700)&lt;br /&gt;
       zero='0.'&lt;br /&gt;
       one ='1.'&lt;br /&gt;
       allocate(fac(0:Nmx),STAT=AllocateStatus)&lt;br /&gt;
       IF (AllocateStatus /= 0) STOP &amp;quot;Not enough memory for fac &amp;quot;&lt;br /&gt;
       fac(0)=one&lt;br /&gt;
       do J=1,Nmx&lt;br /&gt;
         fac(J)=fac(J-1)*J&lt;br /&gt;
       end do&lt;br /&gt;
       J=4&lt;br /&gt;
       write(6,1001) J&lt;br /&gt;
  1001 format(/&amp;quot;fac(&amp;quot;,i3.3,&amp;quot;) =&amp;quot;,$)&lt;br /&gt;
       call mpwrite(6,fac(J))&lt;br /&gt;
       J=100&lt;br /&gt;
       write(6,1001) J&lt;br /&gt;
       call mpwrite(6,fac(J))&lt;br /&gt;
       write(6,1005)&lt;br /&gt;
  1005 format(/&amp;quot;DONE&amp;quot;//)&lt;br /&gt;
       end&lt;br /&gt;
 &lt;br /&gt;
====Compile====&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/factorial_100_pgm] ifort factorial_100.f90 \&lt;br /&gt;
     $MPFUN90_ROOT/toolkit/mpmod90.o $MPFUN90_ROOT/toolkit/mpfun90.o -I$MPFUN90_ROOT/toolkit&lt;br /&gt;
&lt;br /&gt;
====Execute====&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login2:~/samples/mpfun90/factorial_100_pgm] ./a.out&lt;br /&gt;
 fac(004) =10 ^         1 x  2.4,&lt;br /&gt;
 fac(100) =10 ^       157 x  9.3326215443944152681699238856266700490715968264381621468592&lt;br /&gt;
  963895217599993229915608941463976156518286253697920827223758251185210916864,&lt;br /&gt;
 DONE&lt;br /&gt;
&lt;br /&gt;
==Graphical==&lt;br /&gt;
&lt;br /&gt;
There is no graphical usage component for this software package.&lt;br /&gt;
&lt;br /&gt;
=Notes=&lt;br /&gt;
&lt;br /&gt;
==OpenMP==&lt;br /&gt;
&lt;br /&gt;
The Multi Precision packages MPFUN90 (and QD) use &amp;quot;user defined data type&amp;quot; for their variables.&lt;br /&gt;
Since the OpenMP reduction clause cannot be used for &amp;quot;user defined data types&amp;quot; to run MPFUN90 or QD&lt;br /&gt;
with OpenMP the reduction must be done manually in a PARALLEL OpenMP region.&lt;br /&gt;
&lt;br /&gt;
Detailed documentation on how to use OpenMP with MPFUN90 and QD are presented in the following&lt;br /&gt;
document:&lt;br /&gt;
&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/OpenMP_Reduction_for_User_Defined_Data_Types&lt;br /&gt;
&lt;br /&gt;
==Large Arrays==&lt;br /&gt;
&lt;br /&gt;
Declaring large arrays in an MPFUN program often leads to compile&lt;br /&gt;
errors like:&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;relocation truncated to fit r_x86_64_pc32 against .bss&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Even with the flag '-mcmodel large' in the compile command the error&lt;br /&gt;
will persist, because there is a limit to the amount of data you can&lt;br /&gt;
have allocated in static arrays for x86_64 architecture. This data&lt;br /&gt;
segment is limited to 2GB. The data in COMMON plus any other&lt;br /&gt;
statically declared arrays PLUS your code must fit in 2GB.&lt;br /&gt;
&lt;br /&gt;
In order to overcome this problem use allocatable arrays declared in&lt;br /&gt;
a module together with a short subroutine which allocates the arrays.&lt;br /&gt;
&lt;br /&gt;
We illustrate these concepts by starting with a program 'betax.f90'&lt;br /&gt;
which work fine for values of parameter 'Nsz' less than 37. Thus, if&lt;br /&gt;
you compile it with&lt;br /&gt;
&lt;br /&gt;
       integer, parameter :: Nsz=36&lt;br /&gt;
&lt;br /&gt;
it works, but for any higher values it fails with error message:&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;relocation truncated to fit: R_X86_64_PC32 against symbol '...'&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To overcome this problem, we first copy program betax.f90 into a new file,&lt;br /&gt;
say, betay.f90, and write a module called 'mp_data' and a subroutine called&lt;br /&gt;
'allocate_arrays' at the top of the new file. We move all the declarations&lt;br /&gt;
of large arrays into the module, and declare them as 'allocatable'.&lt;br /&gt;
&lt;br /&gt;
In the subroutine 'allocate_arrays' we do the allocations and in the main&lt;br /&gt;
program we add the statements:&lt;br /&gt;
&lt;br /&gt;
      USE mp_data&lt;br /&gt;
      ...&lt;br /&gt;
      call allocate_arrays&lt;br /&gt;
      ...&lt;br /&gt;
&lt;br /&gt;
Below you will find the listings for the files 'betax.f90', 'betay.f90' and&lt;br /&gt;
the 'HIST' file containing the commands to compile these files and submit&lt;br /&gt;
jobs:&lt;br /&gt;
&lt;br /&gt;
===betax.f90===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       program BETAX&lt;br /&gt;
       use mpmodule&lt;br /&gt;
       implicit none&lt;br /&gt;
 !     integer, parameter :: Nsz=12   ! compilation fails for 37&lt;br /&gt;
       integer, parameter :: Nsz=37&lt;br /&gt;
       INTEGER :: I,J,K,L&lt;br /&gt;
       type(mp_real) zero, one&lt;br /&gt;
       type(mp_real) fac(0:Nsz),fci(0:Nsz)&lt;br /&gt;
       type(mp_real) BETA2(Nsz,Nsz)&lt;br /&gt;
       type(mp_real) BETA3(Nsz,Nsz,Nsz)&lt;br /&gt;
       type(mp_real) BETA4(Nsz,Nsz,Nsz,Nsz)&lt;br /&gt;
       call mpinit(800)&lt;br /&gt;
       call mpsetprec(800)&lt;br /&gt;
       call mpsetoutputprec(700)&lt;br /&gt;
       zero='0.'&lt;br /&gt;
       one ='1.'&lt;br /&gt;
       fac(0)=one&lt;br /&gt;
       fci(0)=one&lt;br /&gt;
       do j=1,Nsz&lt;br /&gt;
         fac(j)=fac(j-1)*j&lt;br /&gt;
         fci(j)=one/fac(j)&lt;br /&gt;
       end do&lt;br /&gt;
       I=Nsz/2&lt;br /&gt;
       J=I-1&lt;br /&gt;
       K=J-1&lt;br /&gt;
       L=K-1&lt;br /&gt;
       write(6,1000) I,J,K,L&lt;br /&gt;
  1000 format(/&amp;quot;I,J,K,L = &amp;quot;,4i3)&lt;br /&gt;
       write(6,1001) I&lt;br /&gt;
  1001 format(/&amp;quot;fac(&amp;quot;,i3.3,&amp;quot;) =&amp;quot;,$)&lt;br /&gt;
       call mpwrite(6,fac(I))&lt;br /&gt;
       BETA2(I,J)      =fac(I)*fac(J)*fci(I+J)&lt;br /&gt;
       BETA3(I,J,K)    =fac(I)*fac(J)*fac(K)*fci(I+J)*fci(J+K)&lt;br /&gt;
       BETA4(I,J,K,L)  =fac(I)*fac(J)*fac(K)*fac(L)*                     &amp;amp;&lt;br /&gt;
      &amp;amp;                 fci(I+J)*fci(J+K)*fci(K+L)&lt;br /&gt;
       write(6,1002) I,J&lt;br /&gt;
  1002 format(/&amp;quot;BETA2(&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;) =&amp;quot;)&lt;br /&gt;
       call mpwrite(6,BETA2(I,J))&lt;br /&gt;
       write(6,1003) I,J,K&lt;br /&gt;
  1003 format(/&amp;quot;BETA3(&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;) =&amp;quot;)&lt;br /&gt;
       call mpwrite(6,BETA3(I,J,K))&lt;br /&gt;
       write(6,1004) I,J,K,L&lt;br /&gt;
  1004 format(/&amp;quot;BETA4(&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;) =&amp;quot;)&lt;br /&gt;
       call mpwrite(6,BETA4(I,J,K,L))&lt;br /&gt;
       write(6,1005)&lt;br /&gt;
  1005 format(/&amp;quot;DONE&amp;quot;//)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Nsz=12 (works)====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~] ssh orc-dev1&lt;br /&gt;
[roberpj@orc129:~] module purge; module load ldwrapper; module load intel/15.0.3; module load mpfun90/intel1503/20100825&lt;br /&gt;
[roberpj@orc129:~] cd ~/samples/mpfun90/betax&lt;br /&gt;
[roberpj@orc129:~/samples/mpfun90/betax] ifort betax.f90 $MPFUN90_ROOT/toolkit/mpmod90.o $MPFUN90_ROOT/toolkit/mpfun90.o -I$MPFUN90_ROOT/toolkit&lt;br /&gt;
[roberpj@orc129:~/samples/mpfun90/betax] ./a.out&lt;br /&gt;
&lt;br /&gt;
I,J,K,L =   6  5  4  3&lt;br /&gt;
&lt;br /&gt;
fac(006) =10 ^         2 x  7.2,&lt;br /&gt;
&lt;br /&gt;
BETA2(006,005) =&lt;br /&gt;
10 ^        -3 x  2.1645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645021645021645021645021645021645021645021645021645021645021645&lt;br /&gt;
021645021645021645,&lt;br /&gt;
&lt;br /&gt;
BETA3(006,005,004) =&lt;br /&gt;
10 ^        -7 x  1.4315490505966696442886919077395267871458347648823839300029&lt;br /&gt;
776220252410728601204791680982157172633363109553585744061934538125014315490505&lt;br /&gt;
966696442886919077395267871458347648823839300029776220252410728601204791680982&lt;br /&gt;
157172633363109553585744061934538125014315490505966696442886919077395267871458&lt;br /&gt;
347648823839300029776220252410728601204791680982157172633363109553585744061934&lt;br /&gt;
538125014315490505966696442886919077395267871458347648823839300029776220252410&lt;br /&gt;
728601204791680982157172633363109553585744061934538125014315490505966696442886&lt;br /&gt;
919077395267871458347648823839300029776220252410728601204791680982157172633363&lt;br /&gt;
109553585744061934538125014315490505966696442886919077395267871458347648823839&lt;br /&gt;
300029776220252410,&lt;br /&gt;
&lt;br /&gt;
BETA4(006,005,004,003) =&lt;br /&gt;
10 ^       -10 x  1.7042250602341305289151094139756271275545651962885522976225&lt;br /&gt;
924071729060391191910466286883520443611146558992363981026112545386921804155364&lt;br /&gt;
246067193912998901661033180307556724790284880987828833633822295953815228191645&lt;br /&gt;
425205515908463754268742930874450148826566060126150829098674903663565795085069&lt;br /&gt;
461486695046785749733595538584200715719990096407329967420670368516173504835636&lt;br /&gt;
354910731327964888055591003436808425470556989831366248599808690511638357443346&lt;br /&gt;
105477624752001169234729325432273278078266740398259672636089869649960352908198&lt;br /&gt;
713187375318894593271010504570595273543119348108010239529513905931139491230194&lt;br /&gt;
178039983028645160164434540851774411865114812960617949280080799355175772409332&lt;br /&gt;
500035447881252869,&lt;br /&gt;
&lt;br /&gt;
DONE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Nsz=37 (fails)====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~/samples/mpfun90/betax] ssh orc-dev1&lt;br /&gt;
[roberpj@orc129:~] module purge; module load ldwrapper; module load intel/15.0.3; module load mpfun90/intel1503/20100825&lt;br /&gt;
[roberpj@orc129:~] cd ~/samples/mpfun90/betax&lt;br /&gt;
[roberpj@orc129:~/samples/mpfun90/betax] ifort betax.f90 $MPFUN90_ROOT/toolkit/mpmod90.o $MPFUN90_ROOT/toolkit/mpfun90.o -I$MPFUN90_ROOT/toolkit&lt;br /&gt;
/opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o: In function `mpdefmod_mp_mpsetprec_':&lt;br /&gt;
mpmod90.f:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_new_mpipl_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
mpmod90.f:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_new_mpwds_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
mpmod90.f:(.text+0xa6): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_mpnwx_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
mpmod90.f:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_mpnwx_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
/opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o: In function `mpdefmod_mp_mpgetprec_':&lt;br /&gt;
mpmod90.f:(.text+0xe6): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_mpnwx_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
/opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o: In function `mpdefmod_mp_mpsetprecwords_':&lt;br /&gt;
mpmod90.f:(.text+0x109): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_new_mpwds_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
mpmod90.f:(.text+0x18c): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_mpnwx_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
mpmod90.f:(.text+0x198): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_mpnwx_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
/opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o: In function `mpdefmod_mp_mpgetprecwords_':&lt;br /&gt;
mpmod90.f:(.text+0x1b2): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_mpnwx_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
/opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o: In function `mpdefmod_mp_mpsetoutputprec_':&lt;br /&gt;
mpmod90.f:(.text+0x1c9): relocation truncated to fit: R_X86_64_PC32 against symbol `mpdefmod_mp_new_mpipl_' defined in COMMON section in /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mpmod90.o&lt;br /&gt;
mpmod90.f:(.text+0x24c): additional relocation overflows omitted from the output&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===betay.f90===&lt;br /&gt;
&lt;br /&gt;
Copy betay.f90 from betax.f90 and modify as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       module mp_data&lt;br /&gt;
       use mpmodule&lt;br /&gt;
       use mpfunmod&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: Nsz =48&lt;br /&gt;
       integer            :: AllocateStatus&lt;br /&gt;
 !     type(mp_real) zero, one&lt;br /&gt;
 !&lt;br /&gt;
 !     type(mp_real) fac(0:Nsz),fci(0:Nsz)&lt;br /&gt;
 !     type(mp_real) BETA2(Nsz,Nsz)&lt;br /&gt;
 !     type(mp_real) BETA3(Nsz,Nsz,Nsz)&lt;br /&gt;
 !     type(mp_real) BETA4(Nsz,Nsz,Nsz,Nsz)&lt;br /&gt;
       type(mp_real) zero, one&lt;br /&gt;
       type(mp_real), dimension (:), allocatable        :: fac,fci&lt;br /&gt;
       type(mp_real), dimension (:,:), allocatable      :: BETA2&lt;br /&gt;
       type(mp_real), dimension (:,:,:), allocatable    :: BETA3&lt;br /&gt;
       type(mp_real), dimension (:,:,:,:), allocatable  :: BETA4&lt;br /&gt;
       end module mp_data&lt;br /&gt;
       subroutine allocate_arrays&lt;br /&gt;
       USE mp_data&lt;br /&gt;
       implicit none&lt;br /&gt;
       allocate(fac(0:Nsz),STAT=AllocateStatus)&lt;br /&gt;
       IF (AllocateStatus /= 0) STOP &amp;quot;Not enough memory for fac &amp;quot;&lt;br /&gt;
       allocate(fci(0:Nsz),STAT=AllocateStatus)&lt;br /&gt;
       IF (AllocateStatus /= 0) STOP &amp;quot;Not enough memory for fci &amp;quot;&lt;br /&gt;
       allocate(BETA2(Nsz,Nsz),STAT=AllocateStatus)&lt;br /&gt;
       IF (AllocateStatus /= 0) STOP &amp;quot;Not enough memory for BETA2&amp;quot;&lt;br /&gt;
       allocate(BETA3(Nsz,Nsz,Nsz),STAT=AllocateStatus)&lt;br /&gt;
       IF (AllocateStatus /= 0) STOP &amp;quot;Not enough memory for BETA3&amp;quot;&lt;br /&gt;
       allocate(BETA4(Nsz,Nsz,Nsz,Nsz),STAT=AllocateStatus)&lt;br /&gt;
       IF (AllocateStatus /= 0) STOP &amp;quot;Not enough memory for BETA4&amp;quot;&lt;br /&gt;
       print *,&amp;quot;Done with allocations&amp;quot;&lt;br /&gt;
       return&lt;br /&gt;
       END&lt;br /&gt;
 &lt;br /&gt;
       program BETAY&lt;br /&gt;
       USE mp_data&lt;br /&gt;
       implicit none&lt;br /&gt;
       INTEGER :: I,J,K,L&lt;br /&gt;
       call mpinit(800)&lt;br /&gt;
       call mpsetprec(800)&lt;br /&gt;
       call mpsetoutputprec(700)&lt;br /&gt;
       zero='0.'&lt;br /&gt;
       one ='1.'&lt;br /&gt;
       call allocate_arrays&lt;br /&gt;
       fac(0)=one&lt;br /&gt;
       fci(0)=one&lt;br /&gt;
       do j=1,Nsz&lt;br /&gt;
         fac(j)=fac(j-1)*j&lt;br /&gt;
         fci(j)=one/fac(j)&lt;br /&gt;
       end do&lt;br /&gt;
       I=Nsz/2&lt;br /&gt;
       J=I-1&lt;br /&gt;
       K=J-1&lt;br /&gt;
       L=K-1&lt;br /&gt;
       write(6,1000) I,J,K,L&lt;br /&gt;
  1000 format(/&amp;quot;I,J,K,L = &amp;quot;,4i3)&lt;br /&gt;
       write(6,1001) I&lt;br /&gt;
  1001 format(/&amp;quot;fac(&amp;quot;,i3.3,&amp;quot;) =&amp;quot;,$)&lt;br /&gt;
       call mpwrite(6,fac(I))&lt;br /&gt;
       BETA2(I,J)      =fac(I)*fac(J)*fci(I+J)&lt;br /&gt;
       BETA3(I,J,K)    =fac(I)*fac(J)*fac(K)*fci(I+J)*fci(J+K)&lt;br /&gt;
       BETA4(I,J,K,L)  =fac(I)*fac(J)*fac(K)*fac(L)*                     &amp;amp;&lt;br /&gt;
      &amp;amp;                 fci(I+J)*fci(J+K)*fci(K+L)&lt;br /&gt;
       write(6,1002) I,J&lt;br /&gt;
  1002 format(/&amp;quot;BETA2(&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;) =&amp;quot;)&lt;br /&gt;
       call mpwrite(6,BETA2(I,J))&lt;br /&gt;
       write(6,1003) I,J,K&lt;br /&gt;
  1003 format(/&amp;quot;BETA3(&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;) =&amp;quot;)&lt;br /&gt;
       call mpwrite(6,BETA3(I,J,K))&lt;br /&gt;
       write(6,1004) I,J,K,L&lt;br /&gt;
  1004 format(/&amp;quot;BETA4(&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;,&amp;quot;,i3.3,&amp;quot;) =&amp;quot;)&lt;br /&gt;
       call mpwrite(6,BETA4(I,J,K,L))&lt;br /&gt;
       write(6,1005)&lt;br /&gt;
  1005 format(/&amp;quot;DONE&amp;quot;//)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Run Interactive====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~/samples/mpfun90/betax] ssh orc-dev1&lt;br /&gt;
[roberpj@orc129:~] module purge; module load ldwrapper; module load intel/15.0.3; module load mpfun90/intel1503/20100825&lt;br /&gt;
[roberpj@orc129:~] cd ~/samples/mpfun90/betax&lt;br /&gt;
[roberpj@orc129:~/samples/mpfun90/betay] ifort betay.f90 -mcmodel medium -shared-intel $MPFUN90_ROOT/toolkit/mpmod90.o $MPFUN90_ROOT/toolkit/mpfun90.o -I$MPFUN90_ROOT/toolkit&lt;br /&gt;
[roberpj@orc129:~/samples/mpfun90/betay] ./a.out&lt;br /&gt;
 Done with allocations&lt;br /&gt;
&lt;br /&gt;
I,J,K,L =  24 23 22 21&lt;br /&gt;
&lt;br /&gt;
fac(024) =10 ^        23 x  6.2044840173323943936,&lt;br /&gt;
&lt;br /&gt;
BETA2(024,023) =&lt;br /&gt;
10 ^       -14 x  6.2020112243197155666795543346647015590753323586760996092750&lt;br /&gt;
322219057797634187521971369584938063040803657153278083912027225083805532623694&lt;br /&gt;
253019502124309149392729129350380917947755526197968886374824625487894350759012&lt;br /&gt;
041810328483619840297565282378760232413828873982152911730876431238573292437598&lt;br /&gt;
662321548481235961397432074855738879756265023434311148398287293760405994587153&lt;br /&gt;
193913843867324131168164219803469468792765957446870530750541069496092327458240&lt;br /&gt;
264036867349068267612059922537556261610989123549224099029159406148147186635876&lt;br /&gt;
682339231176161254018298581141061530140422181489818261044243997939224351270878&lt;br /&gt;
819950204611859530447542248373743937988058087925403948261102164487732977810152&lt;br /&gt;
365677688323239749,&lt;br /&gt;
&lt;br /&gt;
BETA3(024,023,022) =&lt;br /&gt;
10 ^       -49 x  5.8275670518268372535457693390802431850085211093628371195552&lt;br /&gt;
665374004872800254829089878748169551314149473682136937787061527746060528126189&lt;br /&gt;
766201816798822863047397630953393452298952922317427385387709426414471466082503&lt;br /&gt;
710520168054747139227447182197529542668023453841447481072362595230792080104688&lt;br /&gt;
990118018686670752770192225324208683555045454680275731685429800649187636704457&lt;br /&gt;
682218863512356150460390146982645823361128943131689947031597399022247950302452&lt;br /&gt;
330798644776819869632357497968409458052013048605853804143958746701285425073948&lt;br /&gt;
635138571530969417104049554300550153503104110125327389142504664160736472211972&lt;br /&gt;
376564769573352356164657421339817982321431569247028739128974299782191260982443&lt;br /&gt;
302487480103263037,&lt;br /&gt;
&lt;br /&gt;
BETA4(024,023,022,021) =&lt;br /&gt;
10 ^       -82 x  4.9281568290835382164029311372592682488032902612395816340121&lt;br /&gt;
089418282192742634150386978468714226783345875673304699950206823277002261928996&lt;br /&gt;
900244023525594363488176338336719985617691508208486288075631383295355204178844&lt;br /&gt;
640181812076780791059441681639997667611161419120033906970044689546074997396047&lt;br /&gt;
324233844363558571961437990937177293607133483649131082039969185440365241880338&lt;br /&gt;
469876039008981574675398716901015661349359043742699044662693828465598208328182&lt;br /&gt;
649393881845546476915223922569122221086448855100004979240419350679011848465439&lt;br /&gt;
752707160104858505636971713317247147406784939008134376861978582533070195429961&lt;br /&gt;
381129842064351212761591279694768634684602143478580742025860111467351736320562&lt;br /&gt;
750016997598905712,&lt;br /&gt;
&lt;br /&gt;
DONE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Run In Queue====&lt;br /&gt;
&lt;br /&gt;
The executable requires 4G or more. Setting mpp=8G should work (logout then in again to reset to default environment): &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 5m --mpp=8.0G -o ofile.%J ./a.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Math Toolkit==&lt;br /&gt;
&lt;br /&gt;
===Running Mathinit===&lt;br /&gt;
This toolkit provides and extensive example of how the mpfun package can be used.  Read the header of files &lt;br /&gt;
 mathinit.f90 &lt;br /&gt;
     and &lt;br /&gt;
 mathtool.f90 &lt;br /&gt;
found under &lt;br /&gt;
 /opt/sharcnet/mpfun90/version/[flavor]/toolkit &lt;br /&gt;
for an explanation what the package does.  The Makefile in this directory shows how the mpfun libraries were linked to compile this sample program pair.  The following steps shows the first initialization step followed by actually running the mathtool program to perform some examples such as performing an integration and displaying the value of pie.  Note that the displayed zero cputimes are due to a bug in the mpfun current build which will be fixed in future updates on the clusters.&lt;br /&gt;
&lt;br /&gt;
To run Mathtool you must first generate following two input files &lt;br /&gt;
 const.dat &lt;br /&gt;
   and &lt;br /&gt;
 quadts.dat &lt;br /&gt;
&lt;br /&gt;
which can be accomplished by running following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/math] cp /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mathinit .&lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/math] chmod 700 mathinit &lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/math] ./mathinit&lt;br /&gt;
 mathinit: start&lt;br /&gt;
 const complete&lt;br /&gt;
 file const.dat written&lt;br /&gt;
 cpu time =   2.57360911369324     &lt;br /&gt;
initqts: Tanh-sinh quadrature initialization&lt;br /&gt;
           0       18632&lt;br /&gt;
        1000       18632&lt;br /&gt;
        2000       18632&lt;br /&gt;
        3000       18632&lt;br /&gt;
        4000       18632&lt;br /&gt;
        5000       18632&lt;br /&gt;
        6000       18632&lt;br /&gt;
        7000       18632&lt;br /&gt;
        8000       18632&lt;br /&gt;
initqts: Table spaced used =    8177&lt;br /&gt;
 initqts complete&lt;br /&gt;
 file quadts.dat written&lt;br /&gt;
 cpu time =   90.4362528324127     &lt;br /&gt;
 total cpu time =   93.0098619461060&lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/mathinit] ls&lt;br /&gt;
const.dat  mathinit  quadts.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running Mathtool===&lt;br /&gt;
Use the files created in the previous section to run mathtool as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/math] cp /opt/sharcnet/mpfun90/20100825/intel1503/toolkit/mathtool .&lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/math] chmod 700 mathtool &lt;br /&gt;
[roberpj@orc-login1:~/samples/mpfun90/math] ./mathtool &lt;br /&gt;
Welcome to the Experimental Mathematician's Toolkit&lt;br /&gt;
Initializing...&lt;br /&gt;
&lt;br /&gt;
Current settings:&lt;br /&gt;
Debug level =   2&lt;br /&gt;
Primary precision level =   100 digits&lt;br /&gt;
Secondary precision level =   200 digits&lt;br /&gt;
Primary epsilon = 10^  -100&lt;br /&gt;
Secondary epsilon = 10^  -200&lt;br /&gt;
PSLQ bound = 100&lt;br /&gt;
PSLQ level =   1&lt;br /&gt;
Quadrature level =   6&lt;br /&gt;
Quadrature type =   3  (Tanh-Sinh)&lt;br /&gt;
&lt;br /&gt;
Sample expressions (case insensitive):&lt;br /&gt;
e + pi + log2 + log10 + catalan  Adds these pre-defined constants.&lt;br /&gt;
result[1] + result[2]            Adds result #1 to result #2.&lt;br /&gt;
alpha = arctan[3] - 3*log[2]     Defines or sets user variable alpha.&lt;br /&gt;
fun1[x,y] = 2*sqrt[x]*erf[y]     Defines user function fun1.&lt;br /&gt;
clear[nam1]                      Clears definition of variable or function.&lt;br /&gt;
integrate[1/(1+x^2), {x, 0, 1}]  Integrates 1/(1+x^2) from x=0 to 1.&lt;br /&gt;
sum[1/2^k, {k, 0, infinity}]     Sums 1/2^k from k=0 to infinity.&lt;br /&gt;
binomial[20,10]*factorial[10]    Evaluates binomial coeff and factorial.&lt;br /&gt;
zeta[3] + zetaz[1,1,2]           Evaluates zeta and multi-zeta functions.&lt;br /&gt;
table[x^k, {k, 1, 4}]            Forms the list [x^1, x^2, x^3, x^4].&lt;br /&gt;
pslq[table[x^k, {k, 0, n}]]      Finds coeffs of degree-n poly for x.&lt;br /&gt;
polyroot[1,-1,-1,{0.618}]        Finds real root of 1-x-x^2=0 near 0.618.&lt;br /&gt;
polyroot[1,2,3,{-0.33, 0.47}]    Complex root of 1+2x+3x^2 near -0.33+0.47i.&lt;br /&gt;
digits = 200                     Sets working precision to 200 digits.&lt;br /&gt;
epsilon = -190                   Sets epsilon level to 10^(-190).&lt;br /&gt;
eformat[190,180]                 Display using E format with 180 digits.&lt;br /&gt;
fformat[60,50]                   Display using F format with 50 digits.&lt;br /&gt;
input file.dat                   Inputs commands from file file.dat.&lt;br /&gt;
output file.dat                  Outputs user vars and funs to file.dat.&lt;br /&gt;
help polyroot                    Displays a brief explanation of polyroot.&lt;br /&gt;
functions                        Displays a list of all defined functions.&lt;br /&gt;
variables                        Displays a list of all defined variables.&lt;br /&gt;
prompt                           Displays this message.&lt;br /&gt;
exit                             Exits this program.&lt;br /&gt;
Expressions may be continued on next line by typing \ at end of line.&lt;br /&gt;
&lt;br /&gt;
integrate[1/(1+x^2), {x, 0, 1}]  (hit enter)&lt;br /&gt;
quadts: Iteration  1 of  6; est error = 10^    0; approx value =&lt;br /&gt;
       7.853157298876894309110693190063938396203990510665917998384243e-1&lt;br /&gt;
quadts: Iteration  2 of  6; est error = 10^    0; approx value =&lt;br /&gt;
       7.853981605125528448099840689980111720633592558858121242731082e-1&lt;br /&gt;
quadts: Iteration  3 of  6; est error = 10^  -17; approx value =&lt;br /&gt;
       7.853981633974483082028533923930157568609007576776270726821597e-1&lt;br /&gt;
quadts: Iteration  4 of  6; est error = 10^  -36; approx value =&lt;br /&gt;
       7.853981633974483096156608458198757190586422063114153956005278e-1&lt;br /&gt;
quadts: Iteration  5 of  6; est error = 10^  -71; approx value =&lt;br /&gt;
       7.853981633974483096156608458198757210492923498437764552437361e-1&lt;br /&gt;
quadts: Iteration  6 of  6; est error = 10^ -101; approx value =&lt;br /&gt;
       7.853981633974483096156608458198757210492923498437764552437361e-1&lt;br /&gt;
Result[  1] =&lt;br /&gt;
     7.85398163397448309615660845819875721049292349843776455243736148076954e-1&lt;br /&gt;
CPU time =      0.1730&lt;br /&gt;
&lt;br /&gt;
functions   (hit enter)&lt;br /&gt;
Abs              Arccos           Arcsin           Arctan          &lt;br /&gt;
Arctan2          Bessel           Besselexp        Binomial        &lt;br /&gt;
Cos              Erf              Exp              Factorial       &lt;br /&gt;
Gamma            Integrate        Log              Max             &lt;br /&gt;
Min              Polyroot         Pslq             Result          &lt;br /&gt;
Sin              Sqrt             Sum              Table           &lt;br /&gt;
Tan              Zeta             Zetap            Zetaz           &lt;br /&gt;
&lt;br /&gt;
variables    (hit enter)&lt;br /&gt;
E                Log2             Log10            Pi              &lt;br /&gt;
Catalan          Eulergamma       Infinity         Arg1            &lt;br /&gt;
Arg2             Arg3             Arg4             Arg5            &lt;br /&gt;
Arg6             Arg7             Arg8             Arg9            &lt;br /&gt;
Debug            Digits           Digits2          Epsilon         &lt;br /&gt;
Epsilon2         Pslqbound        Pslqlevel        Quadlevel       &lt;br /&gt;
Quadtype         x                &lt;br /&gt;
&lt;br /&gt;
Pi          (hit enter)     &lt;br /&gt;
Result[  2] =&lt;br /&gt;
      3.14159265358979323846264338327950288419716939937510582097494459230781e0&lt;br /&gt;
CPU time =      0.0000&lt;br /&gt;
&lt;br /&gt;
sqrt[1600]    (hit enter)  &lt;br /&gt;
Result[  1] =&lt;br /&gt;
      4.00000000000000000000000000000000000000000000000000000000000000000000e1&lt;br /&gt;
CPU time =      0.0000&lt;br /&gt;
&lt;br /&gt;
help  Binomial   (hit enter)  &lt;br /&gt;
Binomial[m,n] computes the binomial coefficient of integers (m,n).          &lt;br /&gt;
&lt;br /&gt;
Binomial[3,2]    (hit enter)  &lt;br /&gt;
Result[  2] =&lt;br /&gt;
      3.00000000000000000000000000000000000000000000000000000000000000000000e0&lt;br /&gt;
CPU time =      0.0000&lt;br /&gt;
&lt;br /&gt;
hypo[x,y] = sqrt[x^2+y^2]    (hit enter)  &lt;br /&gt;
parse: new function name = hypo            &lt;br /&gt;
CPU time =      0.0000&lt;br /&gt;
&lt;br /&gt;
z=hypo[3,4]                  (hit enter)  &lt;br /&gt;
parse: new variable name = z               &lt;br /&gt;
CPU time =      0.0000&lt;br /&gt;
&lt;br /&gt;
z                            (hit enter)  &lt;br /&gt;
Result[  3] =&lt;br /&gt;
      5.00000000000000000000000000000000000000000000000000000000000000000000e0&lt;br /&gt;
CPU time =      0.0000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o High-Precision Software Directory&amp;lt;br&amp;gt;&lt;br /&gt;
http://crd.lbl.gov/~dhbailey/mpdist/index.html&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=17955</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=17955"/>
				<updated>2019-06-06T14:29:19Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCMissing}}&lt;br /&gt;
{{Template:GrahamUpdate}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently the version of MKL 10.3.9 is the default and its module  (mkl/10.3.9) is loaded automatically when you login.  Version 11.1.4 is also available (mkl/11.1.4)&lt;br /&gt;
&lt;br /&gt;
Later versions of MKL are bundled with the Intel compiler. You can still load them separately (for use with different compiler) by loading modules: intel/mkl/15.0.3, intel/mkl/15.0.6, intel/mkl/16.0.3.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
&lt;br /&gt;
==== Fortran DGEMM example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 $FC test_dgemm.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -openmp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;fortran&amp;quot;&amp;gt;&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fortran ZDOTC  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;fortran&amp;quot;&amp;gt;&lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== C ZDOTC  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any SHARCNET cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL.  For instance, to determine the link arguments for the MKL version 10.3, Linux Operating System, Intel Compiler, Intel (R) 64 architecture, Static Linking, 32 bit Integers, sequential version of MKL, ScaLAPACK library, and OpenMPI, the MKL Link Line Advisor would return the following linking recomendation (the syntax below would go into your [[Make utility and makefiles|Makefile]]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(MKLROOT)/lib/intel64/libmkl_scalapack_lp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_sequential.a -Wl,--end-group $(MKLROOT)/lib/intel64/libmkl_blacs_openmpi_lp64.a -lpthread -lm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the following recommendation for locating the include files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 -I$(MKLROOT)/include&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The $(MKLROOT) will already be set for you by the MKL module which is currently loaded.  The above case is the one applicable on most SHARCNET clusters.&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
==== FFTW Interface Support====&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Introduction to Using the MKL FFT====&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Intel MKL Examples====&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
https://software.intel.com/en-us/node/528682&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;br /&gt;
&lt;br /&gt;
o Working with the Intel® Math Kernel Library Cluster Software&amp;lt;br&amp;gt;&lt;br /&gt;
https://software.intel.com/en-us/node/528420&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=LSDYNA&amp;diff=17951</id>
		<title>LSDYNA</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=LSDYNA&amp;diff=17951"/>
				<updated>2019-06-06T14:25:42Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCMissing}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=LSDYNA&lt;br /&gt;
|package_description=Suite of programs for transient dynamic finite element program&lt;br /&gt;
|package_idnumber=104&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Before a research group can use LSDYNA on sharcnet, a license must be purchased directly from LSTC for the sharcnet license server.  Alternately, if a research group resides at a institution that has sharcnet computing hardware (mac, uwo, guelph, waterloo) it maybe possible to use a pre-existing site license hosted on an accessible institutional license server.   To access and use this software you must open a ticket and request to be added to the sharcnet &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;lsdyna&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
==Graham Cluster==&lt;br /&gt;
&lt;br /&gt;
===License===&lt;br /&gt;
&lt;br /&gt;
Create and customize this file for your license server, where XXXXX should be replaced with your port number and Y with your server number:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@gra1:~] cat .licenses/ls-dyna.lic &lt;br /&gt;
 #LICENSE_TYPE: network&lt;br /&gt;
 #LICENSE_SERVER: XXXXX@licenseY.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
===Module===&lt;br /&gt;
&lt;br /&gt;
The modules are loaded automatically in the testomp.sh and testmpi.sh script shown below in the example section:&lt;br /&gt;
&lt;br /&gt;
For single node smp jobs the available versions can be found by doing:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@gra-login2:~] module spider ls-dyna&lt;br /&gt;
        ls-dyna/7.1.2&lt;br /&gt;
        ls-dyna/7.1.3&lt;br /&gt;
        ls-dyna/8.1&lt;br /&gt;
        ls-dyna/9.1&lt;br /&gt;
        ls-dyna/9.2&lt;br /&gt;
        ls-dyna/10.0&lt;br /&gt;
&lt;br /&gt;
To load any version do for example:&lt;br /&gt;
&lt;br /&gt;
 module load ls-dyna/9.1&lt;br /&gt;
&lt;br /&gt;
For multi node mpp jobs the available versions can be found by doing:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@gra-login2:~] module spider ls-dyna-mpi&lt;br /&gt;
        ls-dyna-mpi/7.1.2&lt;br /&gt;
        ls-dyna-mpi/7.1.3&lt;br /&gt;
        ls-dyna-mpi/8.1&lt;br /&gt;
        ls-dyna-mpi/9.1&lt;br /&gt;
        ls-dyna-mpi/9.2&lt;br /&gt;
        ls-dyna-mpi/10.0&lt;br /&gt;
&lt;br /&gt;
To load the 7.1.X modules do the following:&lt;br /&gt;
 module load openmpi/1.6.5 ls-dyna-mpi/7.1.3&lt;br /&gt;
&lt;br /&gt;
To load the 8.X or 9.X modules do:&lt;br /&gt;
 module load openmpi/1.8.8 ls-dyna-mpi/9.2&lt;br /&gt;
&lt;br /&gt;
To load the 10.X modules do:&lt;br /&gt;
 module load openmpi/1.10.7 ls-dyna-mpi/10.0&lt;br /&gt;
&lt;br /&gt;
==Legacy Clusters==&lt;br /&gt;
&lt;br /&gt;
===License===&lt;br /&gt;
&lt;br /&gt;
Once a license configuration is established, the research group will be given a 5 digit port number.  The value should then be inserted into the appropriate departmental export statement before loading the module file as follows:&lt;br /&gt;
&lt;br /&gt;
o UofT Mechanical Engineering Dept&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license1.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o McGill Mechanical Engineering Department&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license2.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o UW Mechanical and Mechatronics Engineering Dept&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license3.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o Laurentian University Bharti School of Engineering&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license4.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o Fictitious Example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;12345&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license1.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
===Module===&lt;br /&gt;
&lt;br /&gt;
The next step is load the desired sharcnet lsdyna module version.  Check which modules are available by running the &amp;lt;i&amp;gt;module avail&amp;lt;/i&amp;gt; command then load one the modules as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~] module avail lsdyna&lt;br /&gt;
------------------------------------ /opt/sharcnet/modules ------------------------------------&lt;br /&gt;
lsdyna/hyb/r711.88920     lsdyna/mpp/r711.88920     lsdyna/smp/r611.79036&lt;br /&gt;
lsdyna/mpp/ls971.r85718   lsdyna/mpp/r712.95028     lsdyna/smp/r711.88920&lt;br /&gt;
lsdyna/mpp/ls980B1.011113 lsdyna/mpp/r800.95359     lsdyna/smp/r712.95028&lt;br /&gt;
lsdyna/mpp/r611.79036     lsdyna/mpp/r901.109912    lsdyna/smp/r800.95359&lt;br /&gt;
lsdyna/mpp/r611.80542     lsdyna/smp/ls980B1.78258  lsdyna/smp/r901.109912&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r9.0.1 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r901.109912&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna mkl&lt;br /&gt;
module load intel/15.0.3 openmpi/intel1503-std/1.8.7 lsdyna/mpp/r901.109912&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r8.0.0 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r800.95359&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna mkl&lt;br /&gt;
module load intel/15.0.3 openmpi/intel1503-std/1.8.7 lsdyna/mpp/r800.95359&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r7.1.2 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r712.95028&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module unload intel openmpi lsdyna&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.5 lsdyna/mpp/r712.95028&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r7.1.1 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r711.88920&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/mpp/r711.88920&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r6.1.1 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r611.79036&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna&lt;br /&gt;
&lt;br /&gt;
module load intel/11.1.069 openmpi/intel/1.6.4 lsdyna/mpp/r611.79036&lt;br /&gt;
or&lt;br /&gt;
module load intel/11.1.069 openmpi/intel/1.6.4 lsdyna/mpp/r611.80542&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;i&amp;gt;r611.80542&amp;lt;/i&amp;gt; provides lsdyna_s only.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====ls980 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/ls980B1.78258&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna&lt;br /&gt;
&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.4.5 lsdyna/mpp/ls980B1.011113&lt;br /&gt;
or&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.2 lsdyna/smp/ls980B1.78258&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note1) restart capability for ls980smpB1 and ls980mppB1 is not supported&lt;br /&gt;
Note2) the module using legacy openmpi/intel/1.4.5 will run extremely slow&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
==Graham Cluster==&lt;br /&gt;
&lt;br /&gt;
The submission scripts myompjob.sh and mympijob.sh for the airbag problem are shown in the &amp;lt;b&amp;gt;Example Job&amp;lt;/b&amp;gt; section below, for both graham and orca.  Please note that you should specify your own username if submitting to a def account (not roberpj).  Alternatively you could specify your resource allocation account:&lt;br /&gt;
&lt;br /&gt;
Sample threaded job submit script:&lt;br /&gt;
&lt;br /&gt;
 sbatch myompjob.sh&lt;br /&gt;
&lt;br /&gt;
Sample mpi job submit script:&lt;br /&gt;
&lt;br /&gt;
 sbatch  mympijob.sh&lt;br /&gt;
&lt;br /&gt;
==Legacy Clusters==&lt;br /&gt;
&lt;br /&gt;
When loading a lsdyna sharcnet legacy module on the new orca or a sharcnet legacy system, the single or double precision solvers are specified with &amp;lt;strong&amp;gt;lsdyna_s&amp;lt;/strong&amp;gt; or &amp;lt;strong&amp;gt;lsdyna_d&amp;lt;/strong&amp;gt; respectively, as shown in the following sqsub commands:&lt;br /&gt;
&lt;br /&gt;
===1cpu SERIAL Job===&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 1h -q serial -o ofile.%J --mpp=2G lsdyna_d i=airbag.deploy.k ncpu=1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4cpu SMP Job===&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 1h -q threaded -n 4 -o ofile.%J --mpp=1G lsdyna_s i=airbag.deploy.k ncpu=4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using an explicit solver, one can specify a conservative initial memory setting on the command line as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export LSTC_MEMORY=auto&lt;br /&gt;
sqsub -r 1h -q threaded -n 4 -o ofile.%J --mpp=2G lsdyna_d i=airbag.deploy.k ncpu=4 memory=754414&amp;lt;/pre&amp;gt;&lt;br /&gt;
where memory is the minimum number of 8 byte words shared by all processors in double precision, or, 4 byte words in single precision.&lt;br /&gt;
&lt;br /&gt;
The initial value can be determined by starting a simulation interactively on the command line, and finding the output resembling: &amp;lt;i&amp;gt; Memory required to begin solution      :      754414&amp;lt;/i&amp;gt;.    The number of words can be specified as memory=260M instead of memory=260000000,  for further details see https://www.d3view.com/2006/10/a-few-words-on-memory-settings-in-ls-dyna/.  &lt;br /&gt;
&lt;br /&gt;
===8cpu MPI Job===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 1h -q mpi -o ofile.%J -n 8 --mpp=2G lsdyna_d i=airbag.deploy.k&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial memory can also be specified for mpi jobs  on the sqsub command line with &amp;quot;memory=&amp;quot; for the first master processor to decompose the problem  and &amp;quot;memory2=&amp;quot; used on all processors including the master to solves the decomposed problem, where the values are specified as 4 bytes per word in single precision and 8 bytes per word in double precision.   The number of words can be specified as memory=260M instead of memory=260000000 OR memory2=260M instead of memory2=260000000 for further details see https://www.d3view.com/2006/10/a-few-words-on-memory-settings-in-ls-dyna/.  The initial values can be found by running simulation interactively on a orca compute node and checking the output for a line such as: &amp;lt;i&amp;gt;Memory required to begin solution (memory=     464898  memory2=     158794 )&amp;lt;/i&amp;gt; which could then be implemented for a job run in the queue by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export LSTC_MEMORY=auto&lt;br /&gt;
sqsub -r 1h -q mpi -o ofile.%J -n 8 --mpp=2G lsdyna_d i=airbag.deploy.k memory=464898 memory2=158794&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The specification of memory2 on sharcnet or compute canada clusters is not beneficial since the queue reserves the same memory per core for all nodes, such that the decomposition master node process cannot be allocated to have larger system memory.  Therefore its sufficient to specify a single memory parameter by doing:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export LSTC_MEMORY=auto &lt;br /&gt;
sqsub -r 1h -q mpi -o ofile.%J -n 8 --mpp=2G lsdyna_d i=airbag.deploy.k memory=464898&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the LSTC_MEMORY variable will only allow the memory to grow for explicit simulations. The following slurm examples demonstrate how to prescribe the memory parameters exactly.&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
Copy the airbag example to your account:&lt;br /&gt;
&lt;br /&gt;
 rsync -av orca.computecanada.ca:/opt/sharcnet/lsdyna/r901.109912/examples r901.109912_examples&lt;br /&gt;
 cd r901.109912_examples/examples/misc/airbag&lt;br /&gt;
 gunzip airbag.deploy.k.gz&lt;br /&gt;
&lt;br /&gt;
==Graham (default modules)==&lt;br /&gt;
&lt;br /&gt;
Please note that graham does not have the sharcnet legacy modules installed on it.&lt;br /&gt;
&lt;br /&gt;
===Threaded Job ===&lt;br /&gt;
&lt;br /&gt;
Sample submission script &amp;lt;b&amp;gt;mysmpjob1.sh&amp;lt;/b&amp;gt; for 4 core single precision smp job using compute canada default cvmfs modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --nodes=1                           # use one node&lt;br /&gt;
#SBATCH --cpus-per-task=4                   # number threads&lt;br /&gt;
#SBATCH --mem=4000M                         # total memory&lt;br /&gt;
#SBATCH --time=00:30:00                     # hrs:min:sec&lt;br /&gt;
#SBATCH --job-name=testsmp1                 # %x = jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out&lt;br /&gt;
echo &amp;quot;SLURM_CPUS_PER_TASK= &amp;quot;$SLURM_CPUS_PER_TASK&lt;br /&gt;
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
# IMPORTANT:  to set license server do either:&lt;br /&gt;
# 1) export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# 2) create  ~/.licenses/ls-dyna.lic as shown above&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
module load ls-dyna/9.1&lt;br /&gt;
ls-dyna_s i=airbag.deploy.k ncpu=4 memory=1000M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 4000M / 4 (bytes/word) = 1000M words&lt;br /&gt;
&lt;br /&gt;
===Mpi Job ===&lt;br /&gt;
&lt;br /&gt;
Sample submission script &amp;lt;b&amp;gt;mympijob2.sh&amp;lt;/b&amp;gt; for 4 core double precision mpp job using compute canada default cvmfs modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --ntasks=4                     # number of ranks&lt;br /&gt;
#SBATCH --mem-per-cpu=4000M            # memory per rank&lt;br /&gt;
#SBATCH --time=00:30:00                # hrs:min:sec&lt;br /&gt;
#SBATCH --job-name=testmpi2            # %x = jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
# IMPORTANT:  to set license server do either:&lt;br /&gt;
# 1) export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# 2) create  ~/.licenses/ls-dyna.lic as shown above&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
module load openmpi/1.8.8 ls-dyna-mpi/9.1&lt;br /&gt;
srun ls-dyna_d i=airbag.deploy.k memory=500M memory2=500M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 4000M / 8 (bytes/word) = 500M words&lt;br /&gt;
&lt;br /&gt;
==New Orca (legacy modules)==&lt;br /&gt;
&lt;br /&gt;
Please note, while new orca has most compute canada cvmfs modules available by default it does not have the graham the &amp;lt;i&amp;gt;ls-dyna&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;ls-dyna-mpi&amp;lt;/i&amp;gt; modules installed.  Therefore currently the only way to run lsdyna is by using the legacy sharcnet &amp;lt;i&amp;gt;lsdyna&amp;lt;/i&amp;gt; modules as shown in the following two smp and mpi examples. &lt;br /&gt;
&lt;br /&gt;
===Threaded Job ===&lt;br /&gt;
&lt;br /&gt;
Submission script &amp;lt;b&amp;gt;mysmpjob3.sh&amp;lt;/b&amp;gt; to run 16 core single precision single node smp job with sharcnet legacy modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --nodes=1                           # use one node&lt;br /&gt;
#SBATCH --cpus-per-task=16                  # number threads&lt;br /&gt;
#SBATCH --mem=4000M                         # total memory&lt;br /&gt;
#SBATCH --time=00:30:00                     # hrs:min:sec&lt;br /&gt;
#SBATCH --job-name=mysmpjob3-1node-16core    # jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out         # %x = jobname&lt;br /&gt;
echo &amp;quot;SLURM_CPUS_PER_TASK= &amp;quot;$SLURM_CPUS_PER_TASK&lt;br /&gt;
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
# ----------------------------------------------------------------&lt;br /&gt;
# IMPORTANT:  to set license server for legacy modules:&lt;br /&gt;
export LSTC_LICENSE_SERVER=31047@license3.sharcnet.ca&lt;br /&gt;
# since ~/.licenses/ls-dyna.lic does NOT work with legacy modules&lt;br /&gt;
# ----------------------------------------------------------------&lt;br /&gt;
module purge --force&lt;br /&gt;
export MODULEPATH=/opt/sharcnet/modules&lt;br /&gt;
module load lsdyna/smp/r712.95028&lt;br /&gt;
lsdyna_s i=airbag.deploy.k ncpu=$SLURM_CPUS_PER_TASK memory=500M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 4000M / 8 (bytes/word) = 500M words&lt;br /&gt;
&lt;br /&gt;
===MPI Job ===&lt;br /&gt;
&lt;br /&gt;
To run the sharcnet legacy &amp;lt;i&amp;gt;module lsdyna/mpp/r712.95028&amp;lt;/i&amp;gt; efficiently over several compute nodes with many cores requires using orca's xeon nodes as shown in &amp;lt;b&amp;gt; mympijob4.sh&amp;lt;/b&amp;gt; below.   To run lsdyna on orca's opteron nodes with &amp;lt;i&amp;gt;module lsdyna/mpp/r712.95028&amp;lt;/i&amp;gt; requires using only &amp;lt;b&amp;gt;one&amp;lt;/b&amp;gt; opteron node as shown in &amp;lt;b&amp;gt; mympijob5.sh&amp;lt;/b&amp;gt; below.  The other legacy sharcnet lsdyna mpp modules, as shown in the Availability Table  lsdyna/mpp/ls971.r85718, lsdyna/mpp/ls980B1.011113, lsdyna/mpp/r611.79036, lsdyna/mpp/r611.80542, lsdyna/mpp/r711.88920, lsdyna/mpp/r800.95359 and lsdyna/mpp/r901.109912 have yet to be tested. If you want to use one but cannot get it working please open a ticket.  Note that lines containing a space between &amp;quot;# and SBATCH&amp;quot; are comments.  To activate such line(s) required removal of the space ie) &amp;quot;#SBATCH&amp;quot;.  Its recommended to use &amp;lt;i&amp;gt;module ls-dyna-mpi&amp;lt;/i&amp;gt; on graham instead since the machine is far newer, faster and reliable. &lt;br /&gt;
&lt;br /&gt;
====Multi Node Slurm Script====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~/samples/lsdyna/airbag] cat mympijob4.sh&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --constraint=xeon&lt;br /&gt;
#SBATCH --ntasks=48&lt;br /&gt;
#SBATCH --mem-per-cpu=4000M&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --job-name=mympijob4-Xnodes-48cores-xeon  # jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out             # %x = jobname&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
# To set license server when using legacy sharcnet modules:&lt;br /&gt;
export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# since ~/.licenses/ls-dyna.lic does not work with legacy modules.&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
module purge --force&lt;br /&gt;
export MODULEPATH=/opt/sharcnet/modules&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.5 lsdyna/mpp/r712.95028&lt;br /&gt;
MACHINEFILE=`srun hostname -s | tr '\n' ':' | sed 's/:/,/g' | sed 's/.$//'`&lt;br /&gt;
mpirun --host $MACHINEFILE --mca plm_slurm_args '--cpu_bind=none' lsdyna_s i=airbag.deploy.k memory=250M memory2=250M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Single Node Slurm Script====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~/samples/lsdyna/airbag] cat mympijob5.sh&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --constraint=opteron&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
# SBATCH --ntasks=24&lt;br /&gt;
# SBATCH --mem=0&lt;br /&gt;
#SBATCH --ntasks=16&lt;br /&gt;
#SBATCH --mem-per-cpu=1000M&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --job-name=mympijob5-1node-16cores-opteron  # jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out         # %x = jobname&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
# To set license server when using legacy sharcnet modules:&lt;br /&gt;
export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# since ~/.licenses/ls-dyna.lic does not work with legacy modules.&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
module purge --force&lt;br /&gt;
export MODULEPATH=/opt/sharcnet/modules&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.5 lsdyna/mpp/r712.95028&lt;br /&gt;
MACHINEFILE=`srun hostname -s | tr '\n' ':' | sed 's/:/,/g' | sed 's/.$//'`&lt;br /&gt;
mpirun --host $MACHINEFILE lsdyna_s i=airbag.deploy.k memory=250M memory2=250M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 1000M / 4 (bytes/word) = 250M words&lt;br /&gt;
&lt;br /&gt;
==Legacy Clusters==&lt;br /&gt;
&lt;br /&gt;
STEP1) The following shows sqsub submission of the [http://www.dynaexamples.com/examples-manual/misc/airbag airbag] example to the mpi queue.  Its recommended to first edit  &amp;lt;i&amp;gt;airbag.deploy.k&amp;lt;/i&amp;gt;  and change &amp;lt;i&amp;gt;endtim&amp;lt;/i&amp;gt; to 3.000E-00 so the job runs long enough to perform the restart in steps 2 and 3 below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /opt/sharcnet/lsdyna/r611.79036/examples /scratch/$USER/test-lsdyna&lt;br /&gt;
cd /scratch/$USER/test-lsdyna/misc/airbag&lt;br /&gt;
gunzip airbag.deploy.k.gz&lt;br /&gt;
cp airbag.deploy.k airbag.deploy.restart.k&lt;br /&gt;
nano deploy.restart.k (reduce plot file creation frequency)&lt;br /&gt;
   *DATABASE_BINARY_D3PLOT&lt;br /&gt;
   $       dt      lcdtdeploy.restart.k&lt;br /&gt;
   1.000E-01   &amp;lt;--- change from 5.000E-04 &lt;br /&gt;
export LSTC_LICENSE_SERVER=#####@license#.uwo.sharcnet&lt;br /&gt;
module unload intel openmpi lsdyna&lt;br /&gt;
module load intel/11.1.069 openmpi/intel/1.6.4 lsdyna/mpp/r611.79036&lt;br /&gt;
sqsub -r 10m -q mpi --mpp=2G -n 8 -o ofile.%J lsdyna_d i=airbag.deploy.k&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
STEP2) With the job still running, use the echo command as follows to create a file called &amp;quot;D3KIL&amp;quot; that will trigger generation of restart files at which point the file D3KIL itself will be erased.  Do this once a day if data loss is critical to you OR once or twice just before the  &amp;lt;i&amp;gt;sqsub -r&amp;lt;/i&amp;gt; time limit is reached.  Further information can be found here http://www.dynasupport.com/tutorial/ls-dyna-users-guide/sense-switch-control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;sw3&amp;quot; &amp;gt; D3KIL&lt;br /&gt;
sqkill job#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
STEP3) Before the job can be restarted, the following two lines must be added to the &amp;lt;i&amp;gt;airbag.deploy.restart.k&amp;lt;/i&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*CHANGE_CURVE_DEFINITION&lt;br /&gt;
         1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
STEP4) Now resubmit the job as follows using &amp;quot;r=&amp;quot; to specify the restart file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 1h -q mpi --mpp=2G -n 8 -o ofile.%J lsdyna_d i=airbag.deploy.restart.k r=d3dump01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General Notes=&lt;br /&gt;
&lt;br /&gt;
==Graham Cluster==&lt;br /&gt;
&lt;br /&gt;
There are no special notes at the present time in regards to using lsdyna on graham.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Command Line Use==&lt;br /&gt;
&lt;br /&gt;
Following the upgrade of orca to the compute canada module stack, the orca development nodes were discontinued.&amp;lt;br&amp;gt;&lt;br /&gt;
Therefore this section is no longer relevent and remain for historical purposes only.&lt;br /&gt;
&lt;br /&gt;
Parallel lsdyna jobs can be run interactively on the command line (outside the queue) for short run testing purposes as follows:&lt;br /&gt;
&lt;br /&gt;
o Orca Development Node MPP (mpi) Example&lt;br /&gt;
&lt;br /&gt;
 ssh orca.sharcnet.ca  &lt;br /&gt;
 ssh orc-dev1  (or dev2,3,4)&lt;br /&gt;
 module unload intel openmpi lsdyna&lt;br /&gt;
 module load intel/12.1.3 openmpi/intel/1.6.2 lsdyna/mpp/r711.88920&lt;br /&gt;
 mpirun -np 8 lsdyna_d i=airbag.deploy.k&lt;br /&gt;
&lt;br /&gt;
o Orca Development Node SMP (threaded) Example&lt;br /&gt;
&lt;br /&gt;
 ssh orca.sharcnet.ca  &lt;br /&gt;
 ssh orc-dev1  (or dev2,3,4)&lt;br /&gt;
 module unload intel openmpi lsdyna&lt;br /&gt;
 module load lsdyna/smp/r711.88920&lt;br /&gt;
 lsdyna_d i=airbag.deploy.k ncpu=8&lt;br /&gt;
&lt;br /&gt;
==Memory Issues==&lt;br /&gt;
&lt;br /&gt;
A minumum of mpp=2G is recommended although the memory requirement of a job may suggest much less is required. For instance setting mpp=1G for the airbag test job above will result in the following error when running a job in the queue:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
An attempt to set processor affinity has failed - please check to&lt;br /&gt;
ensure that your system supports such functionality. If so, then&lt;br /&gt;
this is probably something that should be reported to the OMPI developers.&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another error message which can occur after a job runs for a while if mpp is chosen to small is: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Process 45 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Signal 11 : Segmentation Violation &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get an idea of the amount of memory a job used run grep on the output file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~/samples/lsdyna/airbag]  cat  ofile.2063302.orc-admin2.orca.sharcnet | grep Memory&lt;br /&gt;
     |    Distributed Memory Parallel                  |&lt;br /&gt;
 Memory size from command line:      500000,       500000&lt;br /&gt;
 Memory for the head node&lt;br /&gt;
 Memory installed (MB)        :        32237&lt;br /&gt;
 Memory free (MB)             :        11259&lt;br /&gt;
 Memory required (MB)         :            0&lt;br /&gt;
 Memory required to process keyword     :       458120&lt;br /&gt;
 Memory required for decomposition      :       458120&lt;br /&gt;
 Memory required to begin solution (memory=      458120 memory2=      230721)&lt;br /&gt;
 Max. Memory reqd for implicit sol: max used               0&lt;br /&gt;
 Max. Memory reqd for implicit sol: incore                 0&lt;br /&gt;
 Max. Memory reqd for implicit sol: oocore                 0&lt;br /&gt;
 Memory required to complete solution (memory=      458120 memory2=      230721)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Version and Revision==&lt;br /&gt;
&lt;br /&gt;
Again run grep on the output file to extract the major and minor revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~/samples/lsdyna/airbag]  cat  ofile.2063302.orc-admin2.orca.sharcnet | grep 'Revision\|Version'&lt;br /&gt;
     |  Version : mpp s R6.1.1    Date: 01/02/2013     |&lt;br /&gt;
     |  Revision: 78769           Time: 07:43:30       |&lt;br /&gt;
     |  SVN Version: 80542                             |&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Check License Status==&lt;br /&gt;
&lt;br /&gt;
===Running and Queued Programs===&lt;br /&gt;
&lt;br /&gt;
To get a summary of running and/or queued jobs use the &amp;lt;i&amp;gt;lstc_qrun&amp;lt;/i&amp;gt; command as follows, where queued means the job has started running according to the sqsub command but its actually sitting waiting for license resources to come available.  Once these are acquired the job will start running on the cluster and appear as a Running Program according to  lstc_qrun ie)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[roberpj@hnd19:~] export LSTC_LICENSE_SERVER=#####@license#.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd19:~] lstc_qrun&lt;br /&gt;
Defaulting to server 1 specified by LSTC_LICENSE_SERVER variable&lt;br /&gt;
                     Running Programs&lt;br /&gt;
    User             Host          Program              Started       # procs&lt;br /&gt;
-----------------------------------------------------------------------------&lt;br /&gt;
dgierczy    20277@saw61.saw.sharcn LS-DYNA_971      Mon Apr  8 17:44     1&lt;br /&gt;
dgierczy     8570@saw32.saw.sharcn LS-DYNA_971      Mon Apr  8 17:44     1&lt;br /&gt;
dscronin    25486@hnd6             MPPDYNA_971      Tue Apr  9 20:19     6&lt;br /&gt;
dscronin    14897@hnd18            MPPDYNA_971      Tue Apr  9 21:48     6&lt;br /&gt;
dscronin    14971@hnd18            MPPDYNA_971      Tue Apr  9 21:48     6&lt;br /&gt;
dscronin    15046@hnd18            MPPDYNA_971      Tue Apr  9 21:48     6&lt;br /&gt;
dscronin    31237@hnd16            MPPDYNA_971      Tue Apr  9 21:53     6&lt;br /&gt;
dscronin    31313@hnd16            MPPDYNA_971      Tue Apr  9 21:54     6&lt;br /&gt;
dscronin     6396@hnd15            MPPDYNA_971      Tue Apr  9 21:54     6&lt;br /&gt;
csharson    28890@saw175.saw.sharc MPPDYNA_971      Wed Apr 10 16:48     6&lt;br /&gt;
No programs queued&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To show license file expiration details, append &amp;quot;-R&amp;quot; to the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[roberpj@hnd19:~] export LSTC_LICENSE_SERVER=#####@license#.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd19:~] lstc_qrun -R&lt;br /&gt;
Defaulting to server 1 specified by LSTC_LICENSE_SERVER variable&lt;br /&gt;
**** LICENSE INFORMATION ****&lt;br /&gt;
PROGRAM          EXPIRATION CPUS  USED   FREE    MAX | QUEUE&lt;br /&gt;
---------------- ----------      ----- ------ ------ | -----&lt;br /&gt;
LS-DYNA_971      12/31/2013          -    966   1024 |     0&lt;br /&gt;
 dgierczy   20277@saw61.saw.sharcnet   1&lt;br /&gt;
 dgierczy    8570@saw32.saw.sharcnet   1&lt;br /&gt;
MPPDYNA_971      12/31/2013          -    966   1024 |     0&lt;br /&gt;
 dscronin   25486@hnd6               6&lt;br /&gt;
 dscronin   14897@hnd18              6&lt;br /&gt;
 dscronin   14971@hnd18              6&lt;br /&gt;
 dscronin   15046@hnd18              6&lt;br /&gt;
 dscronin   31237@hnd16              6&lt;br /&gt;
 dscronin   31313@hnd16              6&lt;br /&gt;
 dscronin    6396@hnd15              6&lt;br /&gt;
 csharson   28890@saw175.saw.sharcnet   6&lt;br /&gt;
                   LICENSE GROUP    58    966   1024 |     0&lt;br /&gt;
&lt;br /&gt;
PROGRAM          EXPIRATION CPUS  USED   FREE    MAX | QUEUE&lt;br /&gt;
---------------- ----------      ----- ------ ------ | -----&lt;br /&gt;
LS-OPT           12/31/2013          0   1024   1024 |     0&lt;br /&gt;
                   LICENSE GROUP     0   1024   1024 |     0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Killling A Program===&lt;br /&gt;
&lt;br /&gt;
The queue normally kills lsdyna jobs cleanly.  However its possible that licences for a job (which is no longer running in the queue and therefore no longer has any processes running on the cluster) will continue to be tied up according to the lstc_qrun command.   To kill such a program determine the pid@hostname from the lstc_qrun command then run the following kill command.  The following example demonstrates the procedure for username roberpj:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~]  lstc_qrun -R | grep roberpj&lt;br /&gt;
roberpj    45312@orc329.orca.shar MPPDYNA          Wed Dec  5 15:50    12&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login2:~] lstc_qkill 45312@orc329.orca.sharcnet.ca&lt;br /&gt;
Defaulting to server 1 specified by LSTC_LICENSE_SERVER variable&lt;br /&gt;
Program queued for termination&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login2:~]  lstc_qrun -R | grep roberpj&lt;br /&gt;
[roberpj@orc-login2:~] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Legacy Instructions==&lt;br /&gt;
&lt;br /&gt;
The following binaries remain available on saw and orca for backward compatibility testing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~] cd /opt/sharcnet/local/lsdyna&lt;br /&gt;
[roberpj@orc129:/opt/sharcnet/local/lsdyna] ls ls971*&lt;br /&gt;
ls971_d_R3_1    ls971_d_R4_2_1  ls971_s_R3_1    ls971_s_R4_2_1  ls971_s_R5_1_1&lt;br /&gt;
ls971_d_R4_2_0  ls971_d_R5_0    ls971_s_R4_2_0  ls971_s_R5_0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are currently no sharcnet modules for these versions, hence jobs should be submitted as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load lsdyna&lt;br /&gt;
export PATH=/opt/sharcnet/local/lsdyna:$PATH&lt;br /&gt;
export LSTC_LICENSE_SERVER=XXXXX@license3.uwo.sharcnet&lt;br /&gt;
cp /opt/sharcnet/local/lsdyna/examples/airbag.deploy.k airbag.deploy.k&lt;br /&gt;
SERIAL JOB:  sqsub -q serial -r 1d -o ofile.%J ls971_d_R4_2_1 i=airbag.deploy.k&lt;br /&gt;
THREADED JOB:  sqsub -q threaded -n 4 -r 1d -o ofile.%J ls971_d_R4_2_1 ncpu=4 para=2 i=airbag.deploy.k&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note! the &amp;lt;i&amp;gt;ls971_s_R3_1&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;ls971_d_R3_1&amp;lt;/i&amp;gt; binaries do not work, a fix is being looked for.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o LSTC LS-DYNA Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.lstc.com/products/ls-dyna&lt;br /&gt;
&lt;br /&gt;
o LSTC LS-DYNA Support (Tutorials, HowTos, Faq, Manuals, Release Notes, News, Links)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.dynasupport.com/&lt;br /&gt;
&lt;br /&gt;
o LS-DYNA Release Notes&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.dynasupport.com/release-notes&lt;br /&gt;
&lt;br /&gt;
o LS-PrePost Online Documentation FAQ&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.lstc.com/lspp/content/faq.shtml&lt;br /&gt;
&lt;br /&gt;
o LSTC Download/Install Overview Page&amp;lt;br&amp;gt;&lt;br /&gt;
Provides links to binaries for LS-DYNA SMP/MPP, LS-OPT, LS-PREPOST, LS-TASC.&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.lstc.com/download&lt;br /&gt;
&lt;br /&gt;
==Memory Links==&lt;br /&gt;
&lt;br /&gt;
o Implicit: Memory notes&amp;lt;br&amp;gt; &lt;br /&gt;
http://www.dynasupport.com/howtos/implicit/implicit-memory-notes&lt;br /&gt;
&lt;br /&gt;
o LS-DYNA Support Environment variables&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.dynasupport.com/howtos/general/environment-variables&lt;br /&gt;
&lt;br /&gt;
o LS-DYNA and d3VIEW Blog (a few words on memory settings)&amp;lt;br&amp;gt;&lt;br /&gt;
http://blog2.d3view.com/a-few-words-on-memory-settings-in-ls-dyna/&lt;br /&gt;
&lt;br /&gt;
o Convert Words to GB ie) memory=500MW (3.73GB)&amp;lt;br&amp;gt;&lt;br /&gt;
http://deviceanalytics.com/memcalc.php&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=LSDYNA&amp;diff=17950</id>
		<title>LSDYNA</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=LSDYNA&amp;diff=17950"/>
				<updated>2019-06-06T14:25:30Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Tamplate:CCMissing}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=LSDYNA&lt;br /&gt;
|package_description=Suite of programs for transient dynamic finite element program&lt;br /&gt;
|package_idnumber=104&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Before a research group can use LSDYNA on sharcnet, a license must be purchased directly from LSTC for the sharcnet license server.  Alternately, if a research group resides at a institution that has sharcnet computing hardware (mac, uwo, guelph, waterloo) it maybe possible to use a pre-existing site license hosted on an accessible institutional license server.   To access and use this software you must open a ticket and request to be added to the sharcnet &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;lsdyna&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
==Graham Cluster==&lt;br /&gt;
&lt;br /&gt;
===License===&lt;br /&gt;
&lt;br /&gt;
Create and customize this file for your license server, where XXXXX should be replaced with your port number and Y with your server number:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@gra1:~] cat .licenses/ls-dyna.lic &lt;br /&gt;
 #LICENSE_TYPE: network&lt;br /&gt;
 #LICENSE_SERVER: XXXXX@licenseY.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
===Module===&lt;br /&gt;
&lt;br /&gt;
The modules are loaded automatically in the testomp.sh and testmpi.sh script shown below in the example section:&lt;br /&gt;
&lt;br /&gt;
For single node smp jobs the available versions can be found by doing:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@gra-login2:~] module spider ls-dyna&lt;br /&gt;
        ls-dyna/7.1.2&lt;br /&gt;
        ls-dyna/7.1.3&lt;br /&gt;
        ls-dyna/8.1&lt;br /&gt;
        ls-dyna/9.1&lt;br /&gt;
        ls-dyna/9.2&lt;br /&gt;
        ls-dyna/10.0&lt;br /&gt;
&lt;br /&gt;
To load any version do for example:&lt;br /&gt;
&lt;br /&gt;
 module load ls-dyna/9.1&lt;br /&gt;
&lt;br /&gt;
For multi node mpp jobs the available versions can be found by doing:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@gra-login2:~] module spider ls-dyna-mpi&lt;br /&gt;
        ls-dyna-mpi/7.1.2&lt;br /&gt;
        ls-dyna-mpi/7.1.3&lt;br /&gt;
        ls-dyna-mpi/8.1&lt;br /&gt;
        ls-dyna-mpi/9.1&lt;br /&gt;
        ls-dyna-mpi/9.2&lt;br /&gt;
        ls-dyna-mpi/10.0&lt;br /&gt;
&lt;br /&gt;
To load the 7.1.X modules do the following:&lt;br /&gt;
 module load openmpi/1.6.5 ls-dyna-mpi/7.1.3&lt;br /&gt;
&lt;br /&gt;
To load the 8.X or 9.X modules do:&lt;br /&gt;
 module load openmpi/1.8.8 ls-dyna-mpi/9.2&lt;br /&gt;
&lt;br /&gt;
To load the 10.X modules do:&lt;br /&gt;
 module load openmpi/1.10.7 ls-dyna-mpi/10.0&lt;br /&gt;
&lt;br /&gt;
==Legacy Clusters==&lt;br /&gt;
&lt;br /&gt;
===License===&lt;br /&gt;
&lt;br /&gt;
Once a license configuration is established, the research group will be given a 5 digit port number.  The value should then be inserted into the appropriate departmental export statement before loading the module file as follows:&lt;br /&gt;
&lt;br /&gt;
o UofT Mechanical Engineering Dept&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license1.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o McGill Mechanical Engineering Department&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license2.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o UW Mechanical and Mechatronics Engineering Dept&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license3.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o Laurentian University Bharti School of Engineering&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Port&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license4.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
o Fictitious Example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;purple&amp;quot;&amp;gt;export&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;LSTC_LICENSE_SERVER&amp;lt;/font&amp;gt;=&amp;lt;b&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;12345&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;@license1.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
===Module===&lt;br /&gt;
&lt;br /&gt;
The next step is load the desired sharcnet lsdyna module version.  Check which modules are available by running the &amp;lt;i&amp;gt;module avail&amp;lt;/i&amp;gt; command then load one the modules as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~] module avail lsdyna&lt;br /&gt;
------------------------------------ /opt/sharcnet/modules ------------------------------------&lt;br /&gt;
lsdyna/hyb/r711.88920     lsdyna/mpp/r711.88920     lsdyna/smp/r611.79036&lt;br /&gt;
lsdyna/mpp/ls971.r85718   lsdyna/mpp/r712.95028     lsdyna/smp/r711.88920&lt;br /&gt;
lsdyna/mpp/ls980B1.011113 lsdyna/mpp/r800.95359     lsdyna/smp/r712.95028&lt;br /&gt;
lsdyna/mpp/r611.79036     lsdyna/mpp/r901.109912    lsdyna/smp/r800.95359&lt;br /&gt;
lsdyna/mpp/r611.80542     lsdyna/smp/ls980B1.78258  lsdyna/smp/r901.109912&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r9.0.1 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r901.109912&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna mkl&lt;br /&gt;
module load intel/15.0.3 openmpi/intel1503-std/1.8.7 lsdyna/mpp/r901.109912&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r8.0.0 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r800.95359&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna mkl&lt;br /&gt;
module load intel/15.0.3 openmpi/intel1503-std/1.8.7 lsdyna/mpp/r800.95359&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r7.1.2 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r712.95028&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module unload intel openmpi lsdyna&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.5 lsdyna/mpp/r712.95028&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r7.1.1 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r711.88920&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/mpp/r711.88920&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====r6.1.1 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/r611.79036&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna&lt;br /&gt;
&lt;br /&gt;
module load intel/11.1.069 openmpi/intel/1.6.4 lsdyna/mpp/r611.79036&lt;br /&gt;
or&lt;br /&gt;
module load intel/11.1.069 openmpi/intel/1.6.4 lsdyna/mpp/r611.80542&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;i&amp;gt;r611.80542&amp;lt;/i&amp;gt; provides lsdyna_s only.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====ls980 versions====&lt;br /&gt;
&lt;br /&gt;
o For serial or threaded jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;module load lsdyna/smp/ls980B1.78258&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o For mpi jobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel openmpi lsdyna&lt;br /&gt;
&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.4.5 lsdyna/mpp/ls980B1.011113&lt;br /&gt;
or&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.2 lsdyna/smp/ls980B1.78258&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note1) restart capability for ls980smpB1 and ls980mppB1 is not supported&lt;br /&gt;
Note2) the module using legacy openmpi/intel/1.4.5 will run extremely slow&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
==Graham Cluster==&lt;br /&gt;
&lt;br /&gt;
The submission scripts myompjob.sh and mympijob.sh for the airbag problem are shown in the &amp;lt;b&amp;gt;Example Job&amp;lt;/b&amp;gt; section below, for both graham and orca.  Please note that you should specify your own username if submitting to a def account (not roberpj).  Alternatively you could specify your resource allocation account:&lt;br /&gt;
&lt;br /&gt;
Sample threaded job submit script:&lt;br /&gt;
&lt;br /&gt;
 sbatch myompjob.sh&lt;br /&gt;
&lt;br /&gt;
Sample mpi job submit script:&lt;br /&gt;
&lt;br /&gt;
 sbatch  mympijob.sh&lt;br /&gt;
&lt;br /&gt;
==Legacy Clusters==&lt;br /&gt;
&lt;br /&gt;
When loading a lsdyna sharcnet legacy module on the new orca or a sharcnet legacy system, the single or double precision solvers are specified with &amp;lt;strong&amp;gt;lsdyna_s&amp;lt;/strong&amp;gt; or &amp;lt;strong&amp;gt;lsdyna_d&amp;lt;/strong&amp;gt; respectively, as shown in the following sqsub commands:&lt;br /&gt;
&lt;br /&gt;
===1cpu SERIAL Job===&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 1h -q serial -o ofile.%J --mpp=2G lsdyna_d i=airbag.deploy.k ncpu=1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4cpu SMP Job===&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 1h -q threaded -n 4 -o ofile.%J --mpp=1G lsdyna_s i=airbag.deploy.k ncpu=4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using an explicit solver, one can specify a conservative initial memory setting on the command line as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export LSTC_MEMORY=auto&lt;br /&gt;
sqsub -r 1h -q threaded -n 4 -o ofile.%J --mpp=2G lsdyna_d i=airbag.deploy.k ncpu=4 memory=754414&amp;lt;/pre&amp;gt;&lt;br /&gt;
where memory is the minimum number of 8 byte words shared by all processors in double precision, or, 4 byte words in single precision.&lt;br /&gt;
&lt;br /&gt;
The initial value can be determined by starting a simulation interactively on the command line, and finding the output resembling: &amp;lt;i&amp;gt; Memory required to begin solution      :      754414&amp;lt;/i&amp;gt;.    The number of words can be specified as memory=260M instead of memory=260000000,  for further details see https://www.d3view.com/2006/10/a-few-words-on-memory-settings-in-ls-dyna/.  &lt;br /&gt;
&lt;br /&gt;
===8cpu MPI Job===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 1h -q mpi -o ofile.%J -n 8 --mpp=2G lsdyna_d i=airbag.deploy.k&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial memory can also be specified for mpi jobs  on the sqsub command line with &amp;quot;memory=&amp;quot; for the first master processor to decompose the problem  and &amp;quot;memory2=&amp;quot; used on all processors including the master to solves the decomposed problem, where the values are specified as 4 bytes per word in single precision and 8 bytes per word in double precision.   The number of words can be specified as memory=260M instead of memory=260000000 OR memory2=260M instead of memory2=260000000 for further details see https://www.d3view.com/2006/10/a-few-words-on-memory-settings-in-ls-dyna/.  The initial values can be found by running simulation interactively on a orca compute node and checking the output for a line such as: &amp;lt;i&amp;gt;Memory required to begin solution (memory=     464898  memory2=     158794 )&amp;lt;/i&amp;gt; which could then be implemented for a job run in the queue by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export LSTC_MEMORY=auto&lt;br /&gt;
sqsub -r 1h -q mpi -o ofile.%J -n 8 --mpp=2G lsdyna_d i=airbag.deploy.k memory=464898 memory2=158794&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The specification of memory2 on sharcnet or compute canada clusters is not beneficial since the queue reserves the same memory per core for all nodes, such that the decomposition master node process cannot be allocated to have larger system memory.  Therefore its sufficient to specify a single memory parameter by doing:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export LSTC_MEMORY=auto &lt;br /&gt;
sqsub -r 1h -q mpi -o ofile.%J -n 8 --mpp=2G lsdyna_d i=airbag.deploy.k memory=464898&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the LSTC_MEMORY variable will only allow the memory to grow for explicit simulations. The following slurm examples demonstrate how to prescribe the memory parameters exactly.&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
Copy the airbag example to your account:&lt;br /&gt;
&lt;br /&gt;
 rsync -av orca.computecanada.ca:/opt/sharcnet/lsdyna/r901.109912/examples r901.109912_examples&lt;br /&gt;
 cd r901.109912_examples/examples/misc/airbag&lt;br /&gt;
 gunzip airbag.deploy.k.gz&lt;br /&gt;
&lt;br /&gt;
==Graham (default modules)==&lt;br /&gt;
&lt;br /&gt;
Please note that graham does not have the sharcnet legacy modules installed on it.&lt;br /&gt;
&lt;br /&gt;
===Threaded Job ===&lt;br /&gt;
&lt;br /&gt;
Sample submission script &amp;lt;b&amp;gt;mysmpjob1.sh&amp;lt;/b&amp;gt; for 4 core single precision smp job using compute canada default cvmfs modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --nodes=1                           # use one node&lt;br /&gt;
#SBATCH --cpus-per-task=4                   # number threads&lt;br /&gt;
#SBATCH --mem=4000M                         # total memory&lt;br /&gt;
#SBATCH --time=00:30:00                     # hrs:min:sec&lt;br /&gt;
#SBATCH --job-name=testsmp1                 # %x = jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out&lt;br /&gt;
echo &amp;quot;SLURM_CPUS_PER_TASK= &amp;quot;$SLURM_CPUS_PER_TASK&lt;br /&gt;
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
# IMPORTANT:  to set license server do either:&lt;br /&gt;
# 1) export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# 2) create  ~/.licenses/ls-dyna.lic as shown above&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
module load ls-dyna/9.1&lt;br /&gt;
ls-dyna_s i=airbag.deploy.k ncpu=4 memory=1000M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 4000M / 4 (bytes/word) = 1000M words&lt;br /&gt;
&lt;br /&gt;
===Mpi Job ===&lt;br /&gt;
&lt;br /&gt;
Sample submission script &amp;lt;b&amp;gt;mympijob2.sh&amp;lt;/b&amp;gt; for 4 core double precision mpp job using compute canada default cvmfs modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --ntasks=4                     # number of ranks&lt;br /&gt;
#SBATCH --mem-per-cpu=4000M            # memory per rank&lt;br /&gt;
#SBATCH --time=00:30:00                # hrs:min:sec&lt;br /&gt;
#SBATCH --job-name=testmpi2            # %x = jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
# IMPORTANT:  to set license server do either:&lt;br /&gt;
# 1) export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# 2) create  ~/.licenses/ls-dyna.lic as shown above&lt;br /&gt;
# ----------------------------------------------------------&lt;br /&gt;
module load openmpi/1.8.8 ls-dyna-mpi/9.1&lt;br /&gt;
srun ls-dyna_d i=airbag.deploy.k memory=500M memory2=500M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 4000M / 8 (bytes/word) = 500M words&lt;br /&gt;
&lt;br /&gt;
==New Orca (legacy modules)==&lt;br /&gt;
&lt;br /&gt;
Please note, while new orca has most compute canada cvmfs modules available by default it does not have the graham the &amp;lt;i&amp;gt;ls-dyna&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;ls-dyna-mpi&amp;lt;/i&amp;gt; modules installed.  Therefore currently the only way to run lsdyna is by using the legacy sharcnet &amp;lt;i&amp;gt;lsdyna&amp;lt;/i&amp;gt; modules as shown in the following two smp and mpi examples. &lt;br /&gt;
&lt;br /&gt;
===Threaded Job ===&lt;br /&gt;
&lt;br /&gt;
Submission script &amp;lt;b&amp;gt;mysmpjob3.sh&amp;lt;/b&amp;gt; to run 16 core single precision single node smp job with sharcnet legacy modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --nodes=1                           # use one node&lt;br /&gt;
#SBATCH --cpus-per-task=16                  # number threads&lt;br /&gt;
#SBATCH --mem=4000M                         # total memory&lt;br /&gt;
#SBATCH --time=00:30:00                     # hrs:min:sec&lt;br /&gt;
#SBATCH --job-name=mysmpjob3-1node-16core    # jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out         # %x = jobname&lt;br /&gt;
echo &amp;quot;SLURM_CPUS_PER_TASK= &amp;quot;$SLURM_CPUS_PER_TASK&lt;br /&gt;
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
# ----------------------------------------------------------------&lt;br /&gt;
# IMPORTANT:  to set license server for legacy modules:&lt;br /&gt;
export LSTC_LICENSE_SERVER=31047@license3.sharcnet.ca&lt;br /&gt;
# since ~/.licenses/ls-dyna.lic does NOT work with legacy modules&lt;br /&gt;
# ----------------------------------------------------------------&lt;br /&gt;
module purge --force&lt;br /&gt;
export MODULEPATH=/opt/sharcnet/modules&lt;br /&gt;
module load lsdyna/smp/r712.95028&lt;br /&gt;
lsdyna_s i=airbag.deploy.k ncpu=$SLURM_CPUS_PER_TASK memory=500M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 4000M / 8 (bytes/word) = 500M words&lt;br /&gt;
&lt;br /&gt;
===MPI Job ===&lt;br /&gt;
&lt;br /&gt;
To run the sharcnet legacy &amp;lt;i&amp;gt;module lsdyna/mpp/r712.95028&amp;lt;/i&amp;gt; efficiently over several compute nodes with many cores requires using orca's xeon nodes as shown in &amp;lt;b&amp;gt; mympijob4.sh&amp;lt;/b&amp;gt; below.   To run lsdyna on orca's opteron nodes with &amp;lt;i&amp;gt;module lsdyna/mpp/r712.95028&amp;lt;/i&amp;gt; requires using only &amp;lt;b&amp;gt;one&amp;lt;/b&amp;gt; opteron node as shown in &amp;lt;b&amp;gt; mympijob5.sh&amp;lt;/b&amp;gt; below.  The other legacy sharcnet lsdyna mpp modules, as shown in the Availability Table  lsdyna/mpp/ls971.r85718, lsdyna/mpp/ls980B1.011113, lsdyna/mpp/r611.79036, lsdyna/mpp/r611.80542, lsdyna/mpp/r711.88920, lsdyna/mpp/r800.95359 and lsdyna/mpp/r901.109912 have yet to be tested. If you want to use one but cannot get it working please open a ticket.  Note that lines containing a space between &amp;quot;# and SBATCH&amp;quot; are comments.  To activate such line(s) required removal of the space ie) &amp;quot;#SBATCH&amp;quot;.  Its recommended to use &amp;lt;i&amp;gt;module ls-dyna-mpi&amp;lt;/i&amp;gt; on graham instead since the machine is far newer, faster and reliable. &lt;br /&gt;
&lt;br /&gt;
====Multi Node Slurm Script====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~/samples/lsdyna/airbag] cat mympijob4.sh&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --constraint=xeon&lt;br /&gt;
#SBATCH --ntasks=48&lt;br /&gt;
#SBATCH --mem-per-cpu=4000M&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --job-name=mympijob4-Xnodes-48cores-xeon  # jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out             # %x = jobname&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
# To set license server when using legacy sharcnet modules:&lt;br /&gt;
export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# since ~/.licenses/ls-dyna.lic does not work with legacy modules.&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
module purge --force&lt;br /&gt;
export MODULEPATH=/opt/sharcnet/modules&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.5 lsdyna/mpp/r712.95028&lt;br /&gt;
MACHINEFILE=`srun hostname -s | tr '\n' ':' | sed 's/:/,/g' | sed 's/.$//'`&lt;br /&gt;
mpirun --host $MACHINEFILE --mca plm_slurm_args '--cpu_bind=none' lsdyna_s i=airbag.deploy.k memory=250M memory2=250M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Single Node Slurm Script====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~/samples/lsdyna/airbag] cat mympijob5.sh&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --account=def-roberpj-ab&lt;br /&gt;
#SBATCH --constraint=opteron&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
# SBATCH --ntasks=24&lt;br /&gt;
# SBATCH --mem=0&lt;br /&gt;
#SBATCH --ntasks=16&lt;br /&gt;
#SBATCH --mem-per-cpu=1000M&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --job-name=mympijob5-1node-16cores-opteron  # jobname&lt;br /&gt;
#SBATCH --output=slurm-%x-%N-%j.out         # %x = jobname&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
# To set license server when using legacy sharcnet modules:&lt;br /&gt;
export LSTC_LICENSE_SERVER=port@some.license.server&lt;br /&gt;
# since ~/.licenses/ls-dyna.lic does not work with legacy modules.&lt;br /&gt;
# -------------------------------------------------------------&lt;br /&gt;
module purge --force&lt;br /&gt;
export MODULEPATH=/opt/sharcnet/modules&lt;br /&gt;
module load intel/12.1.3 openmpi/intel/1.6.5 lsdyna/mpp/r712.95028&lt;br /&gt;
MACHINEFILE=`srun hostname -s | tr '\n' ':' | sed 's/:/,/g' | sed 's/.$//'`&lt;br /&gt;
mpirun --host $MACHINEFILE lsdyna_s i=airbag.deploy.k memory=250M memory2=250M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where memory = 1000M / 4 (bytes/word) = 250M words&lt;br /&gt;
&lt;br /&gt;
==Legacy Clusters==&lt;br /&gt;
&lt;br /&gt;
STEP1) The following shows sqsub submission of the [http://www.dynaexamples.com/examples-manual/misc/airbag airbag] example to the mpi queue.  Its recommended to first edit  &amp;lt;i&amp;gt;airbag.deploy.k&amp;lt;/i&amp;gt;  and change &amp;lt;i&amp;gt;endtim&amp;lt;/i&amp;gt; to 3.000E-00 so the job runs long enough to perform the restart in steps 2 and 3 below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /opt/sharcnet/lsdyna/r611.79036/examples /scratch/$USER/test-lsdyna&lt;br /&gt;
cd /scratch/$USER/test-lsdyna/misc/airbag&lt;br /&gt;
gunzip airbag.deploy.k.gz&lt;br /&gt;
cp airbag.deploy.k airbag.deploy.restart.k&lt;br /&gt;
nano deploy.restart.k (reduce plot file creation frequency)&lt;br /&gt;
   *DATABASE_BINARY_D3PLOT&lt;br /&gt;
   $       dt      lcdtdeploy.restart.k&lt;br /&gt;
   1.000E-01   &amp;lt;--- change from 5.000E-04 &lt;br /&gt;
export LSTC_LICENSE_SERVER=#####@license#.uwo.sharcnet&lt;br /&gt;
module unload intel openmpi lsdyna&lt;br /&gt;
module load intel/11.1.069 openmpi/intel/1.6.4 lsdyna/mpp/r611.79036&lt;br /&gt;
sqsub -r 10m -q mpi --mpp=2G -n 8 -o ofile.%J lsdyna_d i=airbag.deploy.k&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
STEP2) With the job still running, use the echo command as follows to create a file called &amp;quot;D3KIL&amp;quot; that will trigger generation of restart files at which point the file D3KIL itself will be erased.  Do this once a day if data loss is critical to you OR once or twice just before the  &amp;lt;i&amp;gt;sqsub -r&amp;lt;/i&amp;gt; time limit is reached.  Further information can be found here http://www.dynasupport.com/tutorial/ls-dyna-users-guide/sense-switch-control:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;sw3&amp;quot; &amp;gt; D3KIL&lt;br /&gt;
sqkill job#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
STEP3) Before the job can be restarted, the following two lines must be added to the &amp;lt;i&amp;gt;airbag.deploy.restart.k&amp;lt;/i&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*CHANGE_CURVE_DEFINITION&lt;br /&gt;
         1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
STEP4) Now resubmit the job as follows using &amp;quot;r=&amp;quot; to specify the restart file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 1h -q mpi --mpp=2G -n 8 -o ofile.%J lsdyna_d i=airbag.deploy.restart.k r=d3dump01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General Notes=&lt;br /&gt;
&lt;br /&gt;
==Graham Cluster==&lt;br /&gt;
&lt;br /&gt;
There are no special notes at the present time in regards to using lsdyna on graham.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Command Line Use==&lt;br /&gt;
&lt;br /&gt;
Following the upgrade of orca to the compute canada module stack, the orca development nodes were discontinued.&amp;lt;br&amp;gt;&lt;br /&gt;
Therefore this section is no longer relevent and remain for historical purposes only.&lt;br /&gt;
&lt;br /&gt;
Parallel lsdyna jobs can be run interactively on the command line (outside the queue) for short run testing purposes as follows:&lt;br /&gt;
&lt;br /&gt;
o Orca Development Node MPP (mpi) Example&lt;br /&gt;
&lt;br /&gt;
 ssh orca.sharcnet.ca  &lt;br /&gt;
 ssh orc-dev1  (or dev2,3,4)&lt;br /&gt;
 module unload intel openmpi lsdyna&lt;br /&gt;
 module load intel/12.1.3 openmpi/intel/1.6.2 lsdyna/mpp/r711.88920&lt;br /&gt;
 mpirun -np 8 lsdyna_d i=airbag.deploy.k&lt;br /&gt;
&lt;br /&gt;
o Orca Development Node SMP (threaded) Example&lt;br /&gt;
&lt;br /&gt;
 ssh orca.sharcnet.ca  &lt;br /&gt;
 ssh orc-dev1  (or dev2,3,4)&lt;br /&gt;
 module unload intel openmpi lsdyna&lt;br /&gt;
 module load lsdyna/smp/r711.88920&lt;br /&gt;
 lsdyna_d i=airbag.deploy.k ncpu=8&lt;br /&gt;
&lt;br /&gt;
==Memory Issues==&lt;br /&gt;
&lt;br /&gt;
A minumum of mpp=2G is recommended although the memory requirement of a job may suggest much less is required. For instance setting mpp=1G for the airbag test job above will result in the following error when running a job in the queue:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
An attempt to set processor affinity has failed - please check to&lt;br /&gt;
ensure that your system supports such functionality. If so, then&lt;br /&gt;
this is probably something that should be reported to the OMPI developers.&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another error message which can occur after a job runs for a while if mpp is chosen to small is: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Process 45 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Signal 11 : Segmentation Violation &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get an idea of the amount of memory a job used run grep on the output file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~/samples/lsdyna/airbag]  cat  ofile.2063302.orc-admin2.orca.sharcnet | grep Memory&lt;br /&gt;
     |    Distributed Memory Parallel                  |&lt;br /&gt;
 Memory size from command line:      500000,       500000&lt;br /&gt;
 Memory for the head node&lt;br /&gt;
 Memory installed (MB)        :        32237&lt;br /&gt;
 Memory free (MB)             :        11259&lt;br /&gt;
 Memory required (MB)         :            0&lt;br /&gt;
 Memory required to process keyword     :       458120&lt;br /&gt;
 Memory required for decomposition      :       458120&lt;br /&gt;
 Memory required to begin solution (memory=      458120 memory2=      230721)&lt;br /&gt;
 Max. Memory reqd for implicit sol: max used               0&lt;br /&gt;
 Max. Memory reqd for implicit sol: incore                 0&lt;br /&gt;
 Max. Memory reqd for implicit sol: oocore                 0&lt;br /&gt;
 Memory required to complete solution (memory=      458120 memory2=      230721)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Version and Revision==&lt;br /&gt;
&lt;br /&gt;
Again run grep on the output file to extract the major and minor revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~/samples/lsdyna/airbag]  cat  ofile.2063302.orc-admin2.orca.sharcnet | grep 'Revision\|Version'&lt;br /&gt;
     |  Version : mpp s R6.1.1    Date: 01/02/2013     |&lt;br /&gt;
     |  Revision: 78769           Time: 07:43:30       |&lt;br /&gt;
     |  SVN Version: 80542                             |&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Check License Status==&lt;br /&gt;
&lt;br /&gt;
===Running and Queued Programs===&lt;br /&gt;
&lt;br /&gt;
To get a summary of running and/or queued jobs use the &amp;lt;i&amp;gt;lstc_qrun&amp;lt;/i&amp;gt; command as follows, where queued means the job has started running according to the sqsub command but its actually sitting waiting for license resources to come available.  Once these are acquired the job will start running on the cluster and appear as a Running Program according to  lstc_qrun ie)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[roberpj@hnd19:~] export LSTC_LICENSE_SERVER=#####@license#.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd19:~] lstc_qrun&lt;br /&gt;
Defaulting to server 1 specified by LSTC_LICENSE_SERVER variable&lt;br /&gt;
                     Running Programs&lt;br /&gt;
    User             Host          Program              Started       # procs&lt;br /&gt;
-----------------------------------------------------------------------------&lt;br /&gt;
dgierczy    20277@saw61.saw.sharcn LS-DYNA_971      Mon Apr  8 17:44     1&lt;br /&gt;
dgierczy     8570@saw32.saw.sharcn LS-DYNA_971      Mon Apr  8 17:44     1&lt;br /&gt;
dscronin    25486@hnd6             MPPDYNA_971      Tue Apr  9 20:19     6&lt;br /&gt;
dscronin    14897@hnd18            MPPDYNA_971      Tue Apr  9 21:48     6&lt;br /&gt;
dscronin    14971@hnd18            MPPDYNA_971      Tue Apr  9 21:48     6&lt;br /&gt;
dscronin    15046@hnd18            MPPDYNA_971      Tue Apr  9 21:48     6&lt;br /&gt;
dscronin    31237@hnd16            MPPDYNA_971      Tue Apr  9 21:53     6&lt;br /&gt;
dscronin    31313@hnd16            MPPDYNA_971      Tue Apr  9 21:54     6&lt;br /&gt;
dscronin     6396@hnd15            MPPDYNA_971      Tue Apr  9 21:54     6&lt;br /&gt;
csharson    28890@saw175.saw.sharc MPPDYNA_971      Wed Apr 10 16:48     6&lt;br /&gt;
No programs queued&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To show license file expiration details, append &amp;quot;-R&amp;quot; to the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[roberpj@hnd19:~] export LSTC_LICENSE_SERVER=#####@license#.uwo.sharcnet&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd19:~] lstc_qrun -R&lt;br /&gt;
Defaulting to server 1 specified by LSTC_LICENSE_SERVER variable&lt;br /&gt;
**** LICENSE INFORMATION ****&lt;br /&gt;
PROGRAM          EXPIRATION CPUS  USED   FREE    MAX | QUEUE&lt;br /&gt;
---------------- ----------      ----- ------ ------ | -----&lt;br /&gt;
LS-DYNA_971      12/31/2013          -    966   1024 |     0&lt;br /&gt;
 dgierczy   20277@saw61.saw.sharcnet   1&lt;br /&gt;
 dgierczy    8570@saw32.saw.sharcnet   1&lt;br /&gt;
MPPDYNA_971      12/31/2013          -    966   1024 |     0&lt;br /&gt;
 dscronin   25486@hnd6               6&lt;br /&gt;
 dscronin   14897@hnd18              6&lt;br /&gt;
 dscronin   14971@hnd18              6&lt;br /&gt;
 dscronin   15046@hnd18              6&lt;br /&gt;
 dscronin   31237@hnd16              6&lt;br /&gt;
 dscronin   31313@hnd16              6&lt;br /&gt;
 dscronin    6396@hnd15              6&lt;br /&gt;
 csharson   28890@saw175.saw.sharcnet   6&lt;br /&gt;
                   LICENSE GROUP    58    966   1024 |     0&lt;br /&gt;
&lt;br /&gt;
PROGRAM          EXPIRATION CPUS  USED   FREE    MAX | QUEUE&lt;br /&gt;
---------------- ----------      ----- ------ ------ | -----&lt;br /&gt;
LS-OPT           12/31/2013          0   1024   1024 |     0&lt;br /&gt;
                   LICENSE GROUP     0   1024   1024 |     0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Killling A Program===&lt;br /&gt;
&lt;br /&gt;
The queue normally kills lsdyna jobs cleanly.  However its possible that licences for a job (which is no longer running in the queue and therefore no longer has any processes running on the cluster) will continue to be tied up according to the lstc_qrun command.   To kill such a program determine the pid@hostname from the lstc_qrun command then run the following kill command.  The following example demonstrates the procedure for username roberpj:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~]  lstc_qrun -R | grep roberpj&lt;br /&gt;
roberpj    45312@orc329.orca.shar MPPDYNA          Wed Dec  5 15:50    12&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login2:~] lstc_qkill 45312@orc329.orca.sharcnet.ca&lt;br /&gt;
Defaulting to server 1 specified by LSTC_LICENSE_SERVER variable&lt;br /&gt;
Program queued for termination&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login2:~]  lstc_qrun -R | grep roberpj&lt;br /&gt;
[roberpj@orc-login2:~] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Legacy Instructions==&lt;br /&gt;
&lt;br /&gt;
The following binaries remain available on saw and orca for backward compatibility testing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login2:~] cd /opt/sharcnet/local/lsdyna&lt;br /&gt;
[roberpj@orc129:/opt/sharcnet/local/lsdyna] ls ls971*&lt;br /&gt;
ls971_d_R3_1    ls971_d_R4_2_1  ls971_s_R3_1    ls971_s_R4_2_1  ls971_s_R5_1_1&lt;br /&gt;
ls971_d_R4_2_0  ls971_d_R5_0    ls971_s_R4_2_0  ls971_s_R5_0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are currently no sharcnet modules for these versions, hence jobs should be submitted as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load lsdyna&lt;br /&gt;
export PATH=/opt/sharcnet/local/lsdyna:$PATH&lt;br /&gt;
export LSTC_LICENSE_SERVER=XXXXX@license3.uwo.sharcnet&lt;br /&gt;
cp /opt/sharcnet/local/lsdyna/examples/airbag.deploy.k airbag.deploy.k&lt;br /&gt;
SERIAL JOB:  sqsub -q serial -r 1d -o ofile.%J ls971_d_R4_2_1 i=airbag.deploy.k&lt;br /&gt;
THREADED JOB:  sqsub -q threaded -n 4 -r 1d -o ofile.%J ls971_d_R4_2_1 ncpu=4 para=2 i=airbag.deploy.k&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note! the &amp;lt;i&amp;gt;ls971_s_R3_1&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;ls971_d_R3_1&amp;lt;/i&amp;gt; binaries do not work, a fix is being looked for.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o LSTC LS-DYNA Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.lstc.com/products/ls-dyna&lt;br /&gt;
&lt;br /&gt;
o LSTC LS-DYNA Support (Tutorials, HowTos, Faq, Manuals, Release Notes, News, Links)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.dynasupport.com/&lt;br /&gt;
&lt;br /&gt;
o LS-DYNA Release Notes&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.dynasupport.com/release-notes&lt;br /&gt;
&lt;br /&gt;
o LS-PrePost Online Documentation FAQ&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.lstc.com/lspp/content/faq.shtml&lt;br /&gt;
&lt;br /&gt;
o LSTC Download/Install Overview Page&amp;lt;br&amp;gt;&lt;br /&gt;
Provides links to binaries for LS-DYNA SMP/MPP, LS-OPT, LS-PREPOST, LS-TASC.&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.lstc.com/download&lt;br /&gt;
&lt;br /&gt;
==Memory Links==&lt;br /&gt;
&lt;br /&gt;
o Implicit: Memory notes&amp;lt;br&amp;gt; &lt;br /&gt;
http://www.dynasupport.com/howtos/implicit/implicit-memory-notes&lt;br /&gt;
&lt;br /&gt;
o LS-DYNA Support Environment variables&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.dynasupport.com/howtos/general/environment-variables&lt;br /&gt;
&lt;br /&gt;
o LS-DYNA and d3VIEW Blog (a few words on memory settings)&amp;lt;br&amp;gt;&lt;br /&gt;
http://blog2.d3view.com/a-few-words-on-memory-settings-in-ls-dyna/&lt;br /&gt;
&lt;br /&gt;
o Convert Words to GB ie) memory=500MW (3.73GB)&amp;lt;br&amp;gt;&lt;br /&gt;
http://deviceanalytics.com/memcalc.php&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=GEANT4&amp;diff=17943</id>
		<title>GEANT4</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=GEANT4&amp;diff=17943"/>
				<updated>2019-06-06T14:11:46Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCMissing}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=GEANT4&lt;br /&gt;
|package_description=Suite of programs for the simulation of the passage of particles through matter&lt;br /&gt;
|package_idnumber=59&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Geant4 is a toolkit for the simulation of the passage of particles through matter. Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science. &lt;br /&gt;
&lt;br /&gt;
=Usage on graham and cedar=&lt;br /&gt;
&lt;br /&gt;
Geant4 is installed as a module on cedar and graham.&lt;br /&gt;
&lt;br /&gt;
To see which versions are available, execute:&lt;br /&gt;
&lt;br /&gt;
 module avail geant4&lt;br /&gt;
&lt;br /&gt;
To then use a particular version, execute for example:&lt;br /&gt;
&lt;br /&gt;
 module load geant4/10.02.p03&lt;br /&gt;
&lt;br /&gt;
After you load the module, you can see where the software is installed by executing:&lt;br /&gt;
&lt;br /&gt;
 echo $EBROOTGEANT4&lt;br /&gt;
&lt;br /&gt;
To see the useful examples included with the version we have loaded, execute:&lt;br /&gt;
&lt;br /&gt;
 ls $EBROOTGEANT4/share/Geant4-10.2.3/examples&lt;br /&gt;
&lt;br /&gt;
Consider the AnaEx01 example as follows:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ~/samples/geant4/test-100202&lt;br /&gt;
 cd ~/samples/geant4/test-100202&lt;br /&gt;
 module load geant4/10.02.p03&lt;br /&gt;
 cp -r $EBROOTGEANT4/share/Geant4-10.2.3/examples/extended/analysis/AnaEx01 .&lt;br /&gt;
 source $EBROOTGEANT4/share/Geant4-10.2.3/geant4make/geant4make.sh&lt;br /&gt;
 cd AnaEx01&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
This creates the executable ''AnaEx01'' in the current (build) folder. You can run it by:&lt;br /&gt;
&lt;br /&gt;
 ./AnaEx01&lt;br /&gt;
&lt;br /&gt;
You run this executable and enter &amp;quot;help&amp;quot; for the available actions.&lt;br /&gt;
&lt;br /&gt;
Once the binary runs interactively as desired you can submit it as a job. (see [https://docs.computecanada.ca/wiki/Running_jobs Running jobs] page).&lt;br /&gt;
&lt;br /&gt;
=Usage on older SHARCNET systems=&lt;br /&gt;
&lt;br /&gt;
SHARCNET provides a build of geant4 on sharcnet CentOS clusters .&lt;br /&gt;
&lt;br /&gt;
Geant4 comes with many examples useful for testing purposes:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@vdi-centos6:/opt/sharcnet/geant4/10.02.02/share/Geant4-10.2.2/examples/extended/analysis] ls &lt;br /&gt;
 AnaEx01  AnaEx02  AnaEx03  B1Con  CMakeLists.txt  History  README  shared&lt;br /&gt;
&lt;br /&gt;
==Interactive==&lt;br /&gt;
&lt;br /&gt;
Consider the AnaEx01 example as follows:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ~/samples/geant4/test-100202&lt;br /&gt;
 cd ~/samples/geant4/test-100202&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load ldwrapper gcc/4.9.3 geant4/10.02.02&lt;br /&gt;
 cp -r /opt/sharcnet/geant4/10.02.02/share/Geant4-10.2.2/examples/extended/analysis/AnaEx01 .&lt;br /&gt;
 source geant4make.sh&lt;br /&gt;
 cd AnaEx01&lt;br /&gt;
 gmake clean_setup&lt;br /&gt;
 gmake setup&lt;br /&gt;
 gmake&lt;br /&gt;
&lt;br /&gt;
where ...&lt;br /&gt;
 [roberpj@vdi-centos6:~/samples/geant4/test-100202/AnaEx01] which AnaEx01 &lt;br /&gt;
 ~/geant4_workdir/bin/Linux-g++/AnaEx01&lt;br /&gt;
&lt;br /&gt;
To run the binary do:&lt;br /&gt;
&lt;br /&gt;
 [roberpj@vdi-centos6:~/samples/geant4/test-100202/AnaEx01] AnaEx01&lt;br /&gt;
 Idle&amp;gt; help&lt;br /&gt;
 Command directory path : /&lt;br /&gt;
 Sub-directories : &lt;br /&gt;
 1) /control/   UI control commands.&lt;br /&gt;
 2) /units/   Available units.&lt;br /&gt;
 3) /process/   Process Table control commands.&lt;br /&gt;
 4) /analysis/   ...Title not available...&lt;br /&gt;
 5) /particle/   Particle control commands.&lt;br /&gt;
 6) /geometry/   Geometry control commands.&lt;br /&gt;
 7) /tracking/   TrackingManager and SteppingManager control commands.&lt;br /&gt;
 8) /event/   EventManager control commands.&lt;br /&gt;
 9) /cuts/   Commands for G4VUserPhysicsList.&lt;br /&gt;
 10) /run/   Run control commands.&lt;br /&gt;
 11) /random/   Random number status control commands.&lt;br /&gt;
 12) /material/   Commands for materials&lt;br /&gt;
 13) /N03/   UI commands of this example&lt;br /&gt;
 14) /physics_lists/   commands related to the physics simulation engine.&lt;br /&gt;
 15) /gun/   Particle Gun control commands.&lt;br /&gt;
 16) /heptst/   Controls for the hadronic energy/momentum test&lt;br /&gt;
 17) /physics_engine/   ...Title not available...&lt;br /&gt;
 18) /vis/   Visualization commands.&lt;br /&gt;
 Commands : &lt;br /&gt;
 Type the number ( 0:end, -n:n level back ) :&lt;br /&gt;
&lt;br /&gt;
==Cluster==&lt;br /&gt;
&lt;br /&gt;
Once the binary runs interactively as desired submit it to the serial queue:&lt;br /&gt;
&lt;br /&gt;
 sqsub -q serial -r 5m -o file.%J ~/geant4_workdir/bin/Linux-g++/AnaEx01&lt;br /&gt;
&lt;br /&gt;
==Graphical==&lt;br /&gt;
&lt;br /&gt;
None at this time.&lt;br /&gt;
&lt;br /&gt;
=Notes=&lt;br /&gt;
&lt;br /&gt;
None at this time.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Geant4 Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://geant4.web.cern.ch/geant4/&lt;br /&gt;
&lt;br /&gt;
o Online User Documentation&amp;lt;br&amp;gt;&lt;br /&gt;
http://geant4.web.cern.ch/geant4/support/userdocuments.shtml&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--checked2015--&amp;gt;&lt;br /&gt;
&amp;lt;!--checked by looking at the directory /opt/sharcnet/geant4 it's still 9.6.1 (on orca)--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=BOOST&amp;diff=17936</id>
		<title>BOOST</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=BOOST&amp;diff=17936"/>
				<updated>2019-06-06T14:05:42Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:CCMissing}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=BOOST&lt;br /&gt;
|package_description=free peer-reviewed portable C++ source libraries&lt;br /&gt;
|package_idnumber=137&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Template:GrahamUpdate}}&lt;br /&gt;
&lt;br /&gt;
== Which Versions of Boost are Available? ==&lt;br /&gt;
&lt;br /&gt;
SHARCNET has a number of Boost versions available as special modules. The available versions can be viewed by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module avail boost&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and/or by viewing the [https://www.sharcnet.ca/my/software/show/137 BOOST software page in the web portal].&lt;br /&gt;
&lt;br /&gt;
When you look up the available boost modules you will see output similar tossh-:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail boost&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------ /opt/sharcnet/modules -------------------------------------------------&lt;br /&gt;
boost/gcc482-openmpi183/1.53.0         boost/gcc510-openmpi187/1.59.0         boost/intel1503-openmpi187/1.59.0&lt;br /&gt;
boost/gcc482-openmpi183/1.55.0         boost/gcc510-openmpi187debug/1.59.0    boost/intel1503-openmpi187debug/1.59.0&lt;br /&gt;
boost/gcc492-openmpi187/1.59.0         boost/intel12-openmpi162/1.53.0&lt;br /&gt;
boost/gcc492-openmpi187debug/1.59.0    boost/intel12-openmpi162/1.55.0&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
i.e., the following versions of Boost are available:&lt;br /&gt;
# versions 1.53 and 1.55 built with GCC v4.8.2 and OpenMPI v1.8.3&lt;br /&gt;
#* i.e., boost/gcc482-openmpi183/1.53.0 and boost/gcc482-openmpi183/1.55.0&lt;br /&gt;
# version 1.59 built with GCC v4.9.2 and non-debug and debug versions of OpenMPI v1.8.7&lt;br /&gt;
#* i.e.,, boost/gcc492-openmpi187/1.59.0  and boost/gcc492-openmpi187debug/1.59.0&lt;br /&gt;
# version 1.59 built with GCC v5.1.0 and non-debug and debug versions of OpenMPI v1.8.7&lt;br /&gt;
#* i.e., boost/gcc510-openmpi187/1.59.0 and boost/gcc510-openmpi187debug/1.59.0&lt;br /&gt;
# versions 1.53 and 1.55 built with Intel v12 and OpenMPI v1.6.2&lt;br /&gt;
#* i.e., boost/intel12-openmpi162/1.53.0 and boost/intel12-openmpi162/1.55.0&lt;br /&gt;
# version 1.59 built with Intel v15.0.3 and non-debug and debug versions of OpenMPI v1.8.7&lt;br /&gt;
#* i.e., boost/intel1503-openmpi187/1.59.0 and boost/intel1503-openmpi187debug/1.59.0&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may experience problems compiling Boost codes with the Intel v12 compiler (e.g., some incompatible headers). If you do, try the GCC compiler to see if that works.&lt;br /&gt;
&lt;br /&gt;
All of the aforementioned versions of Boost have been built with the operating system's installed Python. You can see which version of Python it will use by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -qi python&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you need a specific version of Boost compiled for a specific C++ compiler, version of OpenMPI, and/or a specific version of Python, then submit a ticket requesting such. Be sure to mention all required software packages and which versions are needed.&lt;br /&gt;
&lt;br /&gt;
=== Loading a module ===&lt;br /&gt;
&lt;br /&gt;
To load a specific module of Boost simply use &amp;quot;module load&amp;quot; followed by the module name, e.g.,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module load boost/intel1503-openmpi187debug/1.59.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If an error occurs, ensure that you load all pre-requisite modules first. Often it is easier to remove all modules, load the required ldwrapper module (which is needed for your programs to work when submitted using sqsub), and the the modules you need to use, e.g.,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ module purge&lt;br /&gt;
$ module load ldwrapper&lt;br /&gt;
$ module load gcc/5.1.0&lt;br /&gt;
$ module load openmpi/gcc-5.1.0/std/1.8.7&lt;br /&gt;
$ module load boost/gcc510-openmpi187/1.59.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compiling Programs Using CMake With Boost ==&lt;br /&gt;
&lt;br /&gt;
With CMake you will want code similar to the following to properly load Boost:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;find_package(&lt;br /&gt;
    Boost 1.56.0 REQUIRED&lt;br /&gt;
    COMPONENTS&lt;br /&gt;
        filesystem&lt;br /&gt;
        system&lt;br /&gt;
)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
# 1.56.0 is the MINIMUM version that can be used by your program. You should replace this with the version you are using, e.g., 1.59.0. (Know that omitting the minimum version setting can cause issues with CMake not finding Boost.)&lt;br /&gt;
# REQUIRED means that if the minimum version is not about to be used, an error will occur and compilation will be aborted. Generally it is a good idea to use REQUIRED to avoid cryptic compilation error messages when an incompatible version of Boost is used.&lt;br /&gt;
# If you use any Boost components that have library code that must be linked into your program, you will need to specify COMPONENTS followed by the names of those components. &lt;br /&gt;
&lt;br /&gt;
If CMake finds the wrong version of boost. Try telling CMake to not use the built in boost system path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set(Boost_NO_SYSTEM_PATHS ON)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will cause CMake to look at the BOOST_ROOT environment variable, instead of the default locations.&lt;br /&gt;
&lt;br /&gt;
You can view the names of all required-to-be-linked-to-a-library components for the version of Boost you are using by running the following command (after using &amp;quot;module load&amp;quot; to load the version of Boost you want to use):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ls -1 $BOOST_ROOT/lib/libboost*{so,a}* | xargs -n 1 basename | sed -e 's/^libboost_//' -e 's/\.so.*$//' -e 's/\.a.*$//' | sort -u&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will output something similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ls -1 $BOOST_ROOT/lib/libboost*{so,a}* | xargs -n 1 basename | sed -e 's/^libboost_//' -e 's/\.so.*$//' -e 's/\.a.*$//' | sort -u&lt;br /&gt;
atomic&lt;br /&gt;
chrono&lt;br /&gt;
context&lt;br /&gt;
coroutine&lt;br /&gt;
date_time&lt;br /&gt;
exception&lt;br /&gt;
filesystem&lt;br /&gt;
graph&lt;br /&gt;
graph_parallel&lt;br /&gt;
iostreams&lt;br /&gt;
locale&lt;br /&gt;
log&lt;br /&gt;
log_setup&lt;br /&gt;
math_c99&lt;br /&gt;
math_c99f&lt;br /&gt;
math_c99l&lt;br /&gt;
math_tr1&lt;br /&gt;
math_tr1f&lt;br /&gt;
math_tr1l&lt;br /&gt;
mpi&lt;br /&gt;
prg_exec_monitor&lt;br /&gt;
program_options&lt;br /&gt;
python&lt;br /&gt;
random&lt;br /&gt;
regex&lt;br /&gt;
serialization&lt;br /&gt;
signals&lt;br /&gt;
system&lt;br /&gt;
test_exec_monitor&lt;br /&gt;
thread&lt;br /&gt;
timer&lt;br /&gt;
unit_test_framework&lt;br /&gt;
wave&lt;br /&gt;
wserialization&lt;br /&gt;
$&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the library components depend on other components. For example, the &amp;quot;filesystem&amp;quot; component depends on the &amp;quot;system&amp;quot; component --so both of these must be specified in the find_package() CMake function call.&lt;br /&gt;
&lt;br /&gt;
You also will need lines similar to the follwing in your CMakeLists.txt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;add_executable(&lt;br /&gt;
    program.exe&lt;br /&gt;
    src/somecode.cxx&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
target_link_libraries(&lt;br /&gt;
    program.exe&lt;br /&gt;
    ${Boost_LIBRARIES}&lt;br /&gt;
)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
# program.exe is the executable being produced.&lt;br /&gt;
# ${Boost_LIBRARIES} is set by the find_package() function and contains all of the libraries it discovered (for the listed COMPONENTS section above).&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' With the target_link_libraries() set, you do not need or want to set LD_LIBRARY_PATH at all for Boost to work, i.e., if you are loading the SHARCNET module, everything is properly set. (With CMake you must tell it which libraries must be linked in to your executable --it is not automatic.)&lt;br /&gt;
&lt;br /&gt;
== Using a Specific Version of Boost ==&lt;br /&gt;
&lt;br /&gt;
To use a specific version of Boost, do the following:&lt;br /&gt;
* Unload any loaded OpenMPI modules that will conflict.&lt;br /&gt;
* Unload any loaded C++ compiler modules that will conflict.&lt;br /&gt;
* Load any required C++ and OpenMPI modules.&lt;br /&gt;
* Load the required version of Boost.&lt;br /&gt;
e.g.,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module list                                 # View which modules are currently loaded&lt;br /&gt;
$ module unload openmpi/intel/1.6.2           # Unload the OpenMPI (for Intel)&lt;br /&gt;
$ module unload intel/12.1.3                  # Unload the Intel C++ compiler&lt;br /&gt;
$ module load gcc/4.8.2                       # Load GCC v4.8.2&lt;br /&gt;
$ module load openmpi/gcc/1.8.3               # Load OpenMPI (for GCC)&lt;br /&gt;
$ module load boost/gcc482-openmpi183/1.57.0  # Load Boost v1.57 for GCC 4.8.2 and OpenMPI v1.8.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once this is done, you may use Boost (e.g., write #include &amp;lt;boost/filesystem.hpp&amp;gt; in your code, etc.). No special compiler options will be required.&lt;br /&gt;
&lt;br /&gt;
If you want to start with NO modules loaded, then you can do the same by purging first, loading ldwrapper, followed by what you need, e.g.,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module purge&lt;br /&gt;
$ module load ldwrapper&lt;br /&gt;
$ module load gcc/4.8.2                       # Load GCC v4.8.2&lt;br /&gt;
$ module load openmpi/gcc/1.8.3               # Load OpenMPI (for GCC)&lt;br /&gt;
$ module load boost/gcc482-openmpi183/1.57.0  # Load Boost v1.57 for GCC 4.8.2 and OpenMPI v1.8.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== If Special Compiler Options are Required ==&lt;br /&gt;
&lt;br /&gt;
If you are not having success building your code using Boost (e.g., in a Makefile), you might need to manually specify the INCLUDE and LIB directories. You can get these paths by running the following command (replacing the full Boost module name with the one you've loaded), e.g.,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module show boost/gcc482-openmpi183/1.57.0&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
/opt/sharcnet/modules/boost/gcc482-openmpi183/1.57.0:&lt;br /&gt;
&lt;br /&gt;
module-whatis    Provides boost 1.57.0 (flavor gcc482-openmpi183) built using gcc/4.8.2, openmpi/gcc/1.8.3 on centos64.&lt;br /&gt;
conflict         intel&lt;br /&gt;
conflict         pgi&lt;br /&gt;
conflict         python&lt;br /&gt;
prereq   gcc/4.8.2&lt;br /&gt;
prereq   openmpi/gcc/1.8.3&lt;br /&gt;
prepend-path     --delim   CPPFLAGS -I/opt/sharcnet/boost/1.57.0/gcc482-openmpi183/include&lt;br /&gt;
prepend-path     --delim   LDFLAGS -L/opt/sharcnet/boost/1.57.0/gcc482-openmpi183/lib&lt;br /&gt;
prepend-path     LD_RUN_PATH /opt/sharcnet/boost/1.57.0/gcc482-openmpi183/lib&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
i.e., for Boost 1.57.0 (flavour gcc482-openmpi183) you could explicitly invoke the compiler with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ $CPPFLAGS $CXXFLAGS $LDFLAGS yoursourcecode.cxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also be aware that you must specify any Boost-required libraries for linking purposes using the -l option. You can see the actual available library names for any given Boost installation by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ for a in `ls $BLIBS` ; do basename $a ; done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where $BLIBS is the directory you see with LDFLAGS in the module show output, thus, to see all libraries available with the gcc482-openmpi183/lib module, you would write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ for a in `ls /opt/sharcnet/boost/1.57.0/gcc482-openmpi183/lib/libboost_*` ; do basename $a ; done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Using the -l option is important when using any non-header-only Boost library, e.g., MPI, serialization, program_options, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building an Example Boost Program ==&lt;br /&gt;
&lt;br /&gt;
First create/write/copy your program somewhere suitable (this example is from the Boost.MPI documentation):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd&lt;br /&gt;
$ mkdir boost-test&lt;br /&gt;
$ cat &amp;gt;boost-mpi-eg.cxx&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/mpi.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/serialization/string.hpp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
namespace mpi = boost::mpi;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
  mpi::environment env(argc, argv);&lt;br /&gt;
  mpi::communicator world;&lt;br /&gt;
&lt;br /&gt;
  if (world.rank() == 0) {&lt;br /&gt;
    world.send(1, 0, std::string(&amp;quot;Hello&amp;quot;));&lt;br /&gt;
    std::string msg;&lt;br /&gt;
    world.recv(1, 1, msg);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; msg &amp;lt;&amp;lt; &amp;quot;!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  } else {&lt;br /&gt;
    std::string msg;&lt;br /&gt;
    world.recv(0, 0, msg);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; msg &amp;lt;&amp;lt; &amp;quot;, &amp;quot;;&lt;br /&gt;
    std::cout.flush();&lt;br /&gt;
    world.send(0, 1, std::string(&amp;quot;world&amp;quot;));&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
compile it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mpic++ $CPPFLAGS $CXXFLAGS $LDFLAGS -lboost_mpi -lboost_serialization boost-mpi-eg.cxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and run it (as it is very fast and short, sqsub is not used here):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mpirun -np 2 ./a.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== A Header-Only Example ==&lt;br /&gt;
&lt;br /&gt;
Many libraries in Boost are header-only (i.e., the program does not need to be linked to a library). With header-only libraries one does not specify any linking options when compiling/linking the code.&lt;br /&gt;
&lt;br /&gt;
Consider the following Boost.Multiprecision program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// This program's code combines code from the following Boost.Multiprecision documentation's pages:&lt;br /&gt;
//   1) http://www.boost.org/doc/libs/1_63_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html&lt;br /&gt;
//   2) http://www.boost.org/doc/libs/1_63_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html&lt;br /&gt;
//   3) http://www.boost.org/doc/libs/1_63_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html&lt;br /&gt;
&lt;br /&gt;
#include &amp;amp;lt;boost/multiprecision/cpp_int.hpp&amp;amp;gt; &lt;br /&gt;
#include &amp;amp;lt;boost/multiprecision/cpp_bin_float.hpp&amp;amp;gt;&lt;br /&gt;
#include &amp;amp;lt;boost/multiprecision/cpp_dec_float.hpp&amp;amp;gt; &lt;br /&gt;
#include &amp;amp;lt;boost/math/special_functions/gamma.hpp&amp;amp;gt;&lt;br /&gt;
#include &amp;amp;lt;iostream&amp;amp;gt;&lt;br /&gt;
  &lt;br /&gt;
void mp_int()&lt;br /&gt;
{&lt;br /&gt;
  // For integer type docs see:&lt;br /&gt;
  // http://www.boost.org/doc/libs/1_63_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html&lt;br /&gt;
&lt;br /&gt;
  // Example Boost docs code follows...&lt;br /&gt;
&lt;br /&gt;
  using namespace boost::multiprecision;&lt;br /&gt;
&lt;br /&gt;
  // Do some fixed precision arithmetic:&lt;br /&gt;
  int128_t v = 1;&lt;br /&gt;
  for (unsigned i = 1; i &amp;amp;lt;= 20; ++i)&lt;br /&gt;
    v *= i;&lt;br /&gt;
  std::cout &amp;amp;lt;&amp;amp;lt; v &amp;amp;lt;&amp;amp;lt; std::endl; // prints 20&lt;br /&gt;
&lt;br /&gt;
  // Repeat at arbitrary precision:&lt;br /&gt;
  cpp_int u = 1;&lt;br /&gt;
  for (unsigned i = 1; i &amp;amp;lt;= 100; ++i)&lt;br /&gt;
    u *= i;&lt;br /&gt;
  std::cout &amp;amp;lt;&amp;amp;lt; u &amp;amp;lt;&amp;amp;lt; std::endl; // prints 100&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp_bin_float()&lt;br /&gt;
{&lt;br /&gt;
  // For floating-point type docs see:&lt;br /&gt;
  // http://www.boost.org/doc/libs/1_63_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats.html&lt;br /&gt;
&lt;br /&gt;
  // Example Boost docs code follows...&lt;br /&gt;
&lt;br /&gt;
  using namespace boost::multiprecision;&lt;br /&gt;
&lt;br /&gt;
   // Operations at fixed precision and full numeric_limits support:&lt;br /&gt;
   cpp_bin_float_100 b = 2;&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; std::numeric_limits&amp;amp;lt;cpp_bin_float_100&amp;amp;gt;::digits &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; std::numeric_limits&amp;amp;lt;cpp_bin_float_100&amp;amp;gt;::digits10 &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // We can use any C++ std lib function, lets print all the digits as well:&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; std::setprecision(std::numeric_limits&amp;amp;lt;cpp_bin_float_100&amp;amp;gt;::max_digits10)&lt;br /&gt;
      &amp;amp;lt;&amp;amp;lt; log(b) &amp;amp;lt;&amp;amp;lt; std::endl; // print log(2)&lt;br /&gt;
&lt;br /&gt;
   // We can also use any function from Boost.Math:&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; boost::math::tgamma(b) &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // These even work when the argument is an expression template:&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; boost::math::tgamma(b * b) &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // And since we have an extended exponent range we can generate some really large &lt;br /&gt;
   // numbers here (4.0238726007709377354370243e+2564):&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; boost::math::tgamma(cpp_bin_float_100(1000)) &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp_dec_float()&lt;br /&gt;
{&lt;br /&gt;
   using namespace boost::multiprecision;&lt;br /&gt;
&lt;br /&gt;
   // Operations at fixed precision and full numeric_limits support:&lt;br /&gt;
   cpp_dec_float_100 b = 2;&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; std::numeric_limits&amp;amp;lt;cpp_dec_float_100&amp;amp;gt;::digits &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // Note that digits10 is the same as digits, since we&amp;amp;apos;re base 10! :&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; std::numeric_limits&amp;amp;lt;cpp_dec_float_100&amp;amp;gt;::digits10 &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // We can use any C++ std lib function, lets print all the digits as well:&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; std::setprecision(std::numeric_limits&amp;amp;lt;cpp_dec_float_100&amp;amp;gt;::max_digits10)&lt;br /&gt;
      &amp;amp;lt;&amp;amp;lt; log(b) &amp;amp;lt;&amp;amp;lt; std::endl; // print log(2)&lt;br /&gt;
&lt;br /&gt;
   // We can also use any function from Boost.Math:&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; boost::math::tgamma(b) &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // These even work when the argument is an expression template:&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; boost::math::tgamma(b * b) &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
   // And since we have an extended exponent range we can generate some really large &lt;br /&gt;
   // numbers here (4.0238726007709377354370243e+2564):&lt;br /&gt;
   std::cout &amp;amp;lt;&amp;amp;lt; boost::math::tgamma(cpp_dec_float_100(1000)) &amp;amp;lt;&amp;amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  mp_int();&lt;br /&gt;
  mp_bin_float();&lt;br /&gt;
  mp_dec_float();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It be compiled and run using GCC v6.3.0 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module unload gcc intel openmpi mkl boost&lt;br /&gt;
$ module load gcc/6.3.0 boost/gcc630/1.63.0&lt;br /&gt;
$ g++ -I$BOOST_ROOT/include boost-multiprecision.cxx&lt;br /&gt;
$ ./a.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or with Intel v17.0.1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module unload gcc intel openmpi mkl boost&lt;br /&gt;
$ module load intel/17.0.1 boost/intel1701/1.63.0&lt;br /&gt;
$ icpc -I$BOOST_ROOT/include boost-multiprecision.cxx&lt;br /&gt;
$ ./a.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Operating System Installed Boost ==&lt;br /&gt;
&lt;br /&gt;
If you don't load a SHARCNET boost module, your program will most likely link to the operating system's installed version of Boost. To determine which version(s) of boost and boost-devel are installed run the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -qi boost&lt;br /&gt;
rpm -qi boost-devel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' System versions are rather old and won't be upgraded or maintained by SHARCNET staff unless something in the operating system requires it to be updated. Therefore we '''strongly encourag''' using the SHARCNET provided Boost modules discussed above on this page.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Boost Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.boost.org/&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Template:CCDelete&amp;diff=17933</id>
		<title>Template:CCDelete</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Template:CCDelete&amp;diff=17933"/>
				<updated>2019-06-06T14:02:20Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot;&lt;br /&gt;
|- bgcolor=&amp;quot;#FFF8DC&amp;quot;&lt;br /&gt;
| This page is scheduled for deletion because it is either redundant with information available on the CC wiki, or the software is no longer supported.&lt;br /&gt;
|}&lt;br /&gt;
__TOC__&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Template:CCMissing&amp;diff=17931</id>
		<title>Template:CCMissing</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Template:CCMissing&amp;diff=17931"/>
				<updated>2019-06-06T13:59:11Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Created page with &amp;quot;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot; |- bgcolor=&amp;quot;#FFF8DC&amp;quot; | This page is will be deleted pending it's creation on the CC wiki. |} __TOC__&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot;&lt;br /&gt;
|- bgcolor=&amp;quot;#FFF8DC&amp;quot;&lt;br /&gt;
| This page is will be deleted pending it's creation on the CC wiki.&lt;br /&gt;
|}&lt;br /&gt;
__TOC__&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Template:CCDelete&amp;diff=17930</id>
		<title>Template:CCDelete</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Template:CCDelete&amp;diff=17930"/>
				<updated>2019-06-06T13:57:13Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Created page with &amp;quot;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot; |- bgcolor=&amp;quot;#FFF8DC&amp;quot; | This page is scheduled for deletion because it is redundant with information available on the CC wiki....&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot;&lt;br /&gt;
|- bgcolor=&amp;quot;#FFF8DC&amp;quot;&lt;br /&gt;
| This page is scheduled for deletion because it is redundant with information available on the CC wiki.&lt;br /&gt;
|}&lt;br /&gt;
__TOC__&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Template:GrahamMissing&amp;diff=17928</id>
		<title>Template:GrahamMissing</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Template:GrahamMissing&amp;diff=17928"/>
				<updated>2019-06-06T13:55:17Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Created page with &amp;quot;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot; |- bgcolor=&amp;quot;#FFF8DC&amp;quot; | This page is will be deleted pending it's creation on the CC wiki. |} __TOC__&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| cellpadding=5 style=&amp;quot;border:4px solid #BF4513&amp;quot;&lt;br /&gt;
|- bgcolor=&amp;quot;#FFF8DC&amp;quot;&lt;br /&gt;
| This page is will be deleted pending it's creation on the CC wiki.&lt;br /&gt;
|}&lt;br /&gt;
__TOC__&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Code_Repositories&amp;diff=17742</id>
		<title>Code Repositories</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Code_Repositories&amp;diff=17742"/>
				<updated>2019-05-06T14:05:45Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Created page with &amp;quot;=Code repositories=  The code for (most) dedicated programming projects is stored in the SHARCNET [http://www.sharcnet.ca/git git repository].  What follows is some details re...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Code repositories=&lt;br /&gt;
&lt;br /&gt;
The code for (most) dedicated programming projects is stored in the SHARCNET [http://www.sharcnet.ca/git git repository].  What follows is some details regarding using git with these repositories.  Please refer to our [[Git|git page]] for general information on using git.&lt;br /&gt;
&lt;br /&gt;
==Certificate problems==&lt;br /&gt;
&lt;br /&gt;
If you are seeing error messages like ''error: server certificate verification failed ...'' while performing a clone, push, fetch, or pull, your system cannot verify the authenticity of ''www.sharcnet.ca''.  This is caused by either not connecting directly to ''www.sharcnet.ca'' (as when using ssh port tunneling as described below) or by your SSL stack having dropped support for the [http://www.win.tue.nl/hashclash/rogue-ca deprecated MD5] signatures (as with GnuTLS for SSL under Debian).&lt;br /&gt;
&lt;br /&gt;
In either case, you will have to turn off git's SSL verification by setting the environment variable ''GIT_SSL_NO_VERIFY=1'' or running the command&lt;br /&gt;
&lt;br /&gt;
  git config http.sslVerify false&lt;br /&gt;
&lt;br /&gt;
inside your repository (the former must be used for cloning as the repository won't exist yet).&lt;br /&gt;
&lt;br /&gt;
Our current certificate expires on March 10, 2012.  If you have disabled SSL verification due to the MD5 issue, you should re-enable it at this point as we will have purchased a new certificate without this issue.&lt;br /&gt;
&lt;br /&gt;
==Dropped connections==&lt;br /&gt;
&lt;br /&gt;
If you are periodically seeing error messages like ''Cannot obtain needed blob ...'' while performing a clone, push, fetch, or pull, an intermediate network is occasionally dropping your connections.  This has been a known problem on at least the Western campus.&lt;br /&gt;
&lt;br /&gt;
A solution is to use SSH to create a tunnel across the intermediate network to the SHARCNET network.&lt;br /&gt;
&lt;br /&gt;
  ssh -N -L &amp;lt;port&amp;gt;:www.sharcnet.ca:443 &amp;lt;user&amp;gt;@&amp;lt;cluster&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where ''&amp;lt;port&amp;gt;'' is a free port (such as 4000), ''&amp;lt;user&amp;gt;'' is your SHARCNET user name, and ''&amp;lt;cluster&amp;gt;'' is any of the SHARCNET clusters.  While this ssh session is running, connections to ''localhost:&amp;lt;port&amp;gt;'' will be forwarded ''www.sharcnet.ca:443'' via ''&amp;lt;cluster&amp;gt;''.  For example&lt;br /&gt;
&lt;br /&gt;
  GIT_SSL_NO_VERIFY=1 git clone https://localhost:&amp;lt;port&amp;gt;/&amp;lt;project&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will check out ''&amp;lt;project&amp;gt;'' over the tunnel.&lt;br /&gt;
&lt;br /&gt;
The ''GIT_SSL_NO_VERIFY'' environment variable is required as  SSL verification will otherwise fail due to the port forwarding.  Once you have checked out the project, you can permanently disable SSL verification by running&lt;br /&gt;
&lt;br /&gt;
  git config http.sslVerify false&lt;br /&gt;
&lt;br /&gt;
in the project directory.&lt;br /&gt;
&lt;br /&gt;
Note that every time you access the SHARCNET git server (i.e., do a clone, push, fetch, or pull), you need to have the ssh tunnel running.  If you try and access the remote without the ssh tunnel running, you will get an ''error: couldn't connect to host while accessing ...'' message.&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16578</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16578"/>
				<updated>2018-05-29T18:48:49Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Use self signed certificate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Use self signed certificate [https://wiki.debian.org/Self-Signed_Certificate]===&lt;br /&gt;
    $ mkdir /etc/ssl/localcerts&lt;br /&gt;
    $ openssl req -new -x509 -days 365 -nodes -out /etc/ssl/localcerts/apache.pem -keyout /etc/ssl/localcerts/apache.key&lt;br /&gt;
    $ chmod 600 /etc/ssl/localcerts/apache*&lt;br /&gt;
    $ cd /etc/apache2/sites-available/&lt;br /&gt;
    $ cp default-ssl.conf my-ssl.conf&lt;br /&gt;
    $ vim my-ssl.conf&lt;br /&gt;
    NameVirtualHost *:443&lt;br /&gt;
    &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
    SSLEngine On&lt;br /&gt;
    SSLCertificateFile /etc/ssl/localcerts/apache.pem&lt;br /&gt;
    SSLCertificateKeyFile /etc/ssl/localcerts/apache.key&lt;br /&gt;
&lt;br /&gt;
    $ a2ensite my-ssl.conf&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
==SSH Fuse==&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham (placeholder section)====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16577</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16577"/>
				<updated>2018-05-29T18:34:24Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Use self signed certificate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Use self signed certificate===&lt;br /&gt;
    $ mkdir /etc/ssl/localcerts&lt;br /&gt;
    $ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt&lt;br /&gt;
    $ vim /etc/apache2/sites-enabled/default-ssl.conf&lt;br /&gt;
    SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt&lt;br /&gt;
    SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
==SSH Fuse==&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham (placeholder section)====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16576</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16576"/>
				<updated>2018-05-29T18:28:17Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Use self signed certificate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Use self signed certificate===&lt;br /&gt;
    $ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt&lt;br /&gt;
    $ vim /etc/apache2/sites-enabled/default-ssl.conf&lt;br /&gt;
    SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt&lt;br /&gt;
    SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
==SSH Fuse==&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham (placeholder section)====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16575</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16575"/>
				<updated>2018-05-29T18:23:01Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Use self signed certificate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Use self signed certificate===&lt;br /&gt;
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt&lt;br /&gt;
&lt;br /&gt;
    vim&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
==SSH Fuse==&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham (placeholder section)====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16574</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16574"/>
				<updated>2018-05-29T18:17:55Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Apache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Use self signed certificate===&lt;br /&gt;
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
==SSH Fuse==&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham (placeholder section)====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16573</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16573"/>
				<updated>2018-05-29T17:11:26Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Helper packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
==SSH Fuse==&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham (placeholder section)====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16572</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16572"/>
				<updated>2018-05-29T17:10:41Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;br /&gt;
&lt;br /&gt;
===SSH Fuse===&lt;br /&gt;
Give “debian” user www-data group so that files can be uploaded to the web server&lt;br /&gt;
$ sudo usermod -aG www-data debian&lt;br /&gt;
&lt;br /&gt;
====Copy the ssh key to graham====&lt;br /&gt;
(lamp)  $ sudo cp .ssh/id_rsa.pub ~&lt;br /&gt;
(local) $ scp -3 cloud:~/id_rsa.pub graham:~ # the -3 disables host to host copying&lt;br /&gt;
(graham)$ cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
====Setup Graham====&lt;br /&gt;
    $ ssh graham &lt;br /&gt;
    $ mkdir ~/project/edward/linked-cloud&lt;br /&gt;
    $ cd linked-cloud&lt;br /&gt;
    $ wget https://git.sharcnet.ca/edward/CSVSorterDemo/raw/master/CSVSorter.jar&lt;br /&gt;
    $ mkdir input&lt;br /&gt;
    $ mkdir output&lt;br /&gt;
    $ vim submitjob.sh&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    #SBATCH -t 0-00:01&lt;br /&gt;
    #SBATCH --mem=4G&lt;br /&gt;
    #SBATCH -A def-edward&lt;br /&gt;
    java -Xmx10m -jar /home/edward/project/edward/linked-cloud/CSVSorter.jar \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/input/$1 \&lt;br /&gt;
    /home/edward/project/edward/linked-cloud/output/$1&lt;br /&gt;
&lt;br /&gt;
====Link LAMP server with Graham through sshfuse====&lt;br /&gt;
    $ ssh cloud&lt;br /&gt;
    $ apt install sshfs&lt;br /&gt;
    $ cd /var/www&lt;br /&gt;
    $ sudo -u www-data mkdir linked-graham&lt;br /&gt;
    $ sudo -u www-data sshfs edward@graham.sharcnet.ca:/home/edward/project/linked-cloud /var/www/linked-graham&lt;br /&gt;
    - (to unmount) fusermount -u ./project&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16566</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16566"/>
				<updated>2018-05-29T15:20:57Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16565</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16565"/>
				<updated>2018-05-28T16:58:27Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
==Helper packages==&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;br /&gt;
&lt;br /&gt;
===Give www-data an ssh key and ownership of home directory===&lt;br /&gt;
$ chmod 774 /var/www/html&lt;br /&gt;
$ chown www-data:www-data -R /var/www&lt;br /&gt;
$ mkdir /var/www/.ssh&lt;br /&gt;
$ chown www-data:www-data /var/www/.ssh&lt;br /&gt;
$ sudo -u www-data ssh-keygen -C www-data #no passphrase for now&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16564</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16564"/>
				<updated>2018-05-28T16:57:42Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;br /&gt;
&lt;br /&gt;
===Add basic user-password verfication===&lt;br /&gt;
    $ mkdir /var/www/passwd&lt;br /&gt;
    $ htpasswd -c /var/www/passwd/passwords user&lt;br /&gt;
    $ vim /etc/apache2/apache2.conf&lt;br /&gt;
    &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
        Require valid-user&lt;br /&gt;
        AuthType basic&lt;br /&gt;
        AuthName &amp;quot;Restricted Files&amp;quot;&lt;br /&gt;
        AuthUserFile &amp;quot;/var/www/passwd/passwords&amp;quot;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Install PHP===&lt;br /&gt;
    $ apt -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache&lt;br /&gt;
    $ echo ‘&amp;lt;?php phpinfo(); ?&amp;gt;’ &amp;gt; /var/www/html/test.php&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16563</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16563"/>
				<updated>2018-05-28T14:46:58Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Install webserver and suppporting packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;br /&gt;
&lt;br /&gt;
===Secure Apache with SSL certificates===&lt;br /&gt;
Going to https is now possible but will trigger a warning.&lt;br /&gt;
    $ a2enmod ssl&lt;br /&gt;
    $ a2ensite default-ssl.conf&lt;br /&gt;
    $ service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===Enable let's encrypt (requires a domain name)===&lt;br /&gt;
    $ apt install git&lt;br /&gt;
    $ sudo git clone https://github.com/letsencrypt/letsencrypt  /opt/letsencrypt&lt;br /&gt;
    $ cd /opt/letsencrypt&lt;br /&gt;
    $ ./certbot-auto --authenticator webroot --installer apache&lt;br /&gt;
    www.frar.ca&lt;br /&gt;
    /var/www/html&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16562</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16562"/>
				<updated>2018-05-28T14:44:12Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Apache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work. httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.  In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Windows NT, 2000 and XP and as a console application on Windows 9x and ME.&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16561</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16561"/>
				<updated>2018-05-28T14:41:39Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Basic information &amp;amp; settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work.&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v &lt;br /&gt;
## [https://httpd.apache.org/docs/2.4/programs/apachectl.html see]&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16560</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16560"/>
				<updated>2018-05-28T14:40:29Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: /* Apache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work.&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;br /&gt;
===Basic information &amp;amp; settings===&lt;br /&gt;
# Document root Directory: /var/www/html or /var/www&lt;br /&gt;
# Main Configuration file:&lt;br /&gt;
## /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora) &lt;br /&gt;
## /etc/apache2/apache2.conf (Debian/Ubuntu).&lt;br /&gt;
# Default HTTP Port: 80 TCP&lt;br /&gt;
# Default HTTPS Port: 443 TCP&lt;br /&gt;
# Access Log files of Web Server: /var/log/apache2/access_log&lt;br /&gt;
# Error Log files of Web Server: /var/log/apache2/error_log&lt;br /&gt;
# service apache2 {start|stop|graceful-stop|restart|reload|force-reload}&lt;br /&gt;
# apachectl -v&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16559</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16559"/>
				<updated>2018-05-28T14:39:17Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserver and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
Note that https will not yet work.&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16558</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16558"/>
				<updated>2018-05-28T14:32:43Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;br /&gt;
&lt;br /&gt;
=Install webserer and suppporting packages=&lt;br /&gt;
==MYSQL==&lt;br /&gt;
    $ apt install mysql-server&lt;br /&gt;
    $ mysql_secure_installation #password=password&lt;br /&gt;
&lt;br /&gt;
==Apache==&lt;br /&gt;
Installing the Apache webserver will allow you to access a default page at your ip address. (ex http://199.241.164.95, or http://frar.ca).&lt;br /&gt;
&lt;br /&gt;
    $ apt install apache2&lt;br /&gt;
    $ service apache2 start #add 80, 443 to default security group rules&lt;br /&gt;
    $ a2enmod cgid.load #(optional) enable cgi scripting, a2dismod to remove&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16557</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16557"/>
				<updated>2018-05-28T14:27:35Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
= Server Setup =&lt;br /&gt;
&lt;br /&gt;
==Login to Server &amp;amp; perform preliminaries==&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;br /&gt;
&lt;br /&gt;
==Apt error==&lt;br /&gt;
If you receive the &amp;quot;apt error&amp;quot; mesage put &amp;quot;nameserver 8.8.8.8&amp;quot; in /etc/resolve.conf.&lt;br /&gt;
    $ echo 'nameserver 8.8.8.8 &amp;gt;&amp;gt;' /etc/resolve.conf&lt;br /&gt;
&lt;br /&gt;
==Secure the SSH login==&lt;br /&gt;
The following changes will disable logging into the server by using a password on any account and prevent logging into root remotly.  Root can&lt;br /&gt;
still be accessed by logging into a ''sudo'' enabled account and using the command ''su root''.  For more information on the sshd_config file&lt;br /&gt;
options, go [https://man.openbsd.org/sshd_config here].  The unattended-upgrades package is used to keep they server up to date automatically.&lt;br /&gt;
    $ sudo vim /etc/ssh/sshd_config&lt;br /&gt;
    ChallengeResponseAuthentication no&lt;br /&gt;
    PasswordAuthentication no&lt;br /&gt;
    PermitRootLogin no&lt;br /&gt;
    $ service ssh reload&lt;br /&gt;
    $ apt install unattended-upgrades&lt;br /&gt;
    $ dpkg-reconfigure --priority=low unattended-upgrades&lt;br /&gt;
    $ sudo unattended-upgrade -d&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16556</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16556"/>
				<updated>2018-05-28T14:04:05Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
For the remainder of the instructions the ip address used is 199.241.164.95, this is for demonstration purposes and you should replace&lt;br /&gt;
it with your assigned floating IP address.&lt;br /&gt;
&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
=Login to Server &amp;amp; perform preliminaries=&lt;br /&gt;
At this point log into the server to ensure that the service is up and running.  There are a number of steps you can perform that will make &lt;br /&gt;
the remaining steps easier.  First loging to the server.  Then setup a user prompt to make navigation easier.  Switch to root (or use sudo in&lt;br /&gt;
from of the remaining commands). Update and upgrade the system.  Last install the manual pages.&lt;br /&gt;
    $ ssh debian@199.241.164.95&lt;br /&gt;
    $ echo 'export PS1=&amp;quot;\[\e[33m\]\w\[\e[0m\]\n\[\e[32m\]\u@\h$ \[\e[0m\]&amp;quot;' &amp;gt;&amp;gt; .bash_aliases&lt;br /&gt;
    $ sudo su root&lt;br /&gt;
    $ apt update&lt;br /&gt;
    $ apt upgrade&lt;br /&gt;
    $ apt install man&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16555</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16555"/>
				<updated>2018-05-28T13:44:29Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies - Launch Cloud Instance=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  The instruction to do this can be found [[Carpet|here]].&lt;br /&gt;
# login to cloud.sharcnet.ca&lt;br /&gt;
# Don’t forget volume size&lt;br /&gt;
# Choose Debian 9.2.2 (not required, but the remaining instructions are Debian centric).&lt;br /&gt;
# Choose persistent (ephemeral is for shorter jobs) (4C-8GB)&lt;br /&gt;
# Setup keypair&lt;br /&gt;
# Associate floating ip&lt;br /&gt;
&lt;br /&gt;
==(Optional) Apply IP Address to your name server==&lt;br /&gt;
If you have a registered domain name you should apply your floating IP address to it so that you can use the &amp;quot;let's encrypt&amp;quot; service to &lt;br /&gt;
enable the secure socket layer without client side warnings.  It is often best to do this at the beginning as there is typically a delay&lt;br /&gt;
in updating the name service.&lt;br /&gt;
&lt;br /&gt;
=Login to Server &amp;amp; perform preliminaries=&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16554</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16554"/>
				<updated>2018-05-28T13:38:48Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;br /&gt;
&lt;br /&gt;
=Dependencies=&lt;br /&gt;
Before deploying a web server, first a cloud instance must be lauched.  [[See page|Carpet]].&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16553</id>
		<title>Deploying a web server</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Deploying_a_web_server&amp;diff=16553"/>
				<updated>2018-05-28T13:37:01Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Created page with &amp;quot;Deploying a Web Server&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deploying a Web Server&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15561</id>
		<title>File:Winsshfs.png</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15561"/>
				<updated>2017-08-11T14:48:50Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Edward uploaded a new version of File:Winsshfs.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15560</id>
		<title>File:Winsshfs.png</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15560"/>
				<updated>2017-08-11T14:48:04Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Edward uploaded a new version of File:Winsshfs.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15559</id>
		<title>File:Winsshfs.png</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15559"/>
				<updated>2017-08-11T14:47:43Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Edward uploaded a new version of File:Winsshfs.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15558</id>
		<title>File:Winsshfs.png</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15558"/>
				<updated>2017-08-11T14:46:57Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Edward uploaded a new version of File:Winsshfs.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15552</id>
		<title>File:Winsshfs.png</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Winsshfs.png&amp;diff=15552"/>
				<updated>2017-08-11T14:27:25Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=15528</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=15528"/>
				<updated>2017-08-01T18:04:02Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{GrahamUpdate}}&lt;br /&gt;
&amp;lt;!--checked2016--&amp;gt;&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, to load the default Octave module (currently version 3.8.1) one would do:&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave&lt;br /&gt;
&lt;br /&gt;
==On the Graham national system==&lt;br /&gt;
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.&lt;br /&gt;
&lt;br /&gt;
On the Graham system the user simply needs to call the &amp;quot;module load&amp;quot; command without manually unloading conflicting packages.&lt;br /&gt;
&lt;br /&gt;
 $ module load octave/4.2.1&lt;br /&gt;
&lt;br /&gt;
To obtain information about the package's dependencies the &amp;quot;spider&amp;quot; action can be included in the call to &amp;quot;module&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module spider octave&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
  octave:&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
    Description:&lt;br /&gt;
      GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
     Versions:&lt;br /&gt;
        octave/4.2.1&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
  For detailed information about a specific &amp;quot;octave&amp;quot; module (including how to load the modules) use the module's full name.&lt;br /&gt;
  For example:&lt;br /&gt;
&lt;br /&gt;
     $ module spider octave/4.2.1&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
  octave: octave/4.2.1&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;
    Description:&lt;br /&gt;
      GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
    Properties:&lt;br /&gt;
      Tools for development / Outils de développement&lt;br /&gt;
&lt;br /&gt;
    You will need to load all module(s) on any one of the lines below before the &amp;quot;octave/4.2.1&amp;quot; module is available to load.&lt;br /&gt;
&lt;br /&gt;
      nixpkgs/16.09  gcc/5.4.0&lt;br /&gt;
      nixpkgs/16.09  intel/2016.4&lt;br /&gt;
      nixpkgs/16.09  intel/2017.1&lt;br /&gt;
 &lt;br /&gt;
    Help:&lt;br /&gt;
      GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters for production work Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==On the Graham national system==&lt;br /&gt;
&lt;br /&gt;
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple &amp;quot;Hellow World!&amp;quot; process to Graham the user would first need to create a submit script as follows.&lt;br /&gt;
&lt;br /&gt;
 $ cat oct_serial.sh &lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH -t 0-00:01&lt;br /&gt;
 #SBATCH --mem=400&lt;br /&gt;
 octave --eval 'disp(&amp;quot;Hello World! from Octave&amp;quot;)'&lt;br /&gt;
&lt;br /&gt;
Then pass this submit script to &amp;quot;sbatch&amp;quot; to be entered into the queue:&lt;br /&gt;
&lt;br /&gt;
 $ sbatch --account=myusername oct_serial.sh&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
This section shows howto submit a  [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts  [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat sample.m &lt;br /&gt;
#! /bin/octave -qf&lt;br /&gt;
printf (&amp;quot;%s&amp;quot;, program_name ());&lt;br /&gt;
arg_list = argv ();&lt;br /&gt;
for i = 1:nargin&lt;br /&gt;
    printf (&amp;quot; %s&amp;quot;, arg_list{i});&lt;br /&gt;
endfor&lt;br /&gt;
printf (&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To eliminate exatraneous verbosity in the output file two switches are passed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc&lt;br /&gt;
WARNING: no memory requirement defined; assuming 2GB per process.&lt;br /&gt;
submitted as jobid 6937872&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file from the job appears as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50&lt;br /&gt;
sample.m arg1 arg2 arg3 etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Running in the development nodes=&lt;br /&gt;
&lt;br /&gt;
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.&lt;br /&gt;
&lt;br /&gt;
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:&lt;br /&gt;
&lt;br /&gt;
 ssh -Y username@kraken.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
Then login to one of the development nodes with trusted X11 forwarding enabled:&lt;br /&gt;
&lt;br /&gt;
 ssh -Y kraken-devel1&lt;br /&gt;
&lt;br /&gt;
Once logged into the development node one can load the Octave modules and launch the program:&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave&lt;br /&gt;
 octave&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 GNU Octave, version 3.8.1&lt;br /&gt;
 Copyright (C) 2014 John W. Eaton and others.&lt;br /&gt;
 This is free software; see the source code for copying conditions.&lt;br /&gt;
 There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or&lt;br /&gt;
 FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.&lt;br /&gt;
&lt;br /&gt;
 Octave was configured for &amp;quot;x86_64-unknown-linux-gnu&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 Additional information about Octave is available at http://www.octave.org.&lt;br /&gt;
&lt;br /&gt;
 Please contribute if you find this software useful.&lt;br /&gt;
 For more information, visit http://www.octave.org/get-involved.html&lt;br /&gt;
&lt;br /&gt;
 Read http://www.octave.org/bugs.html to learn how to submit bug reports.&lt;br /&gt;
 For information about changes from previous versions, type 'news'.&lt;br /&gt;
&lt;br /&gt;
 octave:1&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.&lt;br /&gt;
&lt;br /&gt;
==One the Graham nation system==&lt;br /&gt;
&lt;br /&gt;
Rather than dedicated development as it typical on some of the other SHARCNET systems the national systems have nodes that prioritize interactive jobs allocated by call to &amp;quot;salloc&amp;quot; of the Slurm scheduler.&lt;br /&gt;
&lt;br /&gt;
To use Octave interactively on Graham you can do the following:&lt;br /&gt;
&lt;br /&gt;
Use salloc to request a single task for one hour:&lt;br /&gt;
&lt;br /&gt;
 $ salloc --account=def-roxa88 --time=1:0:0 --ntasks=1&lt;br /&gt;
&lt;br /&gt;
Then you will receive notification when the reservation is granted (including jobid), for&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
 salloc: Granted job allocation 12345&lt;br /&gt;
&lt;br /&gt;
Then use srun to start a terminal to work in on the reservation:&lt;br /&gt;
&lt;br /&gt;
 $ srun --wait 0 --pty bash&lt;br /&gt;
&lt;br /&gt;
Once running the terminal in the allocation you can start your work with Octave by loading&lt;br /&gt;
the module and starting the program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module load octave&lt;br /&gt;
$ octave&lt;br /&gt;
octave: X11 DISPLAY environment variable not set&lt;br /&gt;
octave: disabling GUI features&lt;br /&gt;
GNU Octave, version 4.2.1&lt;br /&gt;
Copyright (C) 2017 John W. Eaton and others.&lt;br /&gt;
This is free software; see the source code for copying conditions.&lt;br /&gt;
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.&lt;br /&gt;
&lt;br /&gt;
Octave was configured for &amp;quot;x86_64-pc-linux-gnu&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Additional information about Octave is available at http://www.octave.org.&lt;br /&gt;
&lt;br /&gt;
Please contribute if you find this software useful.&lt;br /&gt;
For more information, visit http://www.octave.org/get-involved.html&lt;br /&gt;
&lt;br /&gt;
Read http://www.octave.org/bugs.html to learn how to submit bug reports.&lt;br /&gt;
For information about changes from previous versions, type 'news'.&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... Then once you have the &amp;quot;octave:#&amp;gt;&amp;quot; prompt the terminal will behave like the Matlab&lt;br /&gt;
command line.&lt;br /&gt;
&lt;br /&gt;
Once you are finished with Octave use &amp;quot;quit&amp;quot; to exit the program, then &amp;quot;exit&amp;quot; to logout of&lt;br /&gt;
the compute node (terminate srun), then &amp;quot;exit&amp;quot; again to terminate the allocation&lt;br /&gt;
(relinquishing the allocate resources).&lt;br /&gt;
&lt;br /&gt;
=Running on a visualization system=&lt;br /&gt;
&lt;br /&gt;
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu &amp;gt; Eduction &amp;gt; GNU Octave.&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave --traditional mycode.m&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system.  Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).&lt;br /&gt;
&lt;br /&gt;
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature).  Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.&lt;br /&gt;
&lt;br /&gt;
===Sharing Packages===&lt;br /&gt;
&lt;br /&gt;
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users.  To do this simply set access permissions for group or global read access accordingly. For details on how to change &lt;br /&gt;
the permissions see:   https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F&lt;br /&gt;
&lt;br /&gt;
===Managing Packages===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===Package Commands===&lt;br /&gt;
&lt;br /&gt;
Additional examples of package commands are shown in this section.  For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Package Example===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=VALGRIND&amp;diff=15523</id>
		<title>VALGRIND</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=VALGRIND&amp;diff=15523"/>
				<updated>2017-07-27T12:52:26Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{GrahamUpdate}}&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=VALGRIND&lt;br /&gt;
|package_description=Memory debugger&lt;br /&gt;
|package_idnumber=132&lt;br /&gt;
}}&lt;br /&gt;
'''Valgrind''' is a powerful tool for analyzing programs, memory debugging, memory leak detection and profiling.  It is freely available under GNU license.  Version 3.5.0 is available on most SHARCNET systems.&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' To avoid spurious warnings it is important to not use too new of a version of GCC or OpenMPI.  We recommend&lt;br /&gt;
&lt;br /&gt;
* gcc/4.8.2&lt;br /&gt;
* openmpi/gcc-debug/1.8.3 modules&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
Valgrind is a dynamic binary instrumentation framework that dynamically translates executables to add instrumentation and track all memory and register usages by a program.  The advantages of this approach are that&lt;br /&gt;
&lt;br /&gt;
* it can be directly run on any executable, and&lt;br /&gt;
* dynamic translation allows ultimate instrumentation&lt;br /&gt;
&lt;br /&gt;
while the disadvantages are&lt;br /&gt;
&lt;br /&gt;
* 5-100 x slow down depending on tool,&lt;br /&gt;
* 12-18 x increase in size of translated code, and&lt;br /&gt;
* corner cases may exist between translated code and original.&lt;br /&gt;
&lt;br /&gt;
Several tools have been built upon this framework.  These include&lt;br /&gt;
&lt;br /&gt;
* ''memcheck'' -  memory error detector&lt;br /&gt;
* ''cachegrind'' - cache and branch-prediction profiler&lt;br /&gt;
* ''callgrind'' - call-graph generating cache and branch prediction profiler&lt;br /&gt;
* ''helgrind'' - thread error detector&lt;br /&gt;
* ''DRD'' - thread error detector&lt;br /&gt;
* ''Massif'' - heap profiler&lt;br /&gt;
* ''DHAT'' - dynamic heap analysis tool&lt;br /&gt;
* ''SGCheck'' - experimental stack and global array overrun detector&lt;br /&gt;
* ''BBV'' - experimental basic block vector generation tool&lt;br /&gt;
&lt;br /&gt;
You are welcome to use any or all of these, but we have only used ''memcheck'' and ''cachegrind'' and only support ''memcheck''.&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
The primary used tool is ''memcheck''.  This is the default tool and the only one we discuss here.  Documentation for other tools can be found on the [http://www.valgrind.org valgrind website].  The memcheck tool detects several common memory errors&lt;br /&gt;
&lt;br /&gt;
* overrunning and underrunning heap blocks,&lt;br /&gt;
* overrunning top of stack,&lt;br /&gt;
* continuing to access released memory,&lt;br /&gt;
* using uninitialized values,&lt;br /&gt;
* incorrectly using memory copying routines,&lt;br /&gt;
* incorrectly paired allocation/release calls,&lt;br /&gt;
* relasing unallocated memory, and&lt;br /&gt;
* not releasing memory.&lt;br /&gt;
&lt;br /&gt;
We recommend running all new code under valgrind on small test cases (small due to the aforementioned ~10x slowdown).  This can save hours and hours of debugging.  Running the program under valgrind can be as simple as compiling with debugging information (adding the &amp;lt;tt&amp;gt;-g&amp;lt;/tt&amp;gt; flag) and running as &amp;lt;tt&amp;gt;valgrind &amp;lt;program&amp;gt; &amp;lt;arguements&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Serial code ==&lt;br /&gt;
&lt;br /&gt;
Consider the following ''bug.c'' code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
  double array[10];&lt;br /&gt;
&lt;br /&gt;
  // Execution depends on uninitialized value&lt;br /&gt;
  if (array[4] &amp;lt; 0.0)&lt;br /&gt;
    printf(&amp;quot;the results is negative\n&amp;quot;);&lt;br /&gt;
  else if (array[4] == 0.0)&lt;br /&gt;
    printf(&amp;quot;the results is zero\n&amp;quot;);&lt;br /&gt;
  else if (array[4] &amp;gt; 0.0)&lt;br /&gt;
    printf(&amp;quot;the results is positive\n&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
    printf(&amp;quot;the results are special\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has an uninitialized value bug.  Running this under valgrind&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cc -Wall -g bug.c -o bug&lt;br /&gt;
valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
reports this&lt;br /&gt;
&lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x400511: main (bug.c:7)&lt;br /&gt;
 ==5955== &lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x40052C: main (bug.c:9)&lt;br /&gt;
 ==5955== &lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x400536: main (bug.c:9)&lt;br /&gt;
 ==5955== &lt;br /&gt;
 ==5955== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==5955==    at 0x400551: main (bug.c:11)&lt;br /&gt;
&lt;br /&gt;
Note that valgrind only reports uninitialized values usage once they lead to non-determinism (i.e., when the program encounters a branch whose choice depends on the result of an uninitiated value).  This means you the first report you get is frequently not in the calculation done on the uninitialized values but rather the convergence test or print statement at the end of calculations (print statements contains a bunch of branches in order to handling printing of each different digit).&lt;br /&gt;
&lt;br /&gt;
=== Tracking down uninitialized values ===&lt;br /&gt;
&lt;br /&gt;
More typically a program will be composed of multiple routines that all work on the data.  To this end, consider the following ''bug.c'' code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void initialize_sequence(double* array, const int array_length) {&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  for (i=1; i&amp;lt;array_length+1; ++i)&lt;br /&gt;
    array[i] = i;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
double sum(const double* array, const int array_length) {&lt;br /&gt;
  double array_sum;&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array_sum += array[i];&lt;br /&gt;
&lt;br /&gt;
  return array_sum;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
  double array[10];&lt;br /&gt;
  const int array_length = sizeof(array)/sizeof(array[0]);&lt;br /&gt;
&lt;br /&gt;
  double array_sum;&lt;br /&gt;
&lt;br /&gt;
  initialize_sequence(array,array_length);&lt;br /&gt;
  array_sum = sum(array,array_length);&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;the sum of 0..%d is %f\n&amp;quot;, array_length-1, array_sum);&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has both indexing and uninitialized value bugs.  Despite this, directly running the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cc -Wall -g bug.c -o bug&lt;br /&gt;
./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will mostly likely produce the correct answer on most machines most of the time&lt;br /&gt;
&lt;br /&gt;
 the sum of 0..9 is 45.000000&lt;br /&gt;
&lt;br /&gt;
Running under valgrind&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
reliably gives many warnings of the following form&lt;br /&gt;
&lt;br /&gt;
 ==15930== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==15930==    at 0x5312CF0: __printf_fp (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==15930==    by 0x530E89F: vfprintf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==15930==    by 0x5318189: printf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==15930==    by 0x400722: main (bug.c:29)&lt;br /&gt;
&lt;br /&gt;
This is a typical numeric code example were the warnings first occur at a print statement because this is the first time the uninitialized value leads to non-determinism (i.e., the program's behaviour is random as it is taking or does not taking a branch based on a result computed from something that was not set by the programmer).&lt;br /&gt;
&lt;br /&gt;
We now know the problem is that something unset went into computing the value of ''array_sum'', so we should trace the ''array_sum'' calculation backwards through the program.  This quickly gets difficult as we then find ourselves also tracing back all variables that went into the ''array_sum'' calculation, and then all variables that went into those variables, and so on.&lt;br /&gt;
&lt;br /&gt;
Fortunately Valgrind provides a &amp;lt;tt&amp;gt;--track-origins=yes&amp;lt;/tt&amp;gt; flag to ease our search by telling us which variables are the source of the problem.  Re-running with this flag&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
valgrind --track-origins=yes ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
gives warning messages augmented to include the source of the uninitialized value that went into the computation of ''array_sum''&lt;br /&gt;
&lt;br /&gt;
 ==17589== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==17589==    at 0x5312CF0: __printf_fp (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==17589==    by 0x530E89F: vfprintf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==17589==    by 0x5318189: printf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==17589==    by 0x400722: main (bug.c:29)&lt;br /&gt;
 ==17589==  Uninitialised value was created by a stack allocation&lt;br /&gt;
 ==17589==    at 0x400632: sum (bug.c:10)&lt;br /&gt;
&lt;br /&gt;
Now we know the source of the uninitialized value in the ''array_sum'' computation was a local variable in the ''sum'' routine.  Looking into ''sum'' we hopefully figure out without too much difficulty that we forgot to initialize ''array_sum'' to zero.  If our program is producing the correct answer, it is only because we are getting lucky and ''array_sum'' happens to be allocated from memory that is initially zero.&lt;br /&gt;
&lt;br /&gt;
Correcting the ''sum'' routine&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
double sum(const double* array, const int array_length) {&lt;br /&gt;
  double array_sum;&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  array_sum = 0.0;&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array_sum += array[i];&lt;br /&gt;
&lt;br /&gt;
  return array_sum;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and re-running under valgrind reveals we are still getting uninitialized values warnings associated with the ''array_sum'' computation.  Now (using the &amp;lt;tt&amp;gt;--track-origins=yes&amp;lt;/tt&amp;gt;) they are of the form&lt;br /&gt;
&lt;br /&gt;
 ==18613== Conditional jump or move depends on uninitialised value(s)&lt;br /&gt;
 ==18613==    at 0x5312CF0: __printf_fp (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==18613==    by 0x530E89F: vfprintf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==18613==    by 0x5318189: printf (in /lib64/libc-2.12.so)&lt;br /&gt;
 ==18613==    by 0x40072C: main (bug.c:30)&lt;br /&gt;
 ==18613==  Uninitialised value was created by a stack allocation&lt;br /&gt;
 ==18613==    at 0x400690: main (bug.c:21)&lt;br /&gt;
&lt;br /&gt;
Valgrind is now telling us that a local variable inside ''main'' went into the computation of ''array_sum'' despite never being set.  This must be ''array'' itself as ''array_length'' is clearly set to the compiler computed &amp;lt;tt&amp;gt;sizeof(array)/sizeof(array[0])&amp;lt;/tt&amp;gt; value.&lt;br /&gt;
&lt;br /&gt;
Looking at ''main'' it is clear ''array'' should have been fully initialized by ''initialize_sequence''.  Careful examination of this routine reveals the final error.  The initialization loop was done using Fortran indices (1...''array_length'')  instead of C (0...''array_length-1'').  Correcting this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
void initialize_sequence(double* array, const int array_length) {&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array[i] = i;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
finally produces code the runs under valgrind without any warnings.&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' The Valgrind warnings were being generated because the ''array[0]'' value was not being initialized.  The code was also incorrect in that it was initializing ''array[array_length]'' which is one past the end of ''array''.  If you put this later error back into the program and run under Valgrind you will discover it does not produce any warnings.  This shows that even codes that successfully under Valgrind can still contain errors.&lt;br /&gt;
&lt;br /&gt;
=== Calling Valgrind from your program ===&lt;br /&gt;
&lt;br /&gt;
In some cases it can be helpful to call Valgrind directly from your program in order to check the status of various bits of memory.  This is easily done by including the ''valgrind/memcheck.h'' header file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;valgrind/memcheck.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then adding calls to the appropriate [http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs client check routines].  For example, here is a modified ''sum'' routine for the above program that prints a warning if it is called with an ''array'' that is not fully initialized&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
double sum(const double* array, const int array_length) {&lt;br /&gt;
  double array_sum;&lt;br /&gt;
  int i;&lt;br /&gt;
&lt;br /&gt;
  if (VALGRIND_CHECK_MEM_IS_DEFINED(array,sizeof(double)*array_length)) &lt;br /&gt;
    fprintf(stderr,&amp;quot;sum called with an array that is not fully defined...\n&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
  for (i=0; i&amp;lt;array_length; ++i)&lt;br /&gt;
    array_sum += array[i];&lt;br /&gt;
&lt;br /&gt;
  return array_sum;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the ''bug.c'' code under Valgrind with this modification produces the following output&lt;br /&gt;
&lt;br /&gt;
 ==29765== Uninitialised byte(s) found during client check request&lt;br /&gt;
 ==29765==    at 0x400745: sum (bug.c:15)&lt;br /&gt;
 ==29765==    by 0x400832: main (bug.c:31)&lt;br /&gt;
 ==29765==  Address 0x7fefff8e8 is on thread 1's stack&lt;br /&gt;
 ==29765== &lt;br /&gt;
 sum called with an array that is not fully defined...&lt;br /&gt;
&lt;br /&gt;
== MPI code ==&lt;br /&gt;
&lt;br /&gt;
Consider the following ''bug.c'' MPI code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;mpi.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int argc,char *argv[]){&lt;br /&gt;
  int rank, size;&lt;br /&gt;
  int value;&lt;br /&gt;
&lt;br /&gt;
  MPI_Init(&amp;amp;argc, &amp;amp;argv);&lt;br /&gt;
&lt;br /&gt;
  MPI_Comm_rank(MPI_COMM_WORLD, &amp;amp;rank);&lt;br /&gt;
  MPI_Comm_size(MPI_COMM_WORLD, &amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
  if (rank == 0 &amp;amp;&amp;amp; size &amp;gt; 1) {&lt;br /&gt;
    MPI_Request request;&lt;br /&gt;
&lt;br /&gt;
    MPI_Irecv(&amp;amp;value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &amp;amp;request);&lt;br /&gt;
    value = 0;&lt;br /&gt;
    MPI_Wait (&amp;amp;request, MPI_STATUS_IGNORE);&lt;br /&gt;
  }&lt;br /&gt;
  else if (rank == 1) {&lt;br /&gt;
    MPI_Request request;&lt;br /&gt;
&lt;br /&gt;
    MPI_Isend(&amp;amp;value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &amp;amp;request);&lt;br /&gt;
    value = 1;&lt;br /&gt;
    MPI_Wait(&amp;amp;request, MPI_STATUS_IGNORE);&lt;br /&gt;
  } &lt;br /&gt;
&lt;br /&gt;
  MPI_Finalize();&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has an uninitialized value bug and two race condition bugs around the use of value.&lt;br /&gt;
&lt;br /&gt;
# The first race condition is that rank==0 sets value=0 while at the same time doing a non-blocking receive into value (bug:16).&lt;br /&gt;
# The uninitialized value problem is that rank==1 starts a send of value to rank==0 without ever setting value (bug:22).&lt;br /&gt;
# The second race condition is that rank==1 sets value=1 while at the same time doing a non-blocking send of value (bug:23).&lt;br /&gt;
&lt;br /&gt;
=== Basic Functionality ===&lt;br /&gt;
&lt;br /&gt;
If we just straight up compile and run this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module unload intel openmpi&lt;br /&gt;
module load gcc/4.8.2 openmpi/gcc/1.8.3&lt;br /&gt;
mpicc -Wall -g bug.c -o bug&lt;br /&gt;
mpirun -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we presumably get a report about the uninitialized value, but it is buried in tens of thousands of other bogus error messages.&lt;br /&gt;
&lt;br /&gt;
This solution is to link against the valgrind openmpi debug wrapper library too&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpicc -Wall -g bug.c -L/usr/lib64/valgrind -lmpiwrap-amd64-linux -Xlinker -rpath=/usr/lib64/valgrind -o bug&lt;br /&gt;
mpirun -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now there are only a few bogus errors reported of the form&lt;br /&gt;
&lt;br /&gt;
 ==12598== Syscall param write(buf) points to uninitialised byte(s)&lt;br /&gt;
 ==12598==    at 0x53916FD: ??? (in /lib64/libpthread-2.12.so)&lt;br /&gt;
 ==12598==    by 0x8AC8E40: send_bytes (oob_tcp_sendrecv.c:84)&lt;br /&gt;
 ==12598==    by 0x8AC9471: mca_oob_tcp_send_handler (oob_tcp_sendrecv.c:205)&lt;br /&gt;
 ==12598==    by 0x616FA23: opal_libevent2021_event_base_loop (in /opt/sharcnet/openmpi/1.8.1/gcc-debug/lib/libopen-pal.so.6.1.1)&lt;br /&gt;
 ==12598==    by 0x5B7E78D: orte_progress_thread_engine (ess_base_std_app.c:456)&lt;br /&gt;
 ==12598==    by 0x538A9D0: start_thread (in /lib64/libpthread-2.12.so)&lt;br /&gt;
 ==12598==    by 0x8AB86FF: ???&lt;br /&gt;
&lt;br /&gt;
We know this isn't an issue with ''bug.c'' as the backtrace shows it is occurring in a pure OpenMPI thread (the backtrace starts with ''start_thread'' and all subsequent routines are not from ''bug.c'').  Skipping over these we now see Valgrind is picking up on sending the uninitialized value&lt;br /&gt;
&lt;br /&gt;
 ==12599== Uninitialised byte(s) found during client check request&lt;br /&gt;
 ==12599==    at 0x4E3641D: check_mem_is_defined_untyped (libmpiwrap.c:952)&lt;br /&gt;
 ==12599==    by 0x4E5BBC5: generic_Isend (libmpiwrap.c:908)&lt;br /&gt;
 ==12599==    by 0x4E5BEE9: PMPI_Isend (libmpiwrap.c:1393)&lt;br /&gt;
 ==12599==    by 0x400B02: main (bug.c:22)&lt;br /&gt;
 ==12599==  Address 0x7fefff5c4 is on thread 1's stack&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' If we want to avoid recompiling our program, we can also preload the ''mpiwrap-amd64-linux'' library instead of linking against it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpicc -Wall -g bug.c -o bug&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;$(which mpirun | sed -e 's|/bin/.*$|/lib|')${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}&amp;quot; \&lt;br /&gt;
LD_PRELOAD=/usr/lib64/valgrind/libmpiwrap-amd64-linux.so mpirun -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Breaking out output by rank ===&lt;br /&gt;
&lt;br /&gt;
By default the Valgrind output from all the MPI ranks gets intermingled together on stderr.  Although they can be distinguished for the most part as each line is prefixed with the process number, it is frequently nice to write them out to individual files.  This can be done by using the ''mpirun'' &amp;lt;tt&amp;gt;--output-filename &amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt; option.  It captures the output of each rank to ''&amp;lt;filename&amp;gt;'' suffixed with the ''MPI_COMM_WORLD'' rank&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun --output-filename bug.log -np 2 valgrind ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To redirect just the Valgrind output we need to use the Valgrind &amp;lt;tt&amp;gt;--log-file=&amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt; option with the special &amp;lt;tt&amp;gt;%q{&amp;lt;environment-variable&amp;gt;}&amp;lt;/tt&amp;gt; syntax&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np 2 valgrind --log-file=bug.log-%q{OMPI_COMM_WORLD_RANK} ./bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both of the above can also be done by wrapping the Valgrind call with Bash to perform redirection and/or environment variable expansion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np 2 /bin/bash -c 'exec valgrind ./bug &amp;gt; bug.log-$OMPI_COMM_WORLD_RANK 2&amp;gt;&amp;amp;1'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np 2 /bin/bash -c 'exec valgrind --log-file=bug.log-$OMPI_COMM_WORLD_RANK ./bug'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Advanced Functionality ===&lt;br /&gt;
&lt;br /&gt;
Now, if on top of this, we also bring in the valgrind enabled openmpi debug library (i.e., the ''debug'' version of our ''openmpi'' module), things get really sweet&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module unload gcc openmpi&lt;br /&gt;
module load gcc/4.8.2 openmpi/gcc-debug/1.8.3&lt;br /&gt;
mpicc -Wall -g bug.c -L/usr/lib64/valgrind -lmpiwrap-amd64-linux -Xlinker -rpath=/usr/lib64/valgrind -o bug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now all the bugs in the code are detected and reported&lt;br /&gt;
&lt;br /&gt;
 ==27774== Uninitialised byte(s) found during client check request&lt;br /&gt;
 ==27774==    at 0x4E3641D: check_mem_is_defined_untyped (libmpiwrap.c:952)&lt;br /&gt;
 ==27774==    by 0x4E5BBC5: generic_Isend (libmpiwrap.c:908)&lt;br /&gt;
 ==27774==    by 0x4E5BEE9: PMPI_Isend (libmpiwrap.c:1393)&lt;br /&gt;
 ==27774==    by 0x402713: main (bug.c:22)&lt;br /&gt;
 ==27774==  Address 0x7fefff6f4 is on thread 1's stack&lt;br /&gt;
 &lt;br /&gt;
 ==27773== Invalid write of size 4&lt;br /&gt;
 ==27773==    at 0x4026A0: main (bug.c:16)&lt;br /&gt;
 ==27773==  Address 0x7fefff6f4 is on thread 1's stack&lt;br /&gt;
 &lt;br /&gt;
 ==27774== Invalid write of size 4&lt;br /&gt;
 ==27774==    at 0x40271B: main (bug.c:23)&lt;br /&gt;
 ==27774==  Address 0x7fefff6f4 is on thread 1's stack&lt;br /&gt;
&lt;br /&gt;
=== Suppression File ===&lt;br /&gt;
&lt;br /&gt;
There is also a valgrind suppression option &amp;lt;tt&amp;gt;--suppressions=&amp;quot;$(which mpirun | sed -e 's|/bin/.*|/share/openmpi/openmpi-valgrind.supp|')&amp;quot;&amp;lt;/tt&amp;gt;.  We have not observed any cases where this makes a difference yet though.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Valgrind Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.valgrind.org&lt;br /&gt;
&lt;br /&gt;
o Valgrind's Tool Suite&amp;lt;br&amp;gt;&lt;br /&gt;
http://valgrind.org/info/tools.html&lt;br /&gt;
&lt;br /&gt;
o kcachegrind (sharcnet does not have)&amp;lt;br&amp;gt;&lt;br /&gt;
http://kcachegrind.sourceforge.net/html/Download.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Software packages]]&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Volume.right_menu.where_is_manage_attachments.PNG&amp;diff=15303</id>
		<title>File:Volume.right menu.where is manage attachments.PNG</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Volume.right_menu.where_is_manage_attachments.PNG&amp;diff=15303"/>
				<updated>2017-06-27T15:41:34Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Manage_volume_dialog.PNG&amp;diff=15301</id>
		<title>File:Manage volume dialog.PNG</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Manage_volume_dialog.PNG&amp;diff=15301"/>
				<updated>2017-06-27T15:28:11Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Volume.where.PNG&amp;diff=15299</id>
		<title>File:Volume.where.PNG</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Volume.where.PNG&amp;diff=15299"/>
				<updated>2017-06-27T15:22:55Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=File:Volume.right_menu.PNG&amp;diff=15294</id>
		<title>File:Volume.right menu.PNG</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=File:Volume.right_menu.PNG&amp;diff=15294"/>
				<updated>2017-06-27T15:11:06Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: The right hand side menu of the volumes page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The right hand side menu of the volumes page.&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=14173</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=14173"/>
				<updated>2016-08-30T14:17:55Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--checked2016--&amp;gt;&lt;br /&gt;
{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, to load the default Octave module (currently version 3.8.1) one would do:&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters for production work Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
This section shows howto submit a  [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts  [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat sample.m &lt;br /&gt;
#! /bin/octave -qf&lt;br /&gt;
printf (&amp;quot;%s&amp;quot;, program_name ());&lt;br /&gt;
arg_list = argv ();&lt;br /&gt;
for i = 1:nargin&lt;br /&gt;
    printf (&amp;quot; %s&amp;quot;, arg_list{i});&lt;br /&gt;
endfor&lt;br /&gt;
printf (&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To eliminate exatraneous verbosity in the output file two switches are passed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc&lt;br /&gt;
WARNING: no memory requirement defined; assuming 2GB per process.&lt;br /&gt;
submitted as jobid 6937872&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file from the job appears as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50&lt;br /&gt;
sample.m arg1 arg2 arg3 etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Running in the development nodes=&lt;br /&gt;
&lt;br /&gt;
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.&lt;br /&gt;
&lt;br /&gt;
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:&lt;br /&gt;
&lt;br /&gt;
 ssh -Y username@kraken.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
Then login to one of the development nodes with trusted X11 forwarding enabled:&lt;br /&gt;
&lt;br /&gt;
 ssh -Y kraken-devel1&lt;br /&gt;
&lt;br /&gt;
Once logged into the development node one can load the Octave modules and launch the program:&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave&lt;br /&gt;
 octave&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 GNU Octave, version 3.8.1&lt;br /&gt;
 Copyright (C) 2014 John W. Eaton and others.&lt;br /&gt;
 This is free software; see the source code for copying conditions.&lt;br /&gt;
 There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or&lt;br /&gt;
 FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.&lt;br /&gt;
&lt;br /&gt;
 Octave was configured for &amp;quot;x86_64-unknown-linux-gnu&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 Additional information about Octave is available at http://www.octave.org.&lt;br /&gt;
&lt;br /&gt;
 Please contribute if you find this software useful.&lt;br /&gt;
 For more information, visit http://www.octave.org/get-involved.html&lt;br /&gt;
&lt;br /&gt;
 Read http://www.octave.org/bugs.html to learn how to submit bug reports.&lt;br /&gt;
 For information about changes from previous versions, type 'news'.&lt;br /&gt;
&lt;br /&gt;
 octave:1&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.&lt;br /&gt;
&lt;br /&gt;
=Running on a visualization system=&lt;br /&gt;
&lt;br /&gt;
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu &amp;gt; Eduction &amp;gt; GNU Octave.&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave --traditional mycode.m&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system.  Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).&lt;br /&gt;
&lt;br /&gt;
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature).  Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.&lt;br /&gt;
&lt;br /&gt;
===Sharing Packages===&lt;br /&gt;
&lt;br /&gt;
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users.  To do this simply set access permissions for group or global read access accordingly. For details on how to change &lt;br /&gt;
the permissions see:   https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F&lt;br /&gt;
&lt;br /&gt;
===Managing Packages===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===Package Commands===&lt;br /&gt;
&lt;br /&gt;
Additional examples of package commands are shown in this section.  For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Package Example===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MPIBLAST&amp;diff=13263</id>
		<title>MPIBLAST</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MPIBLAST&amp;diff=13263"/>
				<updated>2016-03-01T16:03:48Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MPIBLAST&lt;br /&gt;
|package_description=Parallel implementation of NCBI BLAST&lt;br /&gt;
|package_idnumber=55}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The mpiblast module must be manually loaded before submitting any mpiblast jobs.  Two examples below &lt;br /&gt;
demonstrate how to setup and submit jobs to the mpi queue.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
===All Clusters (except Guppy)===&lt;br /&gt;
&lt;br /&gt;
 module unload openmpi intel&lt;br /&gt;
 module load intel/12.1.3 openmpi/intel/1.6.2 mpiblast/1.6.0&lt;br /&gt;
&lt;br /&gt;
===Guppy Only===&lt;br /&gt;
&lt;br /&gt;
 module unload openmpi intel&lt;br /&gt;
 module load intel/11.0.083 openmpi/intel/1.4.2 mpiblast/1.6.0&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 15m -n 24 -q mpi --mpp=3g -o ofile%J mpiblast etc&lt;br /&gt;
&lt;br /&gt;
where the number of cores n=24 is arbitrary.&lt;br /&gt;
&lt;br /&gt;
=Example Jobs=&lt;br /&gt;
&lt;br /&gt;
==DROSOPH==&lt;br /&gt;
&lt;br /&gt;
Copy sample problem files (fasta database and input) from the /opt/sharcnet &amp;lt;i&amp;gt;examples&amp;lt;/i&amp;gt; directory a directory under work as shown here.  The fasta database used in this example can be obtained as a guest  from NCBI here http://www.ncbi.nlm.nih.gov/guide/all/#downloads_  then clicking &amp;quot;FTP: FASTA BLAST Databases&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /work/$USER/samples/mpiblast/test1&lt;br /&gt;
rm /work/$USER/samples/mpiblast/test1/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test1&lt;br /&gt;
cp /opt/sharcnet/mpiblast/1.6.0/examples/drosoph.in drosoph.in&lt;br /&gt;
gunzip -c /opt/sharcnet/mpiblast/1.6.0/examples/drosoph.nt.gz &amp;gt; drosoph.nt.$USER&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a hidden configuration file using a text editor (such as vi) to define a Shared storage location between nodes and a Local storage directory available on each compute node as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:/work/$USER/samples/mpiblast/test1] vi .ncbirc&lt;br /&gt;
[NCBI]&lt;br /&gt;
Data=/opt/sharcnet/mpiblast/1.6.0/ncbi/data&lt;br /&gt;
[BLAST]&lt;br /&gt;
BLASTDB=/scratch/YourSharcnetUsername/mpiblasttest1&lt;br /&gt;
BLASTMAT=/work/YourSharcnetUsername/samples/mpiblast/test1&lt;br /&gt;
[mpiBLAST]&lt;br /&gt;
Shared=/scratch/YourSharcnetUsername/mpiblasttest1&lt;br /&gt;
Local=/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Partition the database into 8 fragments into &amp;lt;i&amp;gt;/scratch/$USER/mpiblasttest1&amp;lt;/i&amp;gt; where they will be searched for when running a job in queue according to the &amp;lt;i&amp;gt;.ncbirc&amp;lt;/i&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load mpiblast/1.6.0&lt;br /&gt;
mkdir /scratch/roberpj/mpiblasttest1&lt;br /&gt;
rm -f /scratch/$USER/mpiblasttest1/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test1&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd20:/work/$USER/samples/mpiblast/test1] mpiformatdb -N 8 -i drosoph.nt.$USER -o T -p F -n /scratch/$USER/mpiblasttest1&lt;br /&gt;
Reading input file&lt;br /&gt;
Done, read 1534943 lines&lt;br /&gt;
Breaking drosoph.nt into 8 fragments&lt;br /&gt;
Executing: formatdb -p F -i drosoph.nt -N 8 -n /scratch/roberpj/mpiblasttest1/drosoph.nt -o T &lt;br /&gt;
Created 8 fragments.&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt; Please make sure the formatted database fragments are placed in /scratch/roberpj/mpiblasttest1/ before executing mpiblast. &amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd20:/scratch/roberpj/mpiblasttest1] ls&lt;br /&gt;
drosoph.nt.000.nhr  drosoph.nt.002.nin  drosoph.nt.004.nnd  drosoph.nt.006.nni&lt;br /&gt;
drosoph.nt.000.nin  drosoph.nt.002.nnd  drosoph.nt.004.nni  drosoph.nt.006.nsd&lt;br /&gt;
drosoph.nt.000.nnd  drosoph.nt.002.nni  drosoph.nt.004.nsd  drosoph.nt.006.nsi&lt;br /&gt;
drosoph.nt.000.nni  drosoph.nt.002.nsd  drosoph.nt.004.nsi  drosoph.nt.006.nsq&lt;br /&gt;
drosoph.nt.000.nsd  drosoph.nt.002.nsi  drosoph.nt.004.nsq  drosoph.nt.007.nhr&lt;br /&gt;
drosoph.nt.000.nsi  drosoph.nt.002.nsq  drosoph.nt.005.nhr  drosoph.nt.007.nin&lt;br /&gt;
drosoph.nt.000.nsq  drosoph.nt.003.nhr  drosoph.nt.005.nin  drosoph.nt.007.nnd&lt;br /&gt;
drosoph.nt.001.nhr  drosoph.nt.003.nin  drosoph.nt.005.nnd  drosoph.nt.007.nni&lt;br /&gt;
drosoph.nt.001.nin  drosoph.nt.003.nnd  drosoph.nt.005.nni  drosoph.nt.007.nsd&lt;br /&gt;
drosoph.nt.001.nnd  drosoph.nt.003.nni  drosoph.nt.005.nsd  drosoph.nt.007.nsi&lt;br /&gt;
drosoph.nt.001.nni  drosoph.nt.003.nsd  drosoph.nt.005.nsi  drosoph.nt.007.nsq&lt;br /&gt;
drosoph.nt.001.nsd  drosoph.nt.003.nsi  drosoph.nt.005.nsq  drosoph.nt.dbs&lt;br /&gt;
drosoph.nt.001.nsi  drosoph.nt.003.nsq  drosoph.nt.006.nhr  drosoph.nt.mbf&lt;br /&gt;
drosoph.nt.001.nsq  drosoph.nt.004.nhr  drosoph.nt.006.nin  drosoph.nt.nal&lt;br /&gt;
drosoph.nt.002.nhr  drosoph.nt.004.nin  drosoph.nt.006.nnd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Submit a short job with a 15m time limit on n=16 cores calculate by taking N=8 fragments + 8.  If all goes well output results will be written to &amp;lt;i&amp;gt;drosoph.out&amp;lt;/i&amp;gt; and the execution time will appear in ofile%J where %J is the job number:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:/work/$USER/samples/mpiblast/test1]&lt;br /&gt;
sqsub -r 15m -n 106 -q mpi --mpp=1G -o ofile%J mpiblast -d drosoph.nt.$USER -i drosoph.in&lt;br /&gt;
    -p blastn -o drosoph.out --use-parallel-write --use-virtual-frags&lt;br /&gt;
submitted as jobid 6966896&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd20:/work/roberpj/samples/mpiblast/test1] cat ofile6966896.hnd50 &lt;br /&gt;
Total Execution Time: 1.80031&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When submitting a mpiblast job on a cluster such as goblin that doesnt have an inifiniband interconnect better performance (at least double speedup) will be achieved running the mpi job on one compute node.  For regular users of non-contributed hardware typically specify &amp;quot;-n 8&amp;quot; to reflect the max number of cores on a single node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 15m -n 8 -N 1 -q mpi --mpp=4G -o ofile%J mpiblast -d drosoph.nt -i drosoph.in&lt;br /&gt;
           -p blastn -o drosoph.out --use-parallel-write --use-virtual-frags&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample output results computed previously with BLASTN 2.2.15 [Oct-15-2006] are included in &amp;lt;i&amp;gt;/opt/sharcnet/mpiblast/1.6.0/examples/ROSOPH.out&amp;lt;/i&amp;gt; to compare your newly generated &amp;lt;i&amp;gt;drosoph.out&amp;lt;/i&amp;gt; file with.&lt;br /&gt;
&lt;br /&gt;
==UNIGENE==&lt;br /&gt;
&lt;br /&gt;
The main purpose of this example is to illustrate some additional options and switchs that maybe useful for debugging and for dealing with larger databases as described in official detail at http://www.mpiblast.org/Docs/Guide.  The fasta database used in this example can also be downloaded from http://www.ncbi.nlm.nih.gov/guide/all/#downloads_ as a guest by clicking &amp;quot;FTP: UniGene&amp;quot; then entering the &amp;quot;Homo_sapiens&amp;quot; sub-directory.  More information about UniGene alignments can be found at https://cgwb.nci.nih.gov/cgi-bin/hgTrackUi?hgsid=95443&amp;amp;c=chr1&amp;amp;g=uniGene_3 .  As with Example1 above, for convenience all required files can simply be copied from the /opt/sharcnet &amp;lt;i&amp;gt;examples&amp;lt;/i&amp;gt; subdirectory to work as shown here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /work/$USER/samples/mpiblast/test2&lt;br /&gt;
rm -f /work/$USER/samples/mpiblast/test2/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test2&lt;br /&gt;
cp /opt/sharcnet/mpiblast/1.6.0/examples/il2ra.in il2ra.in&lt;br /&gt;
gunzip -c /opt/sharcnet/mpiblast/1.6.0/examples/Hs.seq.uniq.gz &amp;gt; Hs.seq.$USER&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login2:/work/roberpj/samples/mpiblast/test2] ls&lt;br /&gt;
Hs.seq.roberpj  il2ra.in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a hidden configuration file using a text editor (such as vi) to define a Shared storage location between nodes and a Local storage directory available on each compute node as followw.  Note that the ncbi/data directory is not used in this example and hence can be omitted.  If the Local and Shared directories are the same replace &amp;lt;b&amp;gt;--copy-via=mpi&amp;lt;/b&amp;gt; with &amp;lt;b&amp;gt;--copy-via=none&amp;lt;/b&amp;gt; as will be demonstrated in the below sqsub commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[username@orc-login1:/work/$USER/samples/mpiblast/test2] vi .ncbirc&lt;br /&gt;
[NCBI]&lt;br /&gt;
Data=/opt/sharcnet/mpiblast/1.6.0/ncbi/data&lt;br /&gt;
[BLAST]&lt;br /&gt;
BLASTDB=/work/YourSharcnetUsername/mpiblasttest2&lt;br /&gt;
BLASTMAT=/work/YourSharcnetUsername/samples/mpiblast/test2&lt;br /&gt;
[mpiBLAST]&lt;br /&gt;
Shared=/work/YourSharcnetUsername/mpiblasttest2&lt;br /&gt;
Local=/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again partition the database into 8 fragments into &amp;lt;i&amp;gt;/work/$USER/mpiblasttest2&amp;lt;/i&amp;gt; where they will be searched for when a job runs in the queue according to the &amp;lt;i&amp;gt;.ncbirc&amp;lt;/i&amp;gt; file, first removing previous partitioning if any such files exist.  For this example assume $USER=roberpj however be sure to replace with your username!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load mpiblast/1.6.0&lt;br /&gt;
mkdir -p /work/$USER/mpiblasttest2&lt;br /&gt;
rm -f /work/$USER/mpiblasttest2/*&lt;br /&gt;
cd /work/$USER/samples/mpiblast/test2&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login1:/work/roberpj/samples/mpiblast/test2] mpiformatdb -N 8 -i Hs.seq.$USER -o T -p F -n /work/roberpj/mpiblasttest2&lt;br /&gt;
Reading input file&lt;br /&gt;
Done, read 2348651 lines&lt;br /&gt;
Breaking Hs.seq.roberpj into 8 fragments&lt;br /&gt;
Executing: formatdb -p F -i Hs.seq.roberpj -N 8 -n /work/roberpj/mpiblasttest2/Hs.seq.roberpj -o T &lt;br /&gt;
Created 8 fragments.&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt; Please make sure the formatted database fragments are placed in /work/roberpj/mpiblasttest2/ before executing mpiblast. &amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login1:/work/roberpj/samples/mpiblast/test1] ls&lt;br /&gt;
formatdb.log  Hs.seq.roberpj  il2ra.in&lt;br /&gt;
&lt;br /&gt;
[roberpj@orc-login1:/work/roberpj/mpiblasttest2] ls&lt;br /&gt;
Hs.seq.roberpj.000.nhr  Hs.seq.roberpj.002.nin  Hs.seq.roberpj.004.nnd  Hs.seq.roberpj.006.nni&lt;br /&gt;
Hs.seq.roberpj.000.nin  Hs.seq.roberpj.002.nnd  Hs.seq.roberpj.004.nni  Hs.seq.roberpj.006.nsd&lt;br /&gt;
Hs.seq.roberpj.000.nnd  Hs.seq.roberpj.002.nni  Hs.seq.roberpj.004.nsd  Hs.seq.roberpj.006.nsi&lt;br /&gt;
Hs.seq.roberpj.000.nni  Hs.seq.roberpj.002.nsd  Hs.seq.roberpj.004.nsi  Hs.seq.roberpj.006.nsq&lt;br /&gt;
Hs.seq.roberpj.000.nsd  Hs.seq.roberpj.002.nsi  Hs.seq.roberpj.004.nsq  Hs.seq.roberpj.007.nhr&lt;br /&gt;
Hs.seq.roberpj.000.nsi  Hs.seq.roberpj.002.nsq  Hs.seq.roberpj.005.nhr  Hs.seq.roberpj.007.nin&lt;br /&gt;
Hs.seq.roberpj.000.nsq  Hs.seq.roberpj.003.nhr  Hs.seq.roberpj.005.nin  Hs.seq.roberpj.007.nnd&lt;br /&gt;
Hs.seq.roberpj.001.nhr  Hs.seq.roberpj.003.nin  Hs.seq.roberpj.005.nnd  Hs.seq.roberpj.007.nni&lt;br /&gt;
Hs.seq.roberpj.001.nin  Hs.seq.roberpj.003.nnd  Hs.seq.roberpj.005.nni  Hs.seq.roberpj.007.nsd&lt;br /&gt;
Hs.seq.roberpj.001.nnd  Hs.seq.roberpj.003.nni  Hs.seq.roberpj.005.nsd  Hs.seq.roberpj.007.nsi&lt;br /&gt;
Hs.seq.roberpj.001.nni  Hs.seq.roberpj.003.nsd  Hs.seq.roberpj.005.nsi  Hs.seq.roberpj.007.nsq&lt;br /&gt;
Hs.seq.roberpj.001.nsd  Hs.seq.roberpj.003.nsi  Hs.seq.roberpj.005.nsq  Hs.seq.roberpj.dbs&lt;br /&gt;
Hs.seq.roberpj.001.nsi  Hs.seq.roberpj.003.nsq  Hs.seq.roberpj.006.nhr  Hs.seq.roberpj.mbf&lt;br /&gt;
Hs.seq.roberpj.001.nsq  Hs.seq.roberpj.004.nhr  Hs.seq.roberpj.006.nin  Hs.seq.roberpj.nal&lt;br /&gt;
Hs.seq.roberpj.002.nhr  Hs.seq.roberpj.004.nin  Hs.seq.roberpj.006.nnd   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Submit a couple of short jobs 15m time limit.  If all goes well output results will be written to &amp;lt;i&amp;gt;biobrewA.out&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;biobrewB.out&amp;lt;/i&amp;gt; and the execution time appear in corresponding ofile%J's where %J is the job number as per usual.  In these examples we will submit the job from a saw specific directory which can be copied from test2 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@saw-login1:~] module load mpiblast/1.6.0&lt;br /&gt;
[roberpj@saw-login1:~] cd /work/roberpj/samples/mpiblast&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast] cp -a test2 test2.saw&lt;br /&gt;
&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw] vi .ncbirc&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw] cat .ncbirc | grep BLASTMAT&lt;br /&gt;
BLASTMAT=/work/roberpj/samples/mpiblast/test2.saw&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A) Submit job with profile time option choosing n=24 (8 fragments + 8 or greater):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw] rm -f oTime*;&lt;br /&gt;
    sqsub -r 15m -n 24 -q mpi -o ofile%J mpiblast  --use-parallel-write --copy-via=mpi&lt;br /&gt;
       -d Hs.seq.roberpj -i il2ra.in -p blastn -o biobrew.out --time-profile=oTime&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
B) Usage of the debug option again choosing n=16 (8 fragments + 8 or greater):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@saw-login1:/work/roberpj/samples/mpiblast/test2.saw]  rm -f oLog*;&lt;br /&gt;
    sqsub -r 15m -n 16 -q mpi -o ofile%J mpiblast --use-parallel-write --copy-via=none&lt;br /&gt;
        -d Hs.seq.$USER -i il2ra.in -p blastn -o biobrew.out --debug=oLog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally compare &amp;lt;i&amp;gt;/opt/sharcnet/mpiblast/1.6.0/examples/BIOBREW.out&amp;lt;/i&amp;gt; computed previously with BLASTN 2.2.15 [Oct-15-2006] with your newly generated &amp;lt;i&amp;gt;biobrew.out&amp;lt;/i&amp;gt; output file to verify the results and submit a ticket if there are any problems!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;SUPPORTED PROGRAMS IN MPIBLAST&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As described in http://www.mpiblast.org/Docs/FAQ mpiblast supports the standard blast programs http://www.ncbi.nlm.nih.gov/BLAST/blast_program.shtml which are reproduced here for reference:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blastp:     Compares an amino acid query sequence against a protein sequence database.&lt;br /&gt;
blastn:     Compares a nucleotide query sequence against a nucleotide sequence database.&lt;br /&gt;
blastx:     Compares a nucleotide query sequence translated in all reading frames against&lt;br /&gt;
            a protein sequence database.&lt;br /&gt;
tblastn:    Compares a protein query sequence against a nucleotide sequence database&lt;br /&gt;
            dynamically translated in all reading frames.&lt;br /&gt;
tblastx:    Compares the six-frame translations of a nucleotide query sequence against&lt;br /&gt;
            the six-frame translations of a nucleotide sequence database.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;MPIBLAST BINARIES OPTIONS&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:/opt/sharcnet/mpiblast/1.6.0/bin] ./mpiblast -help&lt;br /&gt;
mpiBLAST requires the following options: -d [database] -i [query file] -p [blast program name]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:/opt/sharcnet/mpiblast/1.6.0/bin] ./mpiformatdb --help&lt;br /&gt;
Executing: formatdb - &lt;br /&gt;
&lt;br /&gt;
formatdb 2.2.20   arguments:&lt;br /&gt;
&lt;br /&gt;
  -t  Title for database file [String]  Optional&lt;br /&gt;
  -i  Input file(s) for formatting [File In]  Optional&lt;br /&gt;
  -l  Logfile name: [File Out]  Optional&lt;br /&gt;
    default = formatdb.log&lt;br /&gt;
  -p  Type of file&lt;br /&gt;
         T - protein   &lt;br /&gt;
         F - nucleotide [T/F]  Optional&lt;br /&gt;
    default = T&lt;br /&gt;
  -o  Parse options&lt;br /&gt;
         T - True: Parse SeqId and create indexes.&lt;br /&gt;
         F - False: Do not parse SeqId. Do not create indexes.&lt;br /&gt;
 [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -a  Input file is database in ASN.1 format (otherwise FASTA is expected)&lt;br /&gt;
         T - True, &lt;br /&gt;
         F - False.&lt;br /&gt;
 [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -b  ASN.1 database in binary mode&lt;br /&gt;
         T - binary, &lt;br /&gt;
         F - text mode.&lt;br /&gt;
 [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -e  Input is a Seq-entry [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -n  Base name for BLAST files [String]  Optional&lt;br /&gt;
  -v  Database volume size in millions of letters [Integer]  Optional&lt;br /&gt;
    default = 4000&lt;br /&gt;
  -s  Create indexes limited only to accessions - sparse [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -V  Verbose: check for non-unique string ids in the database [T/F]  Optional&lt;br /&gt;
    default = F&lt;br /&gt;
  -L  Create an alias file with this name&lt;br /&gt;
        use the gifile arg (below) if set to calculate db size&lt;br /&gt;
        use the BLAST db specified with -i (above) [File Out]  Optional&lt;br /&gt;
  -F  Gifile (file containing list of gi's) [File In]  Optional&lt;br /&gt;
  -B  Binary Gifile produced from the Gifile specified above [File Out]  Optional&lt;br /&gt;
  -T  Taxid file to set the taxonomy ids in ASN.1 deflines [File In]  Optional&lt;br /&gt;
  -N  Number of database volumes [Integer]  Optional&lt;br /&gt;
    default = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General Notes=&lt;br /&gt;
&lt;br /&gt;
==Issue1: Jobs Fail to Start==&lt;br /&gt;
&lt;br /&gt;
If the following error message occurs it maybe necessary to stop all mpiblast jobs you are running on the cluster and clear&lt;br /&gt;
out all the files from /tmp then submit your job again.  In the case of Example2 above the following steps work to resolve the problem, where the nodes used from the last run job were red[7-14].  Should there be any questions please open a problem ticket.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Purging Job Node Subset (redfin)&lt;br /&gt;
 pdsh -w red[7-14] ls /tmp/Hs*     (confirm existence of file from previous runs)&lt;br /&gt;
 pdsh -w red[7-14] rm -f /tmp/Hs*&lt;br /&gt;
 pdsh -w red[7-14] ls /tmp/Hs*     (confirm all files from previous runs removed)&lt;br /&gt;
&lt;br /&gt;
Purging Full Cluster (hound)&lt;br /&gt;
pdsh -w hnd[1-18] -f 4 rm -f /tmp/Hs*&lt;br /&gt;
pdsh -w hnd[1-18] -f 4 ls /tmp/Hs*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@red-admin:/work/roberpj/samples/mpiblast/test2.red4] cat ofile489214.red-admin.redfin.sharcnet&lt;br /&gt;
8       0.577904        Bailing out with signal 11&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
MPI_ABORT was invoked on rank 8 in communicator MPI_COMM_WORLD&lt;br /&gt;
with errorcode 0.&lt;br /&gt;
&lt;br /&gt;
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.&lt;br /&gt;
You may or may not see output from other processes, depending on&lt;br /&gt;
exactly when Open MPI kills them.&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
20      0.577719        Bailing out with signal 11&lt;br /&gt;
0       0.591128        Bailing out with signal 15&lt;br /&gt;
[red14:09194] [[36424,0],0]-[[36424,1],0] mca_oob_tcp_msg_recv: readv failed: Connection reset by peer (104)&lt;br /&gt;
1       0.591327        Bailing out with signal 15&lt;br /&gt;
etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Issue2: Jobs Run for a While then Die==&lt;br /&gt;
&lt;br /&gt;
The solution here is to filter the input sequence file. For reasons yet understood the presence of repeat sections results in many thousands of WARNING and ERROR messages rapidly written to the &amp;quot;sqsub -o ofile&amp;quot; output file presumably as mpiblast ignores sequences before eventually diing after several hours, or possibly days.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat  ofile1635556.saw-admin.saw.sharcnet | grep &amp;quot;WARNING\|ERROR&amp;quot; | wc -l&lt;br /&gt;
10560&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat ofile1635556.saw-admin.saw.sharcnet&lt;br /&gt;
Selenocysteine (U) at position 60 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 42 replaced by X&lt;br /&gt;
[blastall] WARNING:  [000.000]  NODE_84_length_162_cov_46.259258_1_192_-: SetUpBlastSearch failed.&lt;br /&gt;
[blastall] ERROR:  [000.000]  NODE_84_length_162_cov_46.259258_1_192_-: BLASTSetUpSearch: Unable to calculate Karlin-Altschul params, check query sequence&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt;&amp;lt; snipped out ~10000 similar WARNING and ERROR messages from this example &amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
[blastall] WARNING:  [000.000]  NODE_65409_length_87_cov_2.367816_1_77_+: SetUpBlastSearch failed.&lt;br /&gt;
[blastall] ERROR:  [000.000]  NODE_65409_length_87_cov_2.367816_1_77_+: BLASTSetUpSearch: Unable to calculate Karlin-Altschul params, check query sequence&lt;br /&gt;
Selenocysteine (U) at position 61 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 62 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 34 replaced by X&lt;br /&gt;
Selenocysteine (U) at position 1058 replaced by X&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
mpirun noticed that process rank 52 with PID 30067 on node saw214 exited on signal 9 (Killed).&lt;br /&gt;
--------------------------------------------------------------------------&lt;br /&gt;
1618    17      651     62909.3 Bailing out with signal 15&lt;br /&gt;
14      3       62909.3 Bailing out with signal 15&lt;br /&gt;
19      15      62909.3 Bailing out with signal 1536    5       7       62909.312       62909.310       62909.3 Bailing out with signal 1547    21      62909.3 Bailing out with signal 159  62909.3 Bailing out with signal 15&lt;br /&gt;
45      62909.3 Bailing out with signal 1525    62909.3 Bailing out with signal 158     62909.3 Bailing out with signal 15&lt;br /&gt;
50      62909.3 Bailing out with signal 1522    62909.3 Bailing out with signal 15&lt;br /&gt;
11      62909.3 Bailing out with signal 15&lt;br /&gt;
48      62909.323       62909.3 Bailing out with signal 15&lt;br /&gt;
        Bailing out with signal 15&lt;br /&gt;
46      62909.3 Bailing out with signal 15&lt;br /&gt;
etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o MPIBLAST Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.mpiblast.org/&lt;br /&gt;
&lt;br /&gt;
o MPIBLAST Version History&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.mpiblast.org/Downloads/Version-History&lt;br /&gt;
&lt;br /&gt;
[[Category:Bioinformatics]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--checked2016--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=Category:Decommissioned_Systems&amp;diff=13261</id>
		<title>Category:Decommissioned Systems</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=Category:Decommissioned_Systems&amp;diff=13261"/>
				<updated>2016-03-01T16:00:19Z</updated>
		
		<summary type="html">&lt;p&gt;Edward: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Edward</name></author>	</entry>

	</feed>