[68532f3] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
| 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
| 6 | <head> |
---|
| 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
| 8 | |
---|
| 9 | <title>3.8. Ctypes model evaluator — Sasmodels</title> |
---|
| 10 | |
---|
| 11 | <link rel="stylesheet" href="../_static/haiku-site.css" type="text/css" /> |
---|
| 12 | <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
---|
| 13 | |
---|
| 14 | <script type="text/javascript"> |
---|
| 15 | var DOCUMENTATION_OPTIONS = { |
---|
| 16 | URL_ROOT: '../', |
---|
| 17 | VERSION: '0.9', |
---|
| 18 | COLLAPSE_INDEX: false, |
---|
| 19 | FILE_SUFFIX: '.html', |
---|
| 20 | HAS_SOURCE: true |
---|
| 21 | }; |
---|
| 22 | </script> |
---|
| 23 | <script type="text/javascript" src="../_static/jquery.js"></script> |
---|
| 24 | <script type="text/javascript" src="../_static/underscore.js"></script> |
---|
| 25 | <script type="text/javascript" src="../_static/doctools.js"></script> |
---|
| 26 | <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> |
---|
| 27 | <link rel="top" title="Sasmodels" href="../index.html" /> |
---|
| 28 | <link rel="up" title="3. Reference" href="index.html" /> |
---|
| 29 | <link rel="next" title="3.9. Python model evaluator" href="kernelpy.html" /> |
---|
| 30 | <link rel="prev" title="3.7. OpenCL model evaluator" href="kernelcl.html" /> |
---|
| 31 | </head> |
---|
| 32 | <body> |
---|
| 33 | <div class="header"><h1 class="heading"><a href="../index.html"> |
---|
| 34 | <span>Home</span></a></h1> |
---|
| 35 | <h2 class="heading"><span>3.8. Ctypes model evaluator</span></h2> |
---|
| 36 | </div> |
---|
| 37 | <div class="topnav"> |
---|
| 38 | |
---|
| 39 | <p> |
---|
| 40 | «  <a href="kernelcl.html">3.7. OpenCL model evaluator</a> |
---|
| 41 |   ::   |
---|
| 42 | <a class="uplink" href="../index.html">Contents</a> |
---|
| 43 |   ::   |
---|
| 44 | <a href="kernelpy.html">3.9. Python model evaluator</a>  Â» |
---|
| 45 | </p> |
---|
| 46 | |
---|
| 47 | </div> |
---|
| 48 | <div class="content"> |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | <div class="section" id="ctypes-model-evaluator"> |
---|
| 52 | <h1>3.8. Ctypes model evaluator<a class="headerlink" href="#ctypes-model-evaluator" title="Permalink to this headline">¶</a></h1> |
---|
| 53 | <div class="section" id="module-sasmodels.kerneldll"> |
---|
| 54 | <span id="sasmodels-kerneldll"></span><h2>3.8.1. <a class="reference internal" href="#module-sasmodels.kerneldll" title="sasmodels.kerneldll"><tt class="xref py py-mod docutils literal"><span class="pre">sasmodels.kerneldll</span></tt></a><a class="headerlink" href="#module-sasmodels.kerneldll" title="Permalink to this headline">¶</a></h2> |
---|
| 55 | <p>C types wrapper for sasview models.</p> |
---|
| 56 | <p>The global attribute <em>ALLOW_SINGLE_PRECISION_DLLS</em> should be set to <em>True</em> if |
---|
| 57 | you wish to allow single precision floating point evaluation for the compiled |
---|
| 58 | models, otherwise it defaults to <em>False</em>.</p> |
---|
| 59 | <dl class="class"> |
---|
| 60 | <dt id="sasmodels.kerneldll.DllKernel"> |
---|
| 61 | <em class="property">class </em><tt class="descclassname">sasmodels.kerneldll.</tt><tt class="descname">DllKernel</tt><big>(</big><em>kernel</em>, <em>info</em>, <em>q_input</em><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.DllKernel" title="Permalink to this definition">¶</a></dt> |
---|
| 62 | <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p> |
---|
| 63 | <p>Callable SAS kernel.</p> |
---|
| 64 | <p><em>kernel</em> is the c function to call.</p> |
---|
| 65 | <p><em>info</em> is the module information</p> |
---|
| 66 | <p><em>q_input</em> is the DllInput q vectors at which the kernel should be |
---|
| 67 | evaluated.</p> |
---|
| 68 | <p>The resulting call method takes the <em>pars</em>, a list of values for |
---|
| 69 | the fixed parameters to the kernel, and <em>pd_pars</em>, a list of (value,weight) |
---|
| 70 | vectors for the polydisperse parameters. <em>cutoff</em> determines the |
---|
| 71 | integration limits: any points with combined weight less than <em>cutoff</em> |
---|
| 72 | will not be calculated.</p> |
---|
| 73 | <p>Call <a class="reference internal" href="#sasmodels.kerneldll.DllKernel.release" title="sasmodels.kerneldll.DllKernel.release"><tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt></a> when done with the kernel instance.</p> |
---|
| 74 | <dl class="method"> |
---|
| 75 | <dt id="sasmodels.kerneldll.DllKernel.release"> |
---|
| 76 | <tt class="descname">release</tt><big>(</big><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.DllKernel.release" title="Permalink to this definition">¶</a></dt> |
---|
| 77 | <dd></dd></dl> |
---|
| 78 | |
---|
| 79 | </dd></dl> |
---|
| 80 | |
---|
| 81 | <dl class="class"> |
---|
| 82 | <dt id="sasmodels.kerneldll.DllModel"> |
---|
| 83 | <em class="property">class </em><tt class="descclassname">sasmodels.kerneldll.</tt><tt class="descname">DllModel</tt><big>(</big><em>dllpath</em>, <em>info</em>, <em>dtype=dtype('float32')</em><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.DllModel" title="Permalink to this definition">¶</a></dt> |
---|
| 84 | <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p> |
---|
| 85 | <p>ctypes wrapper for a single model.</p> |
---|
| 86 | <p><em>source</em> and <em>info</em> are the model source and interface as returned |
---|
| 87 | from <tt class="xref py py-func docutils literal"><span class="pre">gen.make()</span></tt>.</p> |
---|
| 88 | <p><em>dtype</em> is the desired model precision. Any numpy dtype for single |
---|
| 89 | or double precision floats will do, such as ‘f’, ‘float32’ or ‘single’ |
---|
| 90 | for single and ‘d’, ‘float64’ or ‘double’ for double. Double precision |
---|
| 91 | is an optional extension which may not be available on all devices.</p> |
---|
| 92 | <p>Call <a class="reference internal" href="#sasmodels.kerneldll.DllModel.release" title="sasmodels.kerneldll.DllModel.release"><tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt></a> when done with the kernel.</p> |
---|
| 93 | <dl class="method"> |
---|
| 94 | <dt id="sasmodels.kerneldll.DllModel.make_input"> |
---|
| 95 | <tt class="descname">make_input</tt><big>(</big><em>q_vectors</em><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.DllModel.make_input" title="Permalink to this definition">¶</a></dt> |
---|
| 96 | <dd><p>Make q input vectors available to the model.</p> |
---|
| 97 | <p>Note that each model needs its own q vector even if the case of |
---|
| 98 | mixture models because some models may be OpenCL, some may be |
---|
| 99 | ctypes and some may be pure python.</p> |
---|
| 100 | </dd></dl> |
---|
| 101 | |
---|
| 102 | <dl class="method"> |
---|
| 103 | <dt id="sasmodels.kerneldll.DllModel.release"> |
---|
| 104 | <tt class="descname">release</tt><big>(</big><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.DllModel.release" title="Permalink to this definition">¶</a></dt> |
---|
| 105 | <dd></dd></dl> |
---|
| 106 | |
---|
| 107 | </dd></dl> |
---|
| 108 | |
---|
| 109 | <dl class="function"> |
---|
| 110 | <dt id="sasmodels.kerneldll.dll_path"> |
---|
| 111 | <tt class="descclassname">sasmodels.kerneldll.</tt><tt class="descname">dll_path</tt><big>(</big><em>info</em>, <em>dtype='double'</em><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.dll_path" title="Permalink to this definition">¶</a></dt> |
---|
| 112 | <dd><p>Path to the compiled model defined by <em>info</em>.</p> |
---|
| 113 | </dd></dl> |
---|
| 114 | |
---|
| 115 | <dl class="function"> |
---|
| 116 | <dt id="sasmodels.kerneldll.load_dll"> |
---|
| 117 | <tt class="descclassname">sasmodels.kerneldll.</tt><tt class="descname">load_dll</tt><big>(</big><em>source</em>, <em>info</em>, <em>dtype='double'</em><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.load_dll" title="Permalink to this definition">¶</a></dt> |
---|
| 118 | <dd><p>Create and load a dll corresponding to the source,info pair returned |
---|
| 119 | from <a class="reference internal" href="generate.html#sasmodels.generate.make" title="sasmodels.generate.make"><tt class="xref py py-func docutils literal"><span class="pre">sasmodels.generate.make()</span></tt></a> compiled for the target precision.</p> |
---|
| 120 | <p>See <a class="reference internal" href="#sasmodels.kerneldll.make_dll" title="sasmodels.kerneldll.make_dll"><tt class="xref py py-func docutils literal"><span class="pre">make_dll()</span></tt></a> for details on controlling the dll path and the |
---|
| 121 | allowed floating point precision.</p> |
---|
| 122 | </dd></dl> |
---|
| 123 | |
---|
| 124 | <dl class="function"> |
---|
| 125 | <dt id="sasmodels.kerneldll.make_dll"> |
---|
| 126 | <tt class="descclassname">sasmodels.kerneldll.</tt><tt class="descname">make_dll</tt><big>(</big><em>source</em>, <em>info</em>, <em>dtype='double'</em><big>)</big><a class="headerlink" href="#sasmodels.kerneldll.make_dll" title="Permalink to this definition">¶</a></dt> |
---|
| 127 | <dd><p>Load the compiled model defined by <em>kernel_module</em>.</p> |
---|
| 128 | <p>Recompile if any files are newer than the model file.</p> |
---|
| 129 | <p><em>dtype</em> is a numpy floating point precision specifier indicating whether |
---|
| 130 | the model should be single or double precision. The default is double |
---|
| 131 | precision.</p> |
---|
| 132 | <p>The DLL is not loaded until the kernel is called so models can |
---|
| 133 | be defined without using too many resources.</p> |
---|
| 134 | <p>Set <em>sasmodels.kerneldll.DLL_PATH</em> to the compiled dll output path. |
---|
| 135 | The default is the system temporary directory.</p> |
---|
| 136 | <p>Set <em>sasmodels.ALLOW_SINGLE_PRECISION_DLLS</em> to True if single precision |
---|
| 137 | models are allowed as DLLs.</p> |
---|
| 138 | </dd></dl> |
---|
| 139 | |
---|
| 140 | </div> |
---|
| 141 | </div> |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | </div> |
---|
| 145 | <div class="bottomnav"> |
---|
| 146 | |
---|
| 147 | <p> |
---|
| 148 | «  <a href="kernelcl.html">3.7. OpenCL model evaluator</a> |
---|
| 149 |   ::   |
---|
| 150 | <a class="uplink" href="../index.html">Contents</a> |
---|
| 151 |   ::   |
---|
| 152 | <a href="kernelpy.html">3.9. Python model evaluator</a>  Â» |
---|
| 153 | </p> |
---|
| 154 | |
---|
| 155 | </div> |
---|
| 156 | |
---|
| 157 | <div class="footer"> |
---|
| 158 | © Copyright 2014, sasview team. |
---|
| 159 | Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. |
---|
| 160 | </div> |
---|
| 161 | </body> |
---|
| 162 | </html> |
---|