Command-Line Interface

OCCA comes with a command-line tool called occa inside the bin directory. It also comes with bash autocomplete to help with finding cached files.

. <(occa autocomplete bash)
eval "$(occa autocomplete bash)"

Device Information

We can use occa info to view enabled OCCA modes and descriptions for each device.

> occa info
==========o======================o==========================================
 CPU Info | Processor Name       | Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
          | Cores                | 4
          | Memory (RAM)         | 4 GB
          | Clock Frequency      | 1.4 GHz
          | SIMD Instruction Set | SSE4
          | SIMD Width           | 128 bits
          | L1 Cache Size (d)    |  32 KB
          | L2 Cache Size        | 256 KB
          | L3 Cache Size        |   3 MB
==========o======================o==========================================
 OpenCL   | Device Name          | Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
          | Driver Vendor        | Intel
          | Platform ID          | 0
          | Device ID            | 0
          | Memory               | 4 GB
          |----------------------|------------------------------------------
          | Device Name          | HD Graphics 5000
          | Driver Vendor        | Intel
          | Platform ID          | 0
          | Device ID            | 1
          | Memory               | 1 GB
==========o======================o==========================================

Environment Information

We can use occa env to view the environment OCCA is using to run devices. Environment variables override compiled-time defines.

> occa env
  The following are optional environment variables and their values
  Basic:
    - OCCA_CACHE_DIR             : /Users/dsm5/.occa
  Makefile:
    - CXX                        : clang++
    - CXXFLAGS                   : -Wall -pedantic -Wnewline-eof -Wshadow -Wsign-compare -Wuninitialized -Wtype-limits -Wignored-qualifiers -Wempty-body -D__extern_always_inline=inline
    - FC                         : gfortran
    - FCFLAGS                    : [NOT SET]
    - LDFLAGS                    : [NOT SET]
  Backend Support:
    - OCCA_OPENMP_ENABLED        : 0
    - OCCA_OPENCL_ENABLED        : 1
    - OCCA_CUDA_ENABLED          : 0
  Run-Time Options:
    - OCCA_CXX                   : clang++
    - OCCA_CXXFLAGS              : -I. -D__extern_always_inline=inline -O3 -mtune=native -ftree-vectorize -funroll-loops -ffast-math
    - OCCA_OPENCL_COMPILER_FLAGS : -I. -cl-single-precision-constant -cl-denorms-are-zero -cl-single-precision-constant -cl-fast-relaxed-math -cl-finite-math-only -cl-mad-enable -cl-no-signed-zeros
    - OCCA_CUDA_COMPILER         : nvcc
    - OCCA_CUDA_COMPILER_FLAGS   : -I. -ccbin /usr/bin/clang -Xcompiler -stdlib=libstdc++ --compiler-options -O3 --use_fast_math

Clearing Cache

Compiled kernels are cached in ${OCCA_CACHE_DIR}, defaulting to ${HOME}/.occa. It is safe to clear the cache directory at anytime.

Clearing Cached Kernels

> occa clear --kernels
  Removing [/Users/dsm5/.occa/cache/*], are you sure? [y/n]:

Clearing Cached Library Kernels

> occa clear --lib myLibrary --lib myLibrary2
  Removing [/Users/dsm5/.occa/libraries/myLibrary/*], are you sure? [y/n]:  y
  Removing [/Users/dsm5/.occa/libraries/myLibrary2/*], are you sure? [y/n]:  y
> occa clear --libraries
  Removing [/Users/dsm5/.occa/libraries/*], are you sure? [y/n]:  y

Clearing Locks

Enabling OCCA to work in distributed machines means we have to handle multiple processes across machines trying to compile the same kernel. We use directory locks as a way to create a distributed mutex.

When processes die, OCCA catches the signal and removes locks. However, we can remove the locks if for some reason locks still persist.

> occa clear --locks
  Removing [/Users/dsm5/.occa/locks/*], are you sure? [y/n]:

Clearing All Cache

OCCA caches other helpful files and it might be good to start with a clean environment.

> occa clear --all
  Removing [/Users/dsm5/.occa/*], are you sure? [y/n]: