I am trying to use openmp for a for
loop in which i am trying to insert/update a hash map (std::unordered_map
)
Hash map and keys are actually members of a class so I assigned pointers to represent their addresses.Key is also a hash value returned by a global function.
The following seems the easiest way of doing this but the hash map is not updated correctly. Something(s) is/are wrong but i am not sure how to fix.Thanks in advance.
void MyClass::ProcessBuffer(void)
{
omp_set_num_threads(4);
std::unordered_map<unsigned long long,unsigned int>* hashptr=&m_sequencehash;
std::vector<std::string>* bufferptr=&m_buffer;
unsigned int sizevec=m_kmer_size;
size_t i;
#pragma omp parallel for
for (i=0; i<READSTR_BUF_SIZE;++i)
{
++(*hashptr)[_hash((*bufferptr)[i],sizevec)];
}
}