mirror of
https://git.wownero.com/wownero/RandomWOW.git
synced 2024-08-15 00:23:14 +00:00
Run a single thread synchronously
This commit is contained in:
parent
c05947db09
commit
03913d0e81
1 changed files with 29 additions and 14 deletions
43
src/main.cpp
43
src/main.cpp
|
@ -206,19 +206,29 @@ int main(int argc, char** argv) {
|
||||||
else {
|
else {
|
||||||
RandomX::Cache* cache = dataset.cache;
|
RandomX::Cache* cache = dataset.cache;
|
||||||
RandomX::datasetAlloc(dataset);
|
RandomX::datasetAlloc(dataset);
|
||||||
auto perThread = RandomX::DatasetBlockCount / threadCount;
|
if (threadCount > 1) {
|
||||||
auto remainder = RandomX::DatasetBlockCount % threadCount;
|
auto perThread = RandomX::DatasetBlockCount / threadCount;
|
||||||
for (int i = 0; i < threadCount; ++i) {
|
auto remainder = RandomX::DatasetBlockCount % threadCount;
|
||||||
auto count = perThread + (i == threadCount - 1 ? remainder : 0);
|
for (int i = 0; i < threadCount; ++i) {
|
||||||
if (softAes) {
|
auto count = perThread + (i == threadCount - 1 ? remainder : 0);
|
||||||
threads.push_back(std::thread(&RandomX::datasetInit<true>, cache, dataset, i * perThread, count));
|
if (softAes) {
|
||||||
|
threads.push_back(std::thread(&RandomX::datasetInit<true>, cache, dataset, i * perThread, count));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
threads.push_back(std::thread(&RandomX::datasetInit<false>, cache, dataset, i * perThread, count));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
for (int i = 0; i < threads.size(); ++i) {
|
||||||
threads.push_back(std::thread(&RandomX::datasetInit<false>, cache, dataset, i * perThread, count));
|
threads[i].join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < threads.size(); ++i) {
|
else {
|
||||||
threads[i].join();
|
if (softAes) {
|
||||||
|
RandomX::datasetInit<true>(cache, dataset, 0, RandomX::DatasetBlockCount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RandomX::datasetInit<false>(cache, dataset, 0, RandomX::DatasetBlockCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delete cache;
|
delete cache;
|
||||||
threads.clear();
|
threads.clear();
|
||||||
|
@ -238,11 +248,16 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
std::cout << "Running benchmark (" << programCount << " programs) ..." << std::endl;
|
std::cout << "Running benchmark (" << programCount << " programs) ..." << std::endl;
|
||||||
sw.restart();
|
sw.restart();
|
||||||
for (int i = 0; i < vms.size(); ++i) {
|
if (threadCount > 1) {
|
||||||
threads.push_back(std::thread(&mine, vms[i], std::ref(atomicNonce), std::ref(result), programCount, i));
|
for (int i = 0; i < vms.size(); ++i) {
|
||||||
|
threads.push_back(std::thread(&mine, vms[i], std::ref(atomicNonce), std::ref(result), programCount, i));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < threads.size(); ++i) {
|
||||||
|
threads[i].join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < threads.size(); ++i) {
|
else {
|
||||||
threads[i].join();
|
mine(vms[0], std::ref(atomicNonce), std::ref(result), programCount, 0);
|
||||||
}
|
}
|
||||||
double elapsed = sw.getElapsed();
|
double elapsed = sw.getElapsed();
|
||||||
std::cout << "Calculated result: ";
|
std::cout << "Calculated result: ";
|
||||||
|
|
Loading…
Reference in a new issue