test: update threading benchmark

This commit is contained in:
parker
2025-07-11 13:09:17 +01:00
parent f232491313
commit 107fef09fc
4 changed files with 41 additions and 13 deletions

View File

@@ -1,10 +1,11 @@
#include <oneapi/tbb/parallel_for.h>
#include "Engine/Operator/GeometryOpDef.h"
#include <stdexcept>
#include <iostream>
#include "Engine/Network/NetworkManager.h"
#include "Engine/Operator/GeometryOperator.h"
#include "Engine/Types.h"
#include "Engine/Operator/AttributeHandle.h"
#include "Engine/Network/NetworkManager.h"
bool enzo::nt::GeometryOpDef::outputRequested(unsigned int outputIndex)
{
@@ -64,7 +65,7 @@ enzo::geo::Geometry& enzo::nt::GeometryOpDef::getOutputGeo(unsigned outputIndex)
void enzo::nt::GeometryOpDef::cookOp()
{
using namespace enzo;
std::cout << "COOKING\n";
// std::cout << "COOKING\n";
if(outputRequested(0))
{
@@ -104,6 +105,18 @@ void enzo::nt::GeometryOpDef::cookOp()
vector.x()+=2.5;
PAttrHandle.setValue(i, vector);
}
// ----
constexpr int N = 10000;
std::vector<double> results(N);
oneapi::tbb::parallel_for(0, N, [&](int i) {
double val = 0;
for (int j = 0; j < 100; ++j) {
val += std::sin(i + j);
}
results[i] = val;
});
// set output geometry

View File

@@ -58,7 +58,6 @@ void nt::GeometryOperator::addOutputConnection(std::shared_ptr<nt::GeometryConne
std::vector<std::shared_ptr<const nt::GeometryConnection>> nt::GeometryOperator::getInputConnections() const
{
std::vector<std::shared_ptr<const nt::GeometryConnection>> inputConnections;
std::cout << "input connections size: " << inputConnections_.size() <<"\n";
for(std::shared_ptr<nt::GeometryConnection> connection : inputConnections_)
{
inputConnections.push_back(connection);