source: sasmodels/doc/ref/gpu/gpu_computations.rst @ 777d369

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 777d369 was 1a6cd57, checked in by jhbakker, 8 years ago

commit of stuff from master from fast-merge

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[066f296]1.. _models-computation:
[1875f4e]2
[886fa25]3****************
4GPU Computations
5****************
[1875f4e]6SasView model evaluations can run on your graphics card (GPU) or they can run
[1a6cd57]7on the processor (CPU). In general, calculations performed on the GPU will run faster.
[1875f4e]8
9To run on the GPU, your computer must have OpenCL drivers installed.
[711f17e]10For information about OpenCL installation see this
11:ref:`opencl-installation` guidance.
[1875f4e]12
13Where the model is evaluated is a little bit complicated.
14If the model has the line *single=False* then it requires double precision.
15If the GPU is single precision only, then it will try running via OpenCL
16on the CPU.  If the OpenCL driver is not available for the CPU then
17it will run as a normal program on the CPU.
[711f17e]18
[1875f4e]19For models with a large number of parameters or with a lot of code,
20the GPU may be too small to run the program effectively.
21In this case, you should try simplifying the model, maybe breaking it
[711f17e]22into several different modules so that you don't need *IF* statements in your code.
[1875f4e]23If it is still too big, you can set *opencl=False* in the model file and
24the model will only run as a normal program on the CPU.
25This will not usually be necessary.
26
[711f17e]27Device Selection
28................
[1875f4e]29If you have multiple GPU devices you can tell SasView which device to use.
30By default, SasView looks for one GPU and one CPU device
31from available OpenCL platforms.
32
[711f17e]33SasView prefers AMD or NVIDIA drivers for GPU, and prefers Intel or
34Apple drivers for CPU. Both GPU and CPU are included on the assumption that CPU
35is always available and supports double precision.
[1875f4e]36
37The device order is important: GPU is checked before CPU on the assumption that
38it will be faster. By examining ~/sasview.log you can see which device SasView
39chose to run the model.
[711f17e]40
[1a6cd57]41**If you don't want to use OpenCL, you can set** *SAS_OPENCL=None*
42**in your environment settings, and it will only use normal programs.**
[711f17e]43
[1875f4e]44If you want to use one of the other devices, you can run the following
45from the python console in SasView::
46
47    import pyopencl as cl
48    cl.create_some_context()
49
50This will provide a menu of different OpenCL drivers available.
51When one is selected, it will say "set PYOPENCL_CTX=..."
52Use that value as the value of *SAS_OPENCL*.
53
[711f17e]54Compiler Selection
55..................
[1875f4e]56For models run as normal programs, you may need to specify a compiler.
57This is done using the SAS_COMPILER environment variable.
58Set it to *tinycc* for the tinycc compiler, *msvc* for the
59Microsoft Visual C compiler, or *mingw* for the MinGW compiler.
60TinyCC is provided with SasView so that is the default.
61If you want one of the other compilers, be sure to have it available
[711f17e]62in your *PATH* so SasView can find it!
63
64
65.. note::
66    This help document was last changed by Steve King, 08Oct2016
Note: See TracBrowser for help on using the repository browser.