Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
bond core
Browse files Browse the repository at this point in the history
  • Loading branch information
yuchengliu1 committed Feb 4, 2024
1 parent 570028e commit ea90d51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bestla/bestla/bestla_parallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ class OMPThreading : public IThreading {
public:
explicit OMPThreading(int nthreads) : IThreading(nthreads) { omp_set_num_threads(nthreads); }
void parallel_for(const thread_func& func) override {
if (mThreadNum > 1) {
#pragma omp parallel
{
int tidx = omp_get_thread_num();
Expand Down Expand Up @@ -665,10 +666,11 @@ class StdThreading : public IThreading {
// printf("create %d\n", mThreadNum);
thdset.resize(mThreadNum - 1);
stop = false;

bestla::device::CpuDevice::core_bond(0);
for (size_t i = 0; i < mThreadNum - 1; i++) {
thdset[i] = std::thread(
[&](int tidx) {
bestla::device::CpuDevice::core_bond(tidx+1);
while (true) {
if (stop.load() == true) break;
if (func_[tidx] != nullptr) {
Expand Down

0 comments on commit ea90d51

Please sign in to comment.