X86 CPUs

When using SOL on X86 CPUs we strongly recommend to set the following OMP env var.

export OMP_PROC_BIND=TRUE

Env Vars

EnvVar Default Description
CXX “g++” Path to g++
CPATH Used as include paths
C_INCLUDE_PATH Used as include paths
CPLUS_INCLUDE_PATH Used as include paths
LIBRARY_PATH Used as library paths

Further see OpenMP Environment Variables.

Deployment Options

Flag Default Description
gcc_arch native Sets GCC’s -march value.
gcc_tune native Sets GCC’s -mtune value.
ispc_vector native Sets ISPC’s vector instructions. By default uses the system’s current max available vector instructions. Valid options: native, sse2, sse4, avx, avx2, avx512, arm64.

If you are compiling on an AVX512 machine and want to deploy to a AVX2 machine, you need to set sol.deploy(..., gcc_arch='x86-64-v3', gcc_tune='generic', ispc_vector='avx2'), but you can also target more precisly with gcc_arch='haswell if you know the exact architecture.

To get a list of available architectures run gcc -march=help -c -x c /dev/null.

OneDNN Tensor Cache

SOL can make use of OneDNN’s Tensor cache. This allows to to precompute some of model parameters in inference, improving the execution performance.

For this just set the env var and adjust the size (in MB) accordingly to your model:

export ONEDNN_GRAPH_CONSTANT_TENSOR_CACHE_CAPACITY="cpu:1024"

FAQ

SOL performance using X86 is really really bad, what can I do?

tl;dr; run once: nec-sol fix-omp -y

Unfortunately some python packages (e.g., torch or sklearn) ship their own version of libgomp.so. This causes that the application uses multiple OpenMP runtimes, which can cause a series of problems. If you don’t define OMP_NUM_THREADS, then only the very first loaded OpenMP runtime runs multi-threaded. Even worse, if you define OMP_NUM_THREADS, all runtimes run in parallel, but use different threadpools, so whenever you switch from one to the other, you will have significant overhead due to swapping the threads. The nec-sol fix-omp -y command detects conflicting versions of libgomp.so and replaces them with a symlink to the system’s own version of libgomp.so, so that all libraries use the same threadpool.

If you need to run this fixing within your script, because you are using a fully automated process, then you can use:

import sol.bugfixes
sol.bugfixes.omp(True)