[Swift-commit] r8429 - in www/Swift-T: . downloads

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Tue Apr 21 10:49:57 CDT 2015


Author: wozniak
Date: 2015-04-21 10:49:56 -0500 (Tue, 21 Apr 2015)
New Revision: 8429

Modified:
   www/Swift-T/downloads/examples.tar.gz
   www/Swift-T/leaf.html
Log:
Improved leaf function examples


Modified: www/Swift-T/downloads/examples.tar.gz
===================================================================
(Binary files differ)

Modified: www/Swift-T/leaf.html
===================================================================
--- www/Swift-T/leaf.html	2015-04-06 16:48:35 UTC (rev 8428)
+++ www/Swift-T/leaf.html	2015-04-21 15:49:56 UTC (rev 8429)
@@ -1563,6 +1563,8 @@
 <pre><code>genleaf -vv main.c main.h test-main.swift
 swift-t -r $PWD user-code.swift</code></pre>
 </div></div>
+<div class="paragraph"><p>Thus, <code>main_leaf.c</code> is generated by <code>genleaf</code>, creating an easy-to-use
+interface for Swift.</p></div>
 </div>
 <div class="sect2">
 <h3 id="_complete_example_6_calling_fortran_with_code_argc_argv_code">3.6. Complete example 6: Calling Fortran with <code>argc/argv</code></h3>
@@ -1573,7 +1575,7 @@
 removing its "open code" and exposing a function that accepts an array
 of strings instead of using Fortran builtins
 <code>command_argument_count()</code> and <code>get_command_argument()</code>.</p></div>
-<div class="paragraph"><p>Consider the Fortran function <code>func()</code> (<code>func.f90</code>):</p></div>
+<div class="paragraph"><p>Assume you wish to call the Fortran function <code>func()</code> (<code>func.f90</code>):</p></div>
 <div class="listingblock">
 <div class="content">
 <pre><code>  subroutine func(argc, argv, output)
@@ -1586,7 +1588,7 @@
 </div></div>
 <div class="paragraph"><p>The <code>argc/argv</code> is stored in a <code>string_array</code>, defined in the top of
 <code>func.f90</code>.</p></div>
-<div class="paragraph"><p>This data structure is constructed and filled by the program
+<div class="paragraph"><p>This data structure is constructed and filled by the test program
 <code>prog-f90.f90</code> as follows:</p></div>
 <div class="listingblock">
 <div class="content">
@@ -1598,8 +1600,9 @@
    call string_array_set(argv, i, tmp)
 end do</code></pre>
 </div></div>
-<div class="paragraph"><p>To call this function from Swift, follow the <code>Makefile</code>.  (You may
-need to set the Tcl directory.)</p></div>
+<div class="paragraph"><p>To call this function from Swift, run <code>./build.sh</code>.  (You need to set
+the Tcl installation directory in <code>build.sh</code>.)</p></div>
+<div class="paragraph"><p>The <code>Makefile</code> proceeds as follows:</p></div>
 <div class="olist arabic"><ol class="arabic">
 <li>
 <p>
@@ -1625,29 +1628,31 @@
 from Swift and create an output buffer for the output double.
 </p>
 </li>
-<li>
-<p>
-We call the function from Swift using the simple syntax:
-</p>
+</ol></div>
+<div class="paragraph"><p>After the build, you can run the C++ or Fortran test programs to see
+how they work:</p></div>
 <div class="listingblock">
 <div class="content">
+<pre><code>./prog-f90 a b c
+...
+./prog-cxx a b c</code></pre>
+</div></div>
+<div class="paragraph"><p>We call the function from Swift using the simple syntax:</p></div>
+<div class="paragraph"><p>+</p></div>
+<div class="listingblock">
+<div class="content">
 <pre><code>(float v) func(string A[]) "f" "0.0"
 [
   "set <<v>> [ func <<A>> ]"
 ];</code></pre>
 </div></div>
-</li>
-<li>
-<p>
-We run with:
-</p>
+<div class="paragraph"><p>We run with:</p></div>
+<div class="paragraph"><p>+</p></div>
 <div class="listingblock">
 <div class="content">
 <pre><code>make
 swift-t -r $PWD prog-swift.swift</code></pre>
 </div></div>
-</li>
-</ol></div>
 </div>
 </div>
 </div>
@@ -1756,6 +1761,7 @@
   MPI_Barrier(comm);
   sleep(task_rank);
   MPI_Barrier(comm);
+  MPI_Comm_free(&comm);
   if (task_rank == 0)
     // Return a real value
     return sin(k+task_size);
@@ -1889,7 +1895,7 @@
 <div id="footnotes"><hr /></div>
 <div id="footer">
 <div id="footer-text">
-Last updated 2015-03-13 14:59:30 CDT
+Last updated 2015-04-21 10:47:12 CDT
 </div>
 </div>
 </body>




More information about the Swift-commit mailing list