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