Skip to content

Commit bea828f

Browse files
author
Noah Baumann
committed
minor more stuff
1 parent 9fb58b2 commit bea828f

2 files changed

Lines changed: 36 additions & 20 deletions

File tree

examples/jacobi3d/source/nosv.cpp

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,39 @@ void jacobiDriver(HiCR::InstanceManager *instanceManager, HiCR::CommunicationMan
108108

109109
// Compute resources to use
110110
HiCR::Device::computeResourceList_t cr;
111+
int size;
112+
MPI_Comm_size( MPI_COMM_WORLD, &size);
111113

112-
// Adding it to the list
113-
// auto itr = computeResources.begin();
114-
// for (size_t i = 0; i < 2ul; i++)
115-
// {
116-
// // Getting up-casted pointer for the processing unit
117-
// auto c = dynamic_pointer_cast<HiCR::backend::hwloc::ComputeResource>(*itr);
118-
119-
// // Checking whether the execution unit passed is compatible with this backend
120-
// if (c == nullptr) HICR_THROW_LOGIC("The passed compute resource is not supported by this processing unit type\n");
121-
122-
// // Getting the logical processor ID of the compute resource
123-
// auto pid = c->getProcessorId();
124-
125-
// printf("numaDomainId: %lu has PID: %u\n", numaDomainId, pid); fflush(stdout);
126-
// cr.push_back(*itr);
127-
// itr++;
128-
// }
114+
for(size_t i = 0; i < (size_t)(lt.x * lt.y * lt.z); i++)
115+
{
116+
cr.push_back(computeResources[(myInstanceId*size+i)%(computeResources.size())]);
117+
}
129118

119+
// cr.push_back(numaDomains[0]->getComputeResourceList()[0]);
120+
121+
for (int i = 0; i < size; ++i) {
122+
if (myInstanceId == (size_t)i) {
123+
auto itr = cr.begin();
124+
for (size_t i = 0; i < cr.size(); i++)
125+
{
126+
// Getting up-casted pointer for the processing unit
127+
auto c = dynamic_pointer_cast<HiCR::backend::hwloc::ComputeResource>(*itr);
128+
129+
// Checking whether the execution unit passed is compatible with this backend
130+
if (c == nullptr) HICR_THROW_LOGIC("The passed compute resource is not supported by this processing unit type\n");
131+
132+
// Getting the logical processor ID of the compute resource
133+
auto pid = c->getProcessorId();
134+
135+
printf("%u ", pid); fflush(stdout);
136+
137+
itr++;
138+
// cr.push_back(*itr);
139+
}
140+
printf("]\n"); fflush(stdout);
141+
}
142+
MPI_Barrier(MPI_COMM_WORLD);
143+
}
130144
// printf("PUs Per NUMA Domain: %lu\n", computeResources.size());
131145

132146
// Initializing nosv-based compute manager to run tasks in parallel

examples/jacobi3d/source/pthreads.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ ssize_t nIters = 100;
5656
D3 pt = D3({.x = 1, .y = 1, .z = 1});
5757
D3 lt = D3({.x = 1, .y = 1, .z = 1});
5858

59+
std::mutex mpi_mutex;
60+
5961
void jacobiDriver(HiCR::InstanceManager *instanceManager, HiCR::CommunicationManager *communicationManager, HiCR::MemoryManager *memoryManager)
6062
{
6163
// Creating (local host) topology manager
@@ -104,6 +106,8 @@ void jacobiDriver(HiCR::InstanceManager *instanceManager, HiCR::CommunicationMan
104106
{
105107
cr.push_back(computeResources[(myInstanceId*size+i)%(computeResources.size())]);
106108
}
109+
110+
// cr.push_back(numaDomains[0]->getComputeResourceList()[0]);
107111

108112
for (int i = 0; i < size; ++i) {
109113
if (myInstanceId == (size_t)i) {
@@ -138,7 +142,7 @@ void jacobiDriver(HiCR::InstanceManager *instanceManager, HiCR::CommunicationMan
138142
// Creating taskr object
139143
nlohmann::json taskrConfig;
140144
taskrConfig["Remember Finished Objects"] = true;
141-
taskr::Runtime taskr(&boostComputeManager, &pthreadsComputeManager, cr, taskrConfig);
145+
taskr::Runtime taskr(&boostComputeManager, &pthreadsComputeManager, computeResources, taskrConfig);
142146

143147
// Allowing tasks to immediately resume upon suspension -- they won't execute until their pending operation is finished
144148
taskr.setTaskCallbackHandler(HiCR::tasking::Task::callback_t::onTaskSuspend, [&taskr](taskr::Task *task) { taskr.resumeTask(task); });
@@ -154,8 +158,6 @@ void jacobiDriver(HiCR::InstanceManager *instanceManager, HiCR::CommunicationMan
154158

155159
// running the Jacobi3D example
156160
jacobi3d(instanceManager, taskr, g.get(), gDepth, N, nIters, pt, lt);
157-
158-
159161
}
160162

161163
#ifdef _TASKR_DISTRIBUTED_ENGINE_LPF

0 commit comments

Comments
 (0)