Skip to content

Commit 3020f13

Browse files
authored
Merge pull request #2646 from nab880/setCpuMaskFix
Add missing setCpumask/setThreadId definitions and reassignCores virt…
2 parents d380d0c + 7a619a9 commit 3020f13

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/sst/elements/mercury/components/compute_library/operating_system_cl.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,16 @@ OperatingSystemCL::execute(COMP_FUNC func, Event *data, int nthr)
7979
}
8080
}
8181

82+
void
83+
OperatingSystemCL::reassignCores(Thread *thr)
84+
{
85+
int ncores = thr->numActiveCcores();
86+
//this is not equivalent to a no-op
87+
//I could release cores - then based on changes
88+
//to the cpumask, reserve different cores
89+
compute_sched_->releaseCores(ncores, thr);
90+
compute_sched_->reserveCores(ncores, thr);
91+
}
92+
8293
} // namespace Hg
8394
} // namespace SST

src/sst/elements/mercury/components/compute_library/operating_system_cl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class OperatingSystemCL : public OperatingSystemCLAPI, public OperatingSystemImp
5454

5555
void execute(COMP_FUNC, Event *data, int nthr = 1) override;
5656

57+
void reassignCores(Thread* thr) override;
58+
5759
static size_t stacksize() {
5860
return sst_hg_global_stacksize;
5961
}

src/sst/elements/mercury/components/operating_system_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ class OperatingSystemAPI : public SST::Hg::SubComponent {
120120
virtual void unregisterEventLib(Library *lib) = 0;
121121

122122
virtual void handleRequest(Request *req) = 0;
123+
124+
virtual void reassignCores(Thread* thr) { }
123125
};
124126

125127
} // namespace Hg

src/sst/elements/mercury/operating_system/process/thread.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,19 @@ Thread::~Thread()
240240
//if (host_timer_) delete host_timer_;
241241
}
242242

243+
void
244+
Thread::setCpumask(uint64_t cpumask)
245+
{
246+
cpumask_ = cpumask;
247+
os_->reassignCores(this);
248+
}
249+
250+
void
251+
Thread::setThreadId(int thr)
252+
{
253+
thread_id_ = thr;
254+
}
255+
243256
void
244257
Thread::startThread(Thread* thr)
245258
{

0 commit comments

Comments
 (0)