Under the hood OpenFHE already uses OpenMP and it defaults to the max number of threads. To see open mp being used in the code check out openfhe-development/src/core/lib/math/matrix.cpp where you can see the #pragma omp parallel for
being used.
template <class Element>
Matrix<Element>& Matrix<Element>::operator-=(Matrix<Element> const& other) {
if (rows != other.rows || cols != other.cols) {
OPENFHE_THROW(math_error, "Subtraction operands have incompatible dimensions");
}
#pragma omp parallel for // <- HERE
for (size_t j = 0; j < cols; ++j) {
for (size_t i = 0; i < rows; ++i) {
data[i][j] -= other.data[i][j];
}
}
return *this;
}
Another user was looking at using direct multithreading Multi-threading ciphertext multiplication and bootstrapping but I’m not sure if it’s applicable to you. Also feel free to check out CMakeLists.txt to see the CMake that relates to openmp