Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > 641ebb3060c35990cc021d8f7aaf9aca > files > 325

octave-doc-5.1.0-7.1.mga7.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JIT Compiler (GNU Octave (version 5.1.0))</title>

<meta name="description" content="JIT Compiler (GNU Octave (version 5.1.0))">
<meta name="keywords" content="JIT Compiler (GNU Octave (version 5.1.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Vectorization-and-Faster-Code-Execution.html#Vectorization-and-Faster-Code-Execution" rel="up" title="Vectorization and Faster Code Execution">
<link href="Miscellaneous-Techniques.html#Miscellaneous-Techniques" rel="next" title="Miscellaneous Techniques">
<link href="Accumulation.html#Accumulation" rel="prev" title="Accumulation">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<a name="JIT-Compiler"></a>
<div class="header">
<p>
Next: <a href="Miscellaneous-Techniques.html#Miscellaneous-Techniques" accesskey="n" rel="next">Miscellaneous Techniques</a>, Previous: <a href="Accumulation.html#Accumulation" accesskey="p" rel="prev">Accumulation</a>, Up: <a href="Vectorization-and-Faster-Code-Execution.html#Vectorization-and-Faster-Code-Execution" accesskey="u" rel="up">Vectorization and Faster Code Execution</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="JIT-Compiler-1"></a>
<h3 class="section">19.5 JIT Compiler</h3>

<p>Vectorization is the preferred technique for eliminating loops and speeding up
code.  Nevertheless, it is not always possible to replace every loop.  In such
situations it may be worth trying Octave&rsquo;s <strong>experimental</strong> Just-In-Time
(JIT) compiler.
</p>
<p>A JIT compiler works by analyzing the body of a loop, translating the Octave
statements into another language, compiling the new code segment into an
executable, and then running the executable and collecting any results.  The
process is not simple and there is a significant amount of work to perform for
each step.  It can still make sense, however, if the number of loop iterations
is large.  Because Octave is an interpreted language every time through a
loop Octave must parse the statements in the loop body before executing them.
With a JIT compiler this is done just once when the body is translated to
another language.
</p>
<p>The JIT compiler is a very new feature in Octave and not all valid Octave
statements can currently be accelerated.  However, if no other technique
is available it may be worth benchmarking the code with JIT enabled.  The
function <code>jit_enable</code> is used to turn compilation on or off.  The
function <code>jit_startcnt</code> sets the threshold for acceleration.  Loops
with iteration counts above <code>jit_startcnt</code> will be accelerated.  The
functions <code>jit_failcnt</code> and <code>debug_jit</code> are not likely to be of use
to anyone not working directly on the implementation of the JIT compiler.
</p>
<a name="XREFjit_005fenable"></a><dl>
<dt><a name="index-jit_005fenable"></a><em><var>val</var> =</em> <strong>jit_enable</strong> <em>()</em></dt>
<dt><a name="index-jit_005fenable-1"></a><em><var>old_val</var> =</em> <strong>jit_enable</strong> <em>(<var>new_val</var>)</em></dt>
<dt><a name="index-jit_005fenable-2"></a><em></em> <strong>jit_enable</strong> <em>(<var>new_val</var>, &quot;local&quot;)</em></dt>
<dd><p>Query or set the internal variable that enables Octave&rsquo;s JIT compiler.
</p>
<p>When called from inside a function with the <code>&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.
</p>
<p><strong>See also:</strong> <a href="#XREFjit_005fstartcnt">jit_startcnt</a>, <a href="#XREFdebug_005fjit">debug_jit</a>.
</p></dd></dl>


<a name="XREFjit_005fstartcnt"></a><dl>
<dt><a name="index-jit_005fstartcnt"></a><em><var>val</var> =</em> <strong>jit_startcnt</strong> <em>()</em></dt>
<dt><a name="index-jit_005fstartcnt-1"></a><em><var>old_val</var> =</em> <strong>jit_startcnt</strong> <em>(<var>new_val</var>)</em></dt>
<dt><a name="index-jit_005fstartcnt-2"></a><em></em> <strong>jit_startcnt</strong> <em>(<var>new_val</var>, &quot;local&quot;)</em></dt>
<dd><p>Query or set the internal variable that determines whether JIT compilation
will take place for a specific loop.
</p>
<p>Because compilation is a costly operation it does not make sense to employ
JIT when the loop count is low.  By default only loops with greater than
1000 iterations will be accelerated.
</p>
<p>When called from inside a function with the <code>&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.
</p>
<p><strong>See also:</strong> <a href="#XREFjit_005fenable">jit_enable</a>, <a href="#XREFjit_005ffailcnt">jit_failcnt</a>, <a href="#XREFdebug_005fjit">debug_jit</a>.
</p></dd></dl>


<a name="XREFjit_005ffailcnt"></a><dl>
<dt><a name="index-jit_005ffailcnt"></a><em><var>val</var> =</em> <strong>jit_failcnt</strong> <em>()</em></dt>
<dt><a name="index-jit_005ffailcnt-1"></a><em><var>old_val</var> =</em> <strong>jit_failcnt</strong> <em>(<var>new_val</var>)</em></dt>
<dt><a name="index-jit_005ffailcnt-2"></a><em></em> <strong>jit_failcnt</strong> <em>(<var>new_val</var>, &quot;local&quot;)</em></dt>
<dd><p>Query or set the internal variable that counts the number of JIT fail
exceptions for Octave&rsquo;s JIT compiler.
</p>
<p>When called from inside a function with the <code>&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.
</p>
<p><strong>See also:</strong> <a href="#XREFjit_005fenable">jit_enable</a>, <a href="#XREFjit_005fstartcnt">jit_startcnt</a>, <a href="#XREFdebug_005fjit">debug_jit</a>.
</p></dd></dl>


<a name="XREFdebug_005fjit"></a><dl>
<dt><a name="index-debug_005fjit"></a><em><var>val</var> =</em> <strong>debug_jit</strong> <em>()</em></dt>
<dt><a name="index-debug_005fjit-1"></a><em><var>old_val</var> =</em> <strong>debug_jit</strong> <em>(<var>new_val</var>)</em></dt>
<dt><a name="index-debug_005fjit-2"></a><em></em> <strong>debug_jit</strong> <em>(<var>new_val</var>, &quot;local&quot;)</em></dt>
<dd><p>Query or set the internal variable that determines whether
debugging/tracing is enabled for Octave&rsquo;s JIT compiler.
</p>
<p>When called from inside a function with the <code>&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.
</p>
<p><strong>See also:</strong> <a href="#XREFjit_005fenable">jit_enable</a>, <a href="#XREFjit_005fstartcnt">jit_startcnt</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Miscellaneous-Techniques.html#Miscellaneous-Techniques" accesskey="n" rel="next">Miscellaneous Techniques</a>, Previous: <a href="Accumulation.html#Accumulation" accesskey="p" rel="prev">Accumulation</a>, Up: <a href="Vectorization-and-Faster-Code-Execution.html#Vectorization-and-Faster-Code-Execution" accesskey="u" rel="up">Vectorization and Faster Code Execution</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>