-
Notifications
You must be signed in to change notification settings - Fork 59
OpenCL
OpenCL is a framework for programming highly parallel devices like graphic cards (GPUs) and mutlicore CPUs. The ADDA implementation works on relatively modern GPUs, for details and benchmarks see (Huntemann et al. 2011). The main limitations are the required support of double precision floating point operations and the maximum problem size being limited by the available GPU memory, more specifically, by its part available to ADDA. See also other limitations. The following outlines the setup of environment. For compiling ADDA you may also need Installing clFFT and Installing clBLAS (the latter is used for optional features under development). ADDA itself requires support for OpenCL 1.0, but commonly linked clFFT requires OpenCL 1.2.
- Install recent GPU driver. There are two options:
- Obtain it from the corresponding vendor (Nvidia or AMD).
- Use driver packages if available. They are usually more convenient to install and update. Also they cause less trouble with kernel updates. The drawback is a delay in updates relative to original vendor drivers. Moreover, for some systems there are no official packages, since the driver is not open-source. In this case search in non-official repositories, like RPM Fusion. On Ubuntu search for packages nvidia-###-updates or for AMD fglrx-updates (incompatible with kernel linux > 3.13, which instead includes kernel module
amdgpu
; the latter, however, is incompatible with AMD cards architecture older than gcn 1.2).
To obtain headers and libraries there are several options:
- Either use vendor SDK, e.g. (Nvidia CUDA toolkit. Additionally, you will get some nice development tools, such as visual profiler. We have, however, encountered issues with headers and libraries (for linking) themselves. One of such issues is errors during linking of clFFT with message like
This particular one can be solved by uncommenting the line
...libclFFT.so: undefined reference to `clRetainContext@OPENCL_1.0'
in ocl/Makefile. Still, if you encounter this or other problems, we recommend to try other options below.LDFLAGS +=-Wl,--unresolved-symbols=ignore-in-shared-libs
- Or obtain a special package, e.g. ocl-icd-opencl-dev for Ubuntu. It is based on open-source implementation of
libOpenCL.so
, which further links to vendor-specific libraries. - Or supply the files manually:
- Get headers from the official repository, e.g., by
git
:or install a special package, e.g., opencl-headers.git clone https://github.com/KhronosGroup/OpenCL-Headers.git
- Installed GPU driver always provides libraries, which are used at runtime. Compiler can link to them directly.
- update the environment:
- add headers location to environmental variables
C_INCLUDE_PATH
andCPLUS_INCLUDE_PATH
and libraries location – toLIBRARY_PATH
andLD_LIBRARY_PATH
(for linking and runtime). SettingLD_LIBRARY_PATH
can be replaced by modifying/etc/ld.so.conf
, which sometimes is done automatically during driver installation. - or specify paths to corresponding
include
andlib
folders in ocl/Makefile, as described in CompilingADDA. You may also need updatingLD_LIBRARY_PATH
as described above.
- add headers location to environmental variables
- Get headers from the official repository, e.g., by
- OpenCL should be available without any efforts.
- If any issues arise, see the Unix instructions.
Download and install recent GPU driver from the corresponding vendor (Nvidia or AMD). Most probably, it is already installed on your system.
The driver alone is sufficient to run ADDA OpenCL executables, e.g. those that are provided for 64-bit Windows. To compile OpenCL version of ADDA you will need additionally headers and libraries, and we recommed to set up a complete MinGW-w64 environment.
Alternatively, follow these steps:
- Download headers from official repository. They can also be obtained and further updated by
git
:git clone https://github.com/KhronosGroup/OpenCL-Headers.git
- GCC can link to
OpenCL.dll
(located inC:\Windows\System32
). However, on 64-bit Windows this system folder is not accessible (substituted) for a 32-bit application (such as a compiler). Thus, it is necessary to move this DLL to (or create a link to it in) a non-system folder using a 64-bit application (Windows Explorer or a file manager) . - Specify paths to this non-system folder and folder with headers in ocl/Makefile, as described in CompilingADDA.
Home (Getting started)
Frequently asked questions
Features
Tutorial
Comparison with other codes
Largest simulations
Compiling ADDA
Installing FFTW3
Installing MPI
Using OpenCL
Installing clFFT
Installing clBLAS
Using sparse mode
Installing MinGW
Using MSYS2
Papers that use ADDA
Awards
References
Links
Acknowledgements
Instruction for committers
Code design & structure
Style guide
Using VS Code
Using Eclipse
Early development history
Adding new ...