I am running the following code but neither thread can complete the first iteration, they seem to be stuck in some critical section within MakePackedPlaintext
. The program runs fine if I set num_threads(1)
.
#include <omp.h>
#include "openfhe.h"
using namespace lbcrypto;
int main()
{
CCParams<CryptoContextBGVRNS> params;
params.SetPlaintextModulus(65537);
CryptoContext<DCRTPoly> cc = GenCryptoContext(params);
omp_set_num_threads(2);
#pragma omp parallel for
for (int i = 0; i < 10; i++)
{
std::cout << omp_get_thread_num() << ": " << i << std::endl;
std::vector<int64_t> vec(10, 1L);
Plaintext plain = cc->MakePackedPlaintext(vec);
std::cout << omp_get_thread_num() << ": " << i << " done" << std::endl;
}
}