Changes in / [62d7601:bf09f55] in sasmodels


Ignore:
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • doc/genmodel.py

    rb866abf r745b7bb  
    33import sys, os, math, re 
    44import numpy as np 
    5 import matplotlib 
    6 matplotlib.use('Agg') 
    75import matplotlib.pyplot as plt 
    86sys.path.insert(0, os.path.abspath('..')) 
  • doc/guide/index.rst

    rc0d7ab3 r2e66ef5  
    99   intro.rst 
    1010   install.rst 
    11    gpu_setup.rst 
    1211   pd/polydispersity.rst 
    1312   resolution.rst 
  • doc/guide/install.rst

    rc0d7ab3 rf8a2baa  
    5353This will allow you to edit the files in the package and have the changes 
    5454show up immediately in python the next time you load your program. 
     55 
     56OpenCL Installation 
     57******************* 
     58*Warning! GPU devices do not in general offer the same level of memory 
     59protection as CPU devices. If your code attempts to write outside allocated 
     60memory buffers unpredicatable behaviour may result (eg, your video display 
     61may freeze, or your system may crash, etc). Do not install OpenCL drivers 
     62without first checking for known issues (eg, some computer manufacturers 
     63install modified graphics drivers so replacing these may not be a good 
     64idea!). If in doubt, seek advice from an IT professional before proceeding 
     65further.* 
     66 
     67Check if you have OpenCL already installed 
     68========================================== 
     69 
     70**Windows** 
     71 
     72The following instructions are based on 
     73http://web.engr.oregonstate.edu/~mjb/cs475/DoIHaveOpenCL.pdf 
     74 
     75* Go to: Start -> Control Panel -> System & Security -> Administrative Tools 
     76* Double Click on Computer Managment 
     77* Click on Device Manager 
     78* Click open Display Adapters 
     79* Right-click on available adapter and select Properties 
     80* Click on Driver 
     81* Go to Driver Details 
     82* Scroll down and see if OpenCL is installed (look for OpenCL*.dll files) 
     83 
     84**Mac OSX** 
     85 
     86For OS X operating systems higher than 10.6 OpenCL is shipped along with 
     87the system. 
     88 
     89However, OpenCL has had a rocky history on Macs. Apple provide a useful 
     90compatibility table at https://support.apple.com/en-us/HT202823 
     91 
     92 
     93Installation 
     94============ 
     95 
     96**Windows** 
     97 
     98Depending on the graphic card in your system, drivers 
     99can be obtained from different sources: 
     100 
     101* NVIDIA: https://developer.nvidia.com/opencl 
     102* AMD: http://developer.amd.com/tools-and-sdks/opencl-zone/ 
     103 
     104 
     105**Mac OSX** 
     106 
     107N/A 
     108 
     109You cannot download OpenCL driver updates for your Mac. They are packaged 
     110with the normal quarterly OS X updates from Apple. 
     111 
     112 
     113.. note:: 
     114    Intel provides OpenCL drivers for Intel processors at 
     115    https://software.intel.com/en-us/articles/opencl-drivers 
     116    These can sometimes make use of special vector instructions across multiple 
     117    processors, so it is worth installing if the GPU does not support double 
     118    precision. You can install this driver alongside the GPU driver for NVIDIA 
     119    or AMD. 
     120 
     121 
     122GPU Selection 
     123************* 
     124 
     125sasmodels evaluations can run on your graphics card (GPU) or they can run 
     126on the processor (CPU). In general, calculations performed on the GPU will run faster. 
     127 
     128To run on the GPU, your computer must have OpenCL drivers installed. 
     129For information about OpenCL installation see this 
     130:ref:`opencl-installation` guidance. 
     131 
     132Where the model is evaluated is a little bit complicated. 
     133If the model has the line *single=False* then it requires double precision. 
     134If the GPU is single precision only, then it will try running via OpenCL 
     135on the CPU.  If the OpenCL driver is not available for the CPU then 
     136it will run as a normal program on the CPU. 
     137 
     138For models with a large number of parameters or with a lot of code, 
     139the GPU may be too small to run the program effectively. 
     140In this case, you should try simplifying the model, maybe breaking it 
     141into several different modules so that you don't need *IF* statements in your code. 
     142If it is still too big, you can set *opencl=False* in the model file and 
     143the model will only run as a normal program on the CPU. 
     144This will not usually be necessary. 
     145 
     146Device Selection 
     147================ 
     148If you have multiple GPU devices you can tell SasView which device to use. 
     149By default, SasView looks for one GPU and one CPU device 
     150from available OpenCL platforms. 
     151 
     152SasView prefers AMD or NVIDIA drivers for GPU, and prefers Intel or 
     153Apple drivers for CPU. Both GPU and CPU are included on the assumption that CPU 
     154is always available and supports double precision. 
     155 
     156The device order is important: GPU is checked before CPU on the assumption that 
     157it will be faster. By examining ~/sasview.log you can see which device SasView 
     158chose to run the model. 
     159 
     160**If you don't want to use OpenCL, you can set** *SAS_OPENCL=None* 
     161**in your environment settings, and it will only use normal programs.** 
     162 
     163If you want to use one of the other devices, you can run the following 
     164from the python console in SasView:: 
     165 
     166    import pyopencl as cl 
     167    cl.create_some_context() 
     168 
     169This will provide a menu of different OpenCL drivers available. 
     170When one is selected, it will say "set PYOPENCL_CTX=..." 
     171Use that value as the value of *SAS_OPENCL*. 
     172 
     173Compiler Selection 
     174================== 
     175For models run as normal programs, you may need to specify a compiler. 
     176This is done using the SAS_COMPILER environment variable. 
     177Set it to *tinycc* for the tinycc compiler, *msvc* for the 
     178Microsoft Visual C compiler, or *mingw* for the MinGW compiler. 
     179TinyCC is provided with SasView so that is the default. 
     180If you want one of the other compilers, be sure to have it available 
     181in your *PATH* so SasView can find it! 
     182 
     183 
     184*Document History* 
     185 
     186| 2017-05-17 Paul Kienzle 
  • doc/guide/magnetism/magnetism.rst

    r59485a4 r990d8df  
    8787    The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range 0 to 1. 
    8888 
    89 *Document History* 
     89.. note:: 
     90    This help document was last changed by Steve King, 02May2015 
    9091 
    91 | 2015-05-02 Steve King 
     92* Document History * 
     93 
    9294| 2017-05-08 Paul Kienzle 
  • doc/guide/plugin.rst

    r3048ec6 r30b60d2  
    7878     at the start of the model documentation and as a tooltip in the SasView GUI 
    7979 
    80 - a **short description**: 
     80- a **short discription**: 
    8181   - this is the **description** string in the *.py* file 
    8282   - this is a medium length description which appears when you click 
     
    233233 
    234234**name = "mymodel"** defines the name of the model that is shown to the user. 
    235 If it is not provided it will use the name of the model file. The name must 
    236 be a valid variable name, starting with a letter and contains only letters, 
    237 numbers or underscore.  Spaces, dashes, and other symbols are not permitted. 
     235If it is not provided, it will use the name of the model file, with '_' 
     236replaced by spaces and the parts capitalized.  So *adsorbed_layer.py* will 
     237become *Adsorbed Layer*.  The predefined models all use the name of the 
     238model file as the name of the model, so the default may be changed. 
    238239 
    239240**title = "short description"** is short description of the model which 
     
    297298- **"name"** is the name of the parameter shown on the FitPage. 
    298299 
    299   - the name must be a valid variable name, starting with a letter and 
    300     containing only letters, numbers and underscore. 
    301  
    302300  - parameter names should follow the mathematical convention; e.g., 
    303301    *radius_core* not *core_radius*, or *sld_solvent* not *solvent_sld*. 
     
    368366    dispersion. 
    369367 
    370 Some models will have integer parameters, such as number of pearls in the 
    371 pearl necklace model, or number of shells in the multi-layer vesicle model. 
    372 The optimizers in BUMPS treat all parameters as floating point numbers which 
    373 can take arbitrary values, even for integer parameters, so your model should 
    374 round the incoming parameter value to the nearest integer inside your model 
    375 you should round to the nearest integer.  In C code, you can do this using:: 
    376  
    377     static double 
    378     Iq(double q, ..., double fp_n, ...) 
    379     { 
    380         int n = (int)(fp_n + 0.5); 
    381         ... 
    382     } 
    383  
    384 in python:: 
    385  
    386     def Iq(q, ..., n, ...): 
    387         n = int(n+0.5) 
    388         ... 
    389  
    390 Derivative based optimizers such as Levenberg-Marquardt will not work 
    391 for integer parameters since the partial derivative is always zero, but 
    392 the remaining optimizers (DREAM, differential evolution, Nelder-Mead simplex) 
    393 will still function. 
    394368 
    395369Model Computation 
     
    417391     \approx \frac{\sum_{i=1}^n G(x_i) I(q,x_i)}{\sum_{i=1}^n G(x_i) V(x_i)} 
    418392 
    419 That is, the individual models do not need to include polydispersity 
     393That is, the indivdual models do not need to include polydispersity 
    420394calculations, but instead rely on numerical integration to compute the 
    421395appropriately smeared pattern.   Angular dispersion values over polar angle 
     
    437411The parameters *par1, par2, ...* are the list of non-orientation parameters 
    438412to the model in the order that they appear in the parameter table. 
    439 **Note that the auto-generated model file uses** *x* **rather than** *q*. 
     413**Note that the autogenerated model file uses** *x* **rather than** *q*. 
    440414 
    441415The *.py* file should import trigonometric and exponential functions from 
     
    961935across multiple parameters can be very slow). 
    962936 
    963 If your model has 2D orientation calculation, then you should also 
     937If your model has 2D orientational calculation, then you should also 
    964938test with:: 
    965939 
  • sasmodels/conversion_table.py

    r505d0ad rd3e3f756  
    1111account for that. 
    1212 
    13 Usage:: 
    14  
    15     <old_Sasview_version> : { 
    16         <new_model_name> : [ 
    17             <old_model_name> , 
    18             { 
    19                 <new_param_name_1> : <old_param_name_1>, 
    20                 ... 
    21                 <new_param_name_n> : <old_param_name_n> 
    22             } 
    23         ] 
    24     } 
     13Usage: 
     14<old_Sasview_version> : { 
     15    <new_model_name> : [ 
     16        <old_model_name> , 
     17        { 
     18            <new_param_name_1> : <old_param_name_1>, 
     19            ... 
     20            <new_param_name_n> : <old_param_name_n> 
     21        } 
     22    ] 
     23} 
    2524 
    2625Any future parameter and model name changes can and should be given in this 
  • sasmodels/custom/__init__.py

    r0f48f1e r1a6cd57  
    3131        if fullname in sys.modules: 
    3232            del sys.modules[fullname] 
    33         if path.endswith(".py") and os.path.exists(path) and os.path.exists(path+"c"): 
    34             # remove automatic pyc file before loading a py file 
    35             os.unlink(path+"c") 
    3633        module = imp.load_source(fullname, os.path.expanduser(path)) 
     34        #os.unlink(path+"c")  # remove the automatic pyc file 
    3735        return module 
    3836 
  • sasmodels/kernelpy.py

    r3b32f8d r883ecf4  
    3434        self.info = model_info 
    3535        self.dtype = np.dtype('d') 
    36         logging.info("load python model " + self.info.name) 
    3736 
    3837    def make_kernel(self, q_vectors): 
     38        logging.info("creating python kernel " + self.info.name) 
    3939        q_input = PyInput(q_vectors, dtype=F64) 
    4040        kernel = self.info.Iqxy if q_input.is_2d else self.info.Iq 
  • sasmodels/sasview_model.py

    r9f8ade1 r9644b5a  
    1616import logging 
    1717from os.path import basename, splitext, abspath, getmtime 
    18 try: 
    19     import _thread as thread 
    20 except ImportError: 
    21     import thread 
     18import thread 
    2219 
    2320import numpy as np  # type: ignore 
Note: See TracChangeset for help on using the changeset viewer.