Skip to content
Maxim Yurkin edited this page Jul 24, 2018 · 23 revisions

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.

Unix

  • 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 fglrx-updates (AMD) or nvidia-###-updates.

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. If you have any problems, try other options first.
  • 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:
      git clone https://github.com/KhronosGroup/OpenCL-Headers.git
      
      or install a special package, e.g., opencl-headers.
    • 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 and CPLUS_INCLUDE_PATH and libraries location - to LIBRARY_PATH and LD_LIBRARY_PATH (for linking and runtime). Setting LD_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 and lib folders in file src/ocl/Makefile, as described in CompilingADDA. You may also need updating LD_LIBRARY_PATH as described above.

Windows

  • 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 Windows. To compile OpenCL version of ADDA you will need additionally headers and libraries. Potentially, they can be obtained from vendor SDK, e.g. (Nvidia CUDA toolkit, but we recommend another option:

  • Download headers from official repository. They can also be obtained and further updated by git:
    git clone https://github.com/KhronosGroup/OpenCL-Headers.git
    
  • If you are setting up the MinGW/MSYS environment with advanced instructions follow those instructions.
  • Alternatively, do the following:
    • GCC can link to OpenCL.dll (located in C:\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 src/ocl/Makefile, as described in CompilingADDA.
Clone this wiki locally