source: sasmodels/doc/guide/install.rst @ a03fad8

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since a03fad8 was 990d8df, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

move polydispersity and resolution docs into sasmodels; write installation instructions

  • Property mode set to 100644
File size: 6.2 KB
RevLine 
[990d8df]1********************
2sasmodels Setup
3********************
4
5
6sasmodels Installation
7**********************
8Sasmodels can be installed using a simple pip installation::
9
10    # Won't work yet! For now follow the developer instructions below.
11    $ pip install sasmodels
12
13There are a number of dependent python packages which need to be installed
14separately::
15
16    numpy
17    scipy
18    opencl (for speed if your system has OpenCL drivers)
19    tinycc (windows only, if no C compiler and no OpenCL)
20
21When using sasmodels to fit data::
22
23    sasview (for loading data)
24    bumps (for fitting)
25    matplotlib (for displaying results)
26
27For development and testing it is handy to have some additional packages::
28
29    nose (for testing)
30    xmlrunner (for testing)
31    matplotlib (for showing models)
32    docutils (for showing model docs)
33    sphinx (for building docs)
34    wx ([optional] for adjusting parameters interactively)
35
36**Developer Installation**
37
38Developers will need to clone the sasmodels reposistory from github::
39
40    $ git clone https://github.com/sasview/sasmodels.git
41
42or if you have a github account::
43
44    $ git clone git@github.com:sasview/sasmodels.git
45
46Sasmodels can be run in-place by including the sasmodels directory on the
47python path.  There are numerous ways to do this which will not be outlined
48here.  It will be easiest to install the package in "develop" mode using::
49
50    $ cd sasmodels
51    $ python setup.py develop
52
53This will allow you to edit the files in the package and have the changes
54show 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
62ithout 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
Note: See TracBrowser for help on using the repository browser.